[gnome-keyring/trust-store: 1/7] [user-store] Move old junky data file stuff into old user store.



commit 851384951becdd92ec555cf17a416f9841327ea3
Author: Stef Walter <stef memberwebs com>
Date:   Wed Sep 15 01:39:29 2010 +0000

    [user-store] Move old junky data file stuff into old user store.
    
    The GkmDataFile idea was a bad one, from which we learned. We'll keep
    using it in the old store for compatibility purposes.

 pkcs11/gkm/Makefile.am                             |    1 -
 pkcs11/gkm/tests/Makefile.am                       |   16 +--
 pkcs11/user-store/Makefile.am                      |    1 +
 .../gkm-data-file.c => user-store/gkm-user-file.c} |  187 +++++++++---------
 .../gkm-data-file.h => user-store/gkm-user-file.h} |   70 ++++----
 pkcs11/user-store/gkm-user-storage.c               |   54 +++---
 pkcs11/user-store/tests/.gitignore                 |    1 +
 pkcs11/user-store/tests/Makefile.am                |   19 ++-
 pkcs11/{gkm => user-store}/tests/dump-data-file.c  |   13 +-
 .../tests/test-data/data-file-private.store        |  Bin 494 -> 494 bytes
 .../tests/test-data/data-file-public.store         |  Bin 216 -> 216 bytes
 .../tests/unit-test-user-file.c}                   |  199 ++++++++++----------
 12 files changed, 284 insertions(+), 277 deletions(-)
---
diff --git a/pkcs11/gkm/Makefile.am b/pkcs11/gkm/Makefile.am
index bef87e9..47ee90b 100644
--- a/pkcs11/gkm/Makefile.am
+++ b/pkcs11/gkm/Makefile.am
@@ -27,7 +27,6 @@ libgkm_la_SOURCES = \
 	gkm-crypto.c gkm-crypto.h \
 	gkm-data-asn1.c gkm-data-asn1.h \
 	gkm-data-der.c gkm-data-der.h \
-	gkm-data-file.c gkm-data-file.h \
 	gkm-data-types.h \
 	gkm-dh-key.c gkm-dh-key.h \
 	gkm-dh-mechanism.c gkm-dh-mechanism.h \
diff --git a/pkcs11/gkm/tests/Makefile.am b/pkcs11/gkm/tests/Makefile.am
index e7fc9dc..7094bbc 100644
--- a/pkcs11/gkm/tests/Makefile.am
+++ b/pkcs11/gkm/tests/Makefile.am
@@ -15,9 +15,8 @@ TESTING_FILES = \
 	unit-test-store.c \
 	unit-test-memory-store.c \
 	unit-test-secret.c \
-	unit-test-data-file.c \
-	unit-test-file-tracker.c \
 	mock-locked-object.c mock-locked-object.h \
+	unit-test-file-tracker.c \
 	test-module.c test-module.h \
 	asn1-def-test.h
 
@@ -32,16 +31,3 @@ EXTRA_DIST = \
 	test-data
 
 include $(top_srcdir)/testing/testing.make
-
-# ---------------------------------------------------------------------
-
-noinst_PROGRAMS += \
-	dump-data-file
-
-dump_data_file_SOURCES = \
-	dump-data-file.c
-
-dump_data_file_LDADD = \
-	$(top_builddir)/pkcs11/gkm/libgkm.la \
-	$(top_builddir)/egg/libegg.la \
-	$(DAEMON_LIBS)
\ No newline at end of file
diff --git a/pkcs11/user-store/Makefile.am b/pkcs11/user-store/Makefile.am
index 80aa20a..e357b81 100644
--- a/pkcs11/user-store/Makefile.am
+++ b/pkcs11/user-store/Makefile.am
@@ -16,6 +16,7 @@ noinst_LTLIBRARIES = \
 
 libgkm_user_store_la_SOURCES = \
 	gkm-user-store.h \
+	gkm-user-file.c gkm-user-file.h \
 	gkm-user-module.c gkm-user-module.h \
 	gkm-user-private-key.c gkm-user-private-key.h \
 	gkm-user-public-key.c gkm-user-public-key.h \
diff --git a/pkcs11/gkm/gkm-data-file.c b/pkcs11/user-store/gkm-user-file.c
similarity index 87%
rename from pkcs11/gkm/gkm-data-file.c
rename to pkcs11/user-store/gkm-user-file.c
index 1d2f77f..fd5afe9 100644
--- a/pkcs11/gkm/gkm-data-file.c
+++ b/pkcs11/user-store/gkm-user-file.c
@@ -21,12 +21,13 @@
 
 #include "config.h"
 
-#include "gkm-attributes.h"
-#include "gkm-crypto.h"
-#include "gkm-data-file.h"
-#include "gkm-data-types.h"
-#include "gkm-marshal.h"
-#include "gkm-util.h"
+#include "gkm-user-file.h"
+
+#include "gkm/gkm-attributes.h"
+#include "gkm/gkm-crypto.h"
+#include "gkm/gkm-data-types.h"
+#include "gkm/gkm-marshal.h"
+#include "gkm/gkm-util.h"
 
 #include "egg/egg-buffer.h"
 #include "egg/egg-hex.h"
@@ -51,7 +52,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-struct _GkmDataFile {
+struct _GkmUserFile {
 	GObject parent;
 
 	/* The data itself */
@@ -73,7 +74,7 @@ typedef struct _UnknownBlock {
 	EggBuffer buffer;
 } UnknownBlock;
 
-G_DEFINE_TYPE (GkmDataFile, gkm_data_file, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GkmUserFile, gkm_user_file, G_TYPE_OBJECT);
 
 #define PUBLIC_ALLOC (EggBufferAllocator)g_realloc
 #define PRIVATE_ALLOC (EggBufferAllocator)egg_secure_realloc
@@ -533,7 +534,7 @@ decrypt_buffer (EggBuffer *input, gsize *offset, GkmSecret *login, EggBuffer *ou
  */
 
 static GkmDataResult
-update_entries_from_block (GkmDataFile *self, guint section, GHashTable *entries,
+update_entries_from_block (GkmUserFile *self, guint section, GHashTable *entries,
                            EggBuffer *buffer, gsize *offset)
 {
 	GHashTable *attributes;
@@ -550,7 +551,7 @@ update_entries_from_block (GkmDataFile *self, guint section, GHashTable *entries
 	gsize n_data;
 	guint64 type;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (entries);
 	g_assert (buffer);
 	g_assert (offset);
@@ -620,25 +621,25 @@ update_entries_from_block (GkmDataFile *self, guint section, GHashTable *entries
 }
 
 static GkmDataResult
-update_from_public_block (GkmDataFile *self, EggBuffer *buffer)
+update_from_public_block (GkmUserFile *self, EggBuffer *buffer)
 {
 	gsize offset = 0;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
-	self->sections |= GKM_DATA_FILE_SECTION_PUBLIC;
+	self->sections |= GKM_USER_FILE_SECTION_PUBLIC;
 
 	/* Validate the buffer hash, failure in this case is corruption */
 	if (!validate_buffer (buffer, &offset))
 		return GKM_DATA_FAILURE;
 
-	return update_entries_from_block (self, GKM_DATA_FILE_SECTION_PUBLIC,
+	return update_entries_from_block (self, GKM_USER_FILE_SECTION_PUBLIC,
 	                                  self->publics, buffer, &offset);
 }
 
 static GkmDataResult
-update_from_private_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *login)
+update_from_private_block (GkmUserFile *self, EggBuffer *buffer, GkmSecret *login)
 {
 	EggBuffer custom;
 	GkmDataResult res;
@@ -646,10 +647,10 @@ update_from_private_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *logi
 	gsize n_password;
 	gsize offset;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
-	self->sections |= GKM_DATA_FILE_SECTION_PRIVATE;
+	self->sections |= GKM_USER_FILE_SECTION_PRIVATE;
 
 	/* Skip private blocks when not unlocked */
 	if (login == NULL) {
@@ -681,7 +682,7 @@ update_from_private_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *logi
 	if (!self->privates)
 		self->privates = entries_new ();
 
-	res = update_entries_from_block (self, GKM_DATA_FILE_SECTION_PRIVATE,
+	res = update_entries_from_block (self, GKM_USER_FILE_SECTION_PRIVATE,
 	                                 self->privates, &custom, &offset);
 	egg_buffer_uninit (&custom);
 	return res;
@@ -696,17 +697,17 @@ copy_each_identifier (gpointer key, gpointer value, gpointer data)
 static void
 remove_each_identifier (gpointer key, gpointer value, gpointer data)
 {
-	GkmDataFile *self = GKM_DATA_FILE (data);
+	GkmUserFile *self = GKM_USER_FILE (data);
 	GHashTable *entries;
 	guint section;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (key);
 
-	if (!gkm_data_file_lookup_entry (self, key, &section))
+	if (!gkm_user_file_lookup_entry (self, key, &section))
 		g_assert_not_reached ();
 
-	if (section == GKM_DATA_FILE_SECTION_PRIVATE)
+	if (section == GKM_USER_FILE_SECTION_PRIVATE)
 		entries = self->privates;
 	else
 		entries = self->publics;
@@ -728,7 +729,7 @@ remove_each_identifier (gpointer key, gpointer value, gpointer data)
 }
 
 static GkmDataResult
-update_from_index_block (GkmDataFile *self, EggBuffer *buffer)
+update_from_index_block (GkmUserFile *self, EggBuffer *buffer)
 {
 	gchar *identifier;
 	gsize offset;
@@ -736,7 +737,7 @@ update_from_index_block (GkmDataFile *self, EggBuffer *buffer)
 	guint count, i;
 	guint value;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
 	offset = 0;
@@ -776,11 +777,11 @@ static GkmDataResult
 update_from_any_block (guint block, EggBuffer *buffer, GkmSecret *login, gpointer user_data)
 {
 	UnknownBlock *unknown;
-	GkmDataFile *self;
+	GkmUserFile *self;
 	GkmDataResult res;
 
-	g_assert (GKM_IS_DATA_FILE (user_data));
-	self = GKM_DATA_FILE (user_data);
+	g_assert (GKM_IS_USER_FILE (user_data));
+	self = GKM_USER_FILE (user_data);
 
 	switch (block) {
 	case FILE_BLOCK_INDEX:
@@ -833,11 +834,11 @@ write_each_entry (gpointer key, gpointer value, gpointer data)
 }
 
 static GkmDataResult
-write_entries_to_block (GkmDataFile *self, GHashTable *entries, EggBuffer *buffer)
+write_entries_to_block (GkmUserFile *self, GHashTable *entries, EggBuffer *buffer)
 {
 	gsize offset;
 
-	g_assert (GKM_DATA_FILE (self));
+	g_assert (GKM_USER_FILE (self));
 	g_assert (entries);
 	g_assert (buffer);
 
@@ -864,12 +865,12 @@ write_entries_to_block (GkmDataFile *self, GHashTable *entries, EggBuffer *buffe
 }
 
 static GkmDataResult
-write_private_to_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *login)
+write_private_to_block (GkmUserFile *self, EggBuffer *buffer, GkmSecret *login)
 {
 	EggBuffer secure;
 	GkmDataResult res;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
 	if (login == NULL) {
@@ -897,9 +898,9 @@ write_private_to_block (GkmDataFile *self, EggBuffer *buffer, GkmSecret *login)
 }
 
 static GkmDataResult
-write_public_to_block (GkmDataFile *self, EggBuffer *buffer)
+write_public_to_block (GkmUserFile *self, EggBuffer *buffer)
 {
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
 	return write_entries_to_block (self, self->publics, buffer);
@@ -913,9 +914,9 @@ write_each_index_identifier (gpointer key, gpointer value, gpointer data)
 }
 
 static GkmDataResult
-write_index_to_block (GkmDataFile *self, EggBuffer *buffer)
+write_index_to_block (GkmUserFile *self, EggBuffer *buffer)
 {
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (buffer);
 
 	/* The number of entries */
@@ -928,13 +929,13 @@ write_index_to_block (GkmDataFile *self, EggBuffer *buffer)
 }
 
 static GkmDataResult
-identifier_to_attributes (GkmDataFile *self, const gchar *identifier, GHashTable **attributes)
+identifier_to_attributes (GkmUserFile *self, const gchar *identifier, GHashTable **attributes)
 {
 	GHashTable *entries;
 	gpointer value;
 	guint section;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 	g_assert (identifier);
 	g_assert (attributes);
 
@@ -942,7 +943,7 @@ identifier_to_attributes (GkmDataFile *self, const gchar *identifier, GHashTable
 		return GKM_DATA_UNRECOGNIZED;
 
 	section = GPOINTER_TO_UINT (value);
-	if (section == GKM_DATA_FILE_SECTION_PRIVATE)
+	if (section == GKM_USER_FILE_SECTION_PRIVATE)
 		entries = self->privates;
 	else
 		entries = self->publics;
@@ -988,8 +989,8 @@ sort_unknowns_by_type (gconstpointer a, gconstpointer b)
 }
 
 typedef struct _ForeachArgs {
-	GkmDataFile *self;
-	GkmDataFileFunc func;
+	GkmUserFile *self;
+	GkmUserFileFunc func;
 	gpointer user_data;
 } ForeachArgs;
 
@@ -997,7 +998,7 @@ static void
 foreach_identifier (gpointer key, gpointer value, gpointer data)
 {
 	ForeachArgs *args = data;
-	g_assert (GKM_IS_DATA_FILE (args->self));
+	g_assert (GKM_IS_USER_FILE (args->self));
 	(args->func) (args->self, key, args->user_data);
 }
 
@@ -1021,14 +1022,14 @@ dump_attributes (gpointer key, gpointer value, gpointer user_data)
 }
 
 static void
-dump_identifier_and_attributes (GkmDataFile *self, const gchar *identifier, gpointer user_data)
+dump_identifier_and_attributes (GkmUserFile *self, const gchar *identifier, gpointer user_data)
 {
 	GHashTable *attributes;
 	guint section;
 
-	g_assert (GKM_IS_DATA_FILE (self));
+	g_assert (GKM_IS_USER_FILE (self));
 
-	if (!gkm_data_file_lookup_entry (self, identifier, &section))
+	if (!gkm_user_file_lookup_entry (self, identifier, &section))
 		g_assert_not_reached ();
 
 	if (GPOINTER_TO_UINT (user_data) == section) {
@@ -1046,7 +1047,7 @@ dump_identifier_and_attributes (GkmDataFile *self, const gchar *identifier, gpoi
  */
 
 static void
-gkm_data_file_init (GkmDataFile *self)
+gkm_user_file_init (GkmUserFile *self)
 {
 	self->identifiers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 	self->publics = entries_new ();
@@ -1058,9 +1059,9 @@ gkm_data_file_init (GkmDataFile *self)
 }
 
 static void
-gkm_data_file_finalize (GObject *obj)
+gkm_user_file_finalize (GObject *obj)
 {
-	GkmDataFile *self = GKM_DATA_FILE (obj);
+	GkmUserFile *self = GKM_USER_FILE (obj);
 
 	g_assert (self->identifiers);
 	g_hash_table_destroy (self->identifiers);
@@ -1079,11 +1080,11 @@ gkm_data_file_finalize (GObject *obj)
 	free_unknown_block_list (self->unknowns);
 	self->unknowns = NULL;
 
-	G_OBJECT_CLASS (gkm_data_file_parent_class)->finalize (obj);
+	G_OBJECT_CLASS (gkm_user_file_parent_class)->finalize (obj);
 }
 
 static void
-gkm_data_file_set_property (GObject *obj, guint prop_id, const GValue *value,
+gkm_user_file_set_property (GObject *obj, guint prop_id, const GValue *value,
                                 GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -1094,7 +1095,7 @@ gkm_data_file_set_property (GObject *obj, guint prop_id, const GValue *value,
 }
 
 static void
-gkm_data_file_get_property (GObject *obj, guint prop_id, GValue *value,
+gkm_user_file_get_property (GObject *obj, guint prop_id, GValue *value,
                                 GParamSpec *pspec)
 {
 	switch (prop_id) {
@@ -1105,26 +1106,26 @@ gkm_data_file_get_property (GObject *obj, guint prop_id, GValue *value,
 }
 
 static void
-gkm_data_file_class_init (GkmDataFileClass *klass)
+gkm_user_file_class_init (GkmUserFileClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-	gobject_class->finalize = gkm_data_file_finalize;
-	gobject_class->set_property = gkm_data_file_set_property;
-	gobject_class->get_property = gkm_data_file_get_property;
+	gobject_class->finalize = gkm_user_file_finalize;
+	gobject_class->set_property = gkm_user_file_set_property;
+	gobject_class->get_property = gkm_user_file_get_property;
 
-	signals[ENTRY_ADDED] = g_signal_new ("entry-added", GKM_TYPE_DATA_FILE,
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_added),
+	signals[ENTRY_ADDED] = g_signal_new ("entry-added", GKM_TYPE_USER_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmUserFileClass, entry_added),
 	                                NULL, NULL, g_cclosure_marshal_VOID__STRING,
 	                                G_TYPE_NONE, 1, G_TYPE_STRING);
 
-	signals[ENTRY_CHANGED] = g_signal_new ("entry-changed", GKM_TYPE_DATA_FILE,
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_changed),
+	signals[ENTRY_CHANGED] = g_signal_new ("entry-changed", GKM_TYPE_USER_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmUserFileClass, entry_changed),
 	                                NULL, NULL, gkm_marshal_VOID__STRING_ULONG,
 	                                G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_ULONG);
 
-	signals[ENTRY_REMOVED] = g_signal_new ("entry-removed", GKM_TYPE_DATA_FILE,
-	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmDataFileClass, entry_removed),
+	signals[ENTRY_REMOVED] = g_signal_new ("entry-removed", GKM_TYPE_USER_FILE,
+	                                G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GkmUserFileClass, entry_removed),
 	                                NULL, NULL, g_cclosure_marshal_VOID__STRING,
 	                                G_TYPE_NONE, 1, G_TYPE_STRING);
 }
@@ -1133,18 +1134,18 @@ gkm_data_file_class_init (GkmDataFileClass *klass)
  * PUBLIC
  */
 
-GkmDataFile*
-gkm_data_file_new (void)
+GkmUserFile*
+gkm_user_file_new (void)
 {
-	return g_object_new (GKM_TYPE_DATA_FILE, NULL);
+	return g_object_new (GKM_TYPE_USER_FILE, NULL);
 }
 
 GkmDataResult
-gkm_data_file_read_fd (GkmDataFile *self, int fd, GkmSecret *login)
+gkm_user_file_read_fd (GkmUserFile *self, int fd, GkmSecret *login)
 {
 	GkmDataResult res;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 
 	/* Reads are not reentrant for a single data file */
 	g_return_val_if_fail (self->checks == NULL, GKM_DATA_FAILURE);
@@ -1174,7 +1175,7 @@ gkm_data_file_read_fd (GkmDataFile *self, int fd, GkmSecret *login)
 		 * time around).
 		 */
 
-		if (self->privates == NULL && !(self->sections & GKM_DATA_FILE_SECTION_PRIVATE))
+		if (self->privates == NULL && !(self->sections & GKM_USER_FILE_SECTION_PRIVATE))
 			self->privates = entries_new ();
 
 	/* Note that our last read failed */
@@ -1189,7 +1190,7 @@ gkm_data_file_read_fd (GkmDataFile *self, int fd, GkmSecret *login)
 }
 
 GkmDataResult
-gkm_data_file_write_fd (GkmDataFile *self, int fd, GkmSecret *login)
+gkm_user_file_write_fd (GkmUserFile *self, int fd, GkmSecret *login)
 {
 	guint types[3] = { FILE_BLOCK_INDEX, FILE_BLOCK_PRIVATE, FILE_BLOCK_PUBLIC };
 	GList *unknowns, *unk;
@@ -1199,7 +1200,7 @@ gkm_data_file_write_fd (GkmDataFile *self, int fd, GkmSecret *login)
 	guint type;
 	gint i;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (!self->incomplete, GKM_DATA_FAILURE);
 
 	/* Write out the header */
@@ -1270,11 +1271,11 @@ gkm_data_file_write_fd (GkmDataFile *self, int fd, GkmSecret *login)
 }
 
 gboolean
-gkm_data_file_lookup_entry (GkmDataFile *self, const gchar *identifier, guint *section)
+gkm_user_file_lookup_entry (GkmUserFile *self, const gchar *identifier, guint *section)
 {
 	gpointer value;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), FALSE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), FALSE);
 	g_return_val_if_fail (identifier, FALSE);
 
 	if (!g_hash_table_lookup_extended (self->identifiers, identifier, NULL, &value))
@@ -1287,28 +1288,28 @@ gkm_data_file_lookup_entry (GkmDataFile *self, const gchar *identifier, guint *s
 }
 
 void
-gkm_data_file_foreach_entry (GkmDataFile *self, GkmDataFileFunc func, gpointer user_data)
+gkm_user_file_foreach_entry (GkmUserFile *self, GkmUserFileFunc func, gpointer user_data)
 {
 	ForeachArgs args = { self, func, user_data };
 
-	g_return_if_fail (GKM_IS_DATA_FILE (self));
+	g_return_if_fail (GKM_IS_USER_FILE (self));
 	g_return_if_fail (func);
 
 	g_hash_table_foreach (self->identifiers, foreach_identifier, &args);
 }
 
 GkmDataResult
-gkm_data_file_unique_entry (GkmDataFile *self, gchar **identifier)
+gkm_user_file_unique_entry (GkmUserFile *self, gchar **identifier)
 {
 	gchar *base, *ext;
 	guint seed = 1;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 
 	/* Check if original is unique */
 	if (*identifier != NULL) {
-		if (!gkm_data_file_lookup_entry (self, *identifier, NULL))
+		if (!gkm_user_file_lookup_entry (self, *identifier, NULL))
 			return GKM_DATA_SUCCESS;
 	}
 
@@ -1324,7 +1325,7 @@ gkm_data_file_unique_entry (GkmDataFile *self, gchar **identifier)
 
 	for (seed = 0; TRUE; ++seed) {
 		*identifier = g_strdup_printf ("%s-%d%s%s", base, seed, ext ? "." : "", ext ? ext : "");
-		if (!gkm_data_file_lookup_entry (self, *identifier, NULL))
+		if (!gkm_user_file_lookup_entry (self, *identifier, NULL))
 			break;
 
 		if (seed < 1000000) {
@@ -1342,15 +1343,15 @@ gkm_data_file_unique_entry (GkmDataFile *self, gchar **identifier)
 }
 
 GkmDataResult
-gkm_data_file_create_entry (GkmDataFile *self, const gchar *identifier, guint section)
+gkm_user_file_create_entry (GkmUserFile *self, const gchar *identifier, guint section)
 {
 	GHashTable *attributes;
 	GHashTable *entries;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 
-	if (section == GKM_DATA_FILE_SECTION_PRIVATE) {
+	if (section == GKM_USER_FILE_SECTION_PRIVATE) {
 		if (!self->privates)
 			return GKM_DATA_LOCKED;
 		entries = self->privates;
@@ -1371,18 +1372,18 @@ gkm_data_file_create_entry (GkmDataFile *self, const gchar *identifier, guint se
 }
 
 GkmDataResult
-gkm_data_file_destroy_entry (GkmDataFile *self, const gchar *identifier)
+gkm_user_file_destroy_entry (GkmUserFile *self, const gchar *identifier)
 {
 	GHashTable *entries;
 	guint section;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 
-	if (!gkm_data_file_lookup_entry (self, identifier, &section))
+	if (!gkm_user_file_lookup_entry (self, identifier, &section))
 		return GKM_DATA_UNRECOGNIZED;
 
-	if (section == GKM_DATA_FILE_SECTION_PRIVATE) {
+	if (section == GKM_USER_FILE_SECTION_PRIVATE) {
 		if (!self->privates)
 			return GKM_DATA_LOCKED;
 		entries = self->privates;
@@ -1400,7 +1401,7 @@ gkm_data_file_destroy_entry (GkmDataFile *self, const gchar *identifier)
 }
 
 GkmDataResult
-gkm_data_file_write_value (GkmDataFile *self, const gchar *identifier,
+gkm_user_file_write_value (GkmUserFile *self, const gchar *identifier,
                            gulong type, gconstpointer value, gsize n_value)
 {
 	GHashTable *attributes;
@@ -1408,7 +1409,7 @@ gkm_data_file_write_value (GkmDataFile *self, const gchar *identifier,
 	CK_ATTRIBUTE attr;
 	GkmDataResult res;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 	g_return_val_if_fail (value || !n_value, GKM_DATA_FAILURE);
 
@@ -1433,14 +1434,14 @@ gkm_data_file_write_value (GkmDataFile *self, const gchar *identifier,
 }
 
 GkmDataResult
-gkm_data_file_read_value (GkmDataFile *self, const gchar *identifier,
+gkm_user_file_read_value (GkmUserFile *self, const gchar *identifier,
                           gulong type, gconstpointer *value, gsize *n_value)
 {
 	CK_ATTRIBUTE_PTR attr;
 	GHashTable *attributes;
 	GkmDataResult res;
 
-	g_return_val_if_fail (GKM_IS_DATA_FILE (self), GKM_DATA_FAILURE);
+	g_return_val_if_fail (GKM_IS_USER_FILE (self), GKM_DATA_FAILURE);
 	g_return_val_if_fail (identifier, GKM_DATA_FAILURE);
 	g_return_val_if_fail (value, GKM_DATA_FAILURE);
 	g_return_val_if_fail (n_value, GKM_DATA_FAILURE);
@@ -1461,18 +1462,18 @@ gkm_data_file_read_value (GkmDataFile *self, const gchar *identifier,
 }
 
 gboolean
-gkm_data_file_have_section (GkmDataFile *self, guint section)
+gkm_user_file_have_section (GkmUserFile *self, guint section)
 {
 	return (self->sections & section) ? TRUE : FALSE;
 }
 
 void
-gkm_data_file_dump (GkmDataFile *self)
+gkm_user_file_dump (GkmUserFile *self)
 {
 	g_print ("PUBLIC:\n\n");
-	gkm_data_file_foreach_entry (self, dump_identifier_and_attributes,
-	                             GUINT_TO_POINTER (GKM_DATA_FILE_SECTION_PUBLIC));
+	gkm_user_file_foreach_entry (self, dump_identifier_and_attributes,
+	                             GUINT_TO_POINTER (GKM_USER_FILE_SECTION_PUBLIC));
 	g_print ("PRIVATE:\n\n");
-	gkm_data_file_foreach_entry (self, dump_identifier_and_attributes,
-	                             GUINT_TO_POINTER (GKM_DATA_FILE_SECTION_PRIVATE));
+	gkm_user_file_foreach_entry (self, dump_identifier_and_attributes,
+	                             GUINT_TO_POINTER (GKM_USER_FILE_SECTION_PRIVATE));
 }
diff --git a/pkcs11/gkm/gkm-data-file.h b/pkcs11/user-store/gkm-user-file.h
similarity index 54%
rename from pkcs11/gkm/gkm-data-file.h
rename to pkcs11/user-store/gkm-user-file.h
index c55f47b..ac92a79 100644
--- a/pkcs11/gkm/gkm-data-file.h
+++ b/pkcs11/user-store/gkm-user-file.h
@@ -19,91 +19,91 @@
  * 02111-1307, USA.
  */
 
-#ifndef __GKM_DATA_FILE_H__
-#define __GKM_DATA_FILE_H__
+#ifndef __GKM_USER_FILE_H__
+#define __GKM_USER_FILE_H__
 
 #include <glib-object.h>
 
-#include "gkm-data-types.h"
-#include "gkm-secret.h"
+#include "gkm/gkm-data-types.h"
+#include "gkm/gkm-secret.h"
 
 enum {
-	GKM_DATA_FILE_SECTION_PUBLIC  = 0x01,
-	GKM_DATA_FILE_SECTION_PRIVATE = 0x02,
+	GKM_USER_FILE_SECTION_PUBLIC  = 0x01,
+	GKM_USER_FILE_SECTION_PRIVATE = 0x02,
 };
 
-#define GKM_TYPE_DATA_FILE               (gkm_data_file_get_type ())
-#define GKM_DATA_FILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_DATA_FILE, GkmDataFile))
-#define GKM_DATA_FILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_DATA_FILE, GkmDataFileClass))
-#define GKM_IS_DATA_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_DATA_FILE))
-#define GKM_IS_DATA_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_DATA_FILE))
-#define GKM_DATA_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_DATA_FILE, GkmDataFileClass))
+#define GKM_TYPE_USER_FILE               (gkm_user_file_get_type ())
+#define GKM_USER_FILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_USER_FILE, GkmUserFile))
+#define GKM_USER_FILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_USER_FILE, GkmUserFileClass))
+#define GKM_IS_USER_FILE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_USER_FILE))
+#define GKM_IS_USER_FILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_USER_FILE))
+#define GKM_USER_FILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_USER_FILE, GkmUserFileClass))
 
-typedef struct _GkmDataFile GkmDataFile;
-typedef struct _GkmDataFileClass GkmDataFileClass;
+typedef struct _GkmUserFile GkmUserFile;
+typedef struct _GkmUserFileClass GkmUserFileClass;
 
-struct _GkmDataFileClass {
+struct _GkmUserFileClass {
 	GObjectClass parent_class;
 
 	/* signals */
 
-	void (*entry_added) (GkmDataFile *store, const gchar *identifier);
+	void (*entry_added) (GkmUserFile *store, const gchar *identifier);
 
-	void (*entry_changed) (GkmDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type);
+	void (*entry_changed) (GkmUserFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type);
 
-	void (*entry_removed) (GkmDataFile *store, const gchar *identifier);
+	void (*entry_removed) (GkmUserFile *store, const gchar *identifier);
 };
 
-typedef void (*GkmDataFileFunc) (GkmDataFile *file, const gchar *identifier, gpointer user_data);
+typedef void (*GkmUserFileFunc) (GkmUserFile *file, const gchar *identifier, gpointer user_data);
 
-GType                     gkm_data_file_get_type               (void);
+GType                     gkm_user_file_get_type               (void);
 
-GkmDataFile*              gkm_data_file_new                    (void);
+GkmUserFile*              gkm_user_file_new                    (void);
 
-GkmDataResult             gkm_data_file_read_fd                (GkmDataFile *self,
+GkmDataResult             gkm_user_file_read_fd                (GkmUserFile *self,
                                                                 int fd,
                                                                 GkmSecret *login);
 
-GkmDataResult             gkm_data_file_write_fd               (GkmDataFile *self,
+GkmDataResult             gkm_user_file_write_fd               (GkmUserFile *self,
                                                                 int fd,
                                                                 GkmSecret *login);
 
-gboolean                  gkm_data_file_have_section           (GkmDataFile *self,
+gboolean                  gkm_user_file_have_section           (GkmUserFile *self,
                                                                 guint section);
 
-gboolean                  gkm_data_file_lookup_entry           (GkmDataFile *self,
+gboolean                  gkm_user_file_lookup_entry           (GkmUserFile *self,
                                                                 const gchar *identifier,
                                                                 guint *section);
 
-void                      gkm_data_file_foreach_entry          (GkmDataFile *self,
-                                                                GkmDataFileFunc func,
+void                      gkm_user_file_foreach_entry          (GkmUserFile *self,
+                                                                GkmUserFileFunc func,
                                                                 gpointer user_data);
 
-GkmDataResult             gkm_data_file_unique_entry           (GkmDataFile *self,
+GkmDataResult             gkm_user_file_unique_entry           (GkmUserFile *self,
                                                                 gchar **identifier);
 
-GkmDataResult             gkm_data_file_create_entry           (GkmDataFile *self,
+GkmDataResult             gkm_user_file_create_entry           (GkmUserFile *self,
                                                                 const gchar *identifier,
                                                                 guint section);
 
-GkmDataResult             gkm_data_file_destroy_entry          (GkmDataFile *self,
+GkmDataResult             gkm_user_file_destroy_entry          (GkmUserFile *self,
                                                                 const gchar *identifier);
 
-GkmDataResult             gkm_data_file_write_value            (GkmDataFile *self,
+GkmDataResult             gkm_user_file_write_value            (GkmUserFile *self,
                                                                 const gchar *identifier,
                                                                 gulong type,
                                                                 gconstpointer value,
                                                                 gsize n_value);
 
-GkmDataResult             gkm_data_file_read_value             (GkmDataFile *self,
+GkmDataResult             gkm_user_file_read_value             (GkmUserFile *self,
                                                                 const gchar *identifier,
                                                                 gulong type,
                                                                 gconstpointer *value,
                                                                 gsize *n_value);
 
-void                      gkm_data_file_foreach_value          (GkmDataFile *self,
+void                      gkm_user_file_foreach_value          (GkmUserFile *self,
                                                                 const gchar *identifier);
 
-void                      gkm_data_file_dump                   (GkmDataFile *self);
+void                      gkm_user_file_dump                   (GkmUserFile *self);
 
-#endif /* __GKM_DATA_FILE_H__ */
+#endif /* __GKM_USER_FILE_H__ */
diff --git a/pkcs11/user-store/gkm-user-storage.c b/pkcs11/user-store/gkm-user-storage.c
index 4b3a6ae..6ea47ff 100644
--- a/pkcs11/user-store/gkm-user-storage.c
+++ b/pkcs11/user-store/gkm-user-storage.c
@@ -21,13 +21,13 @@
 
 #include "config.h"
 
-#include "gkm-user-storage.h"
+#include "gkm-user-file.h"
 #include "gkm-user-private-key.h"
 #include "gkm-user-public-key.h"
+#include "gkm-user-storage.h"
 
 #include "gkm/gkm-certificate.h"
 #include "gkm/gkm-data-asn1.h"
-#include "gkm/gkm-data-file.h"
 #include "gkm/gkm-manager.h"
 #include "gkm/gkm-module.h"
 #include "gkm/gkm-secret.h"
@@ -67,7 +67,7 @@ struct _GkmUserStorage {
 	/* Information about file data */
 	gchar *directory;
 	gchar *filename;
-	GkmDataFile *file;
+	GkmUserFile *file;
 	time_t last_mtime;
 	GkmSecret *login;
 
@@ -363,7 +363,7 @@ complete_modification_state (GkmTransaction *transaction, GObject *object, gpoin
 	GkmDataResult res;
 
 	if (!gkm_transaction_get_failed (transaction)) {
-		res = gkm_data_file_write_fd (self->file, self->write_fd, self->login);
+		res = gkm_user_file_write_fd (self->file, self->write_fd, self->login);
 		switch(res) {
 		case GKM_DATA_FAILURE:
 		case GKM_DATA_UNRECOGNIZED:
@@ -395,7 +395,7 @@ begin_modification_state (GkmUserStorage *self, GkmTransaction *transaction)
 	/* See if file needs updating */
 	if (fstat (self->read_fd, &sb) >= 0 && sb.st_mtime != self->last_mtime) {
 
-		res = gkm_data_file_read_fd (self->file, self->read_fd, self->login);
+		res = gkm_user_file_read_fd (self->file, self->read_fd, self->login);
 		switch (res) {
 		case GKM_DATA_FAILURE:
 			g_message ("failure updating user store file: %s", self->filename);
@@ -465,7 +465,7 @@ check_object_hash (GkmUserStorage *self, const gchar *identifier, const guchar *
 	digest = g_compute_checksum_for_data (G_CHECKSUM_SHA1, data, n_data);
 	g_return_val_if_fail (digest, FALSE);
 
-	res = gkm_data_file_read_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, &value, &n_value);
+	res = gkm_user_file_read_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, &value, &n_value);
 	g_return_val_if_fail (res == GKM_DATA_SUCCESS, FALSE);
 
 	result = (strlen (digest) == n_value && memcmp (digest, value, n_value) == 0);
@@ -492,7 +492,7 @@ store_object_hash (GkmUserStorage *self, GkmTransaction *transaction, const gcha
 		g_return_if_reached ();
 	}
 
-	res = gkm_data_file_write_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, digest, strlen (digest));
+	res = gkm_user_file_write_value (self->file, identifier, CKA_GNOME_INTERNAL_SHA1, digest, strlen (digest));
 	g_free (digest);
 
 	if (res != GKM_DATA_SUCCESS)
@@ -500,7 +500,7 @@ store_object_hash (GkmUserStorage *self, GkmTransaction *transaction, const gcha
 }
 
 static void
-data_file_entry_added (GkmDataFile *store, const gchar *identifier, GkmUserStorage *self)
+data_file_entry_added (GkmUserFile *store, const gchar *identifier, GkmUserStorage *self)
 {
 	GError *error = NULL;
 	GkmObject *object;
@@ -560,7 +560,7 @@ data_file_entry_added (GkmDataFile *store, const gchar *identifier, GkmUserStora
 }
 
 static void
-data_file_entry_changed (GkmDataFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type, GkmUserStorage *self)
+data_file_entry_changed (GkmUserFile *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type, GkmUserStorage *self)
 {
 	GkmObject *object;
 
@@ -573,7 +573,7 @@ data_file_entry_changed (GkmDataFile *store, const gchar *identifier, CK_ATTRIBU
 }
 
 static void
-data_file_entry_removed (GkmDataFile *store, const gchar *identifier, GkmUserStorage *self)
+data_file_entry_removed (GkmUserFile *store, const gchar *identifier, GkmUserStorage *self)
 {
 	GkmObject *object;
 
@@ -682,7 +682,7 @@ typedef struct _RelockArgs {
 } RelockArgs;
 
 static void
-relock_each_object (GkmDataFile *file, const gchar *identifier, gpointer data)
+relock_each_object (GkmUserFile *file, const gchar *identifier, gpointer data)
 {
 	RelockArgs *args = data;
 	gchar *path;
@@ -692,11 +692,11 @@ relock_each_object (GkmDataFile *file, const gchar *identifier, gpointer data)
 	if (gkm_transaction_get_failed (args->transaction))
 		return;
 
-	if (!gkm_data_file_lookup_entry (file, identifier, &section))
+	if (!gkm_user_file_lookup_entry (file, identifier, &section))
 		g_return_if_reached ();
 
 	/* Only operate on private files */
-	if (section != GKM_DATA_FILE_SECTION_PRIVATE)
+	if (section != GKM_USER_FILE_SECTION_PRIVATE)
 		return;
 
 	path = g_build_filename (args->self->directory, identifier, NULL);
@@ -728,7 +728,7 @@ refresh_with_login (GkmUserStorage *self, GkmSecret *login)
 	if (fstat (fd, &sb) >= 0)
 		self->last_mtime = sb.st_mtime;
 
-	res = gkm_data_file_read_fd (self->file, fd, login);
+	res = gkm_user_file_read_fd (self->file, fd, login);
 	switch (res) {
 	case GKM_DATA_FAILURE:
 		g_message ("failure reading from file: %s", self->filename);
@@ -785,7 +785,7 @@ gkm_user_storage_real_read_value (GkmStore *base, GkmObject *object, CK_ATTRIBUT
 			return rv;
 	}
 
-	res = gkm_data_file_read_value (self->file, identifier, attr->type, &value, &n_value);
+	res = gkm_user_file_read_value (self->file, identifier, attr->type, &value, &n_value);
 	switch (res) {
 	case GKM_DATA_FAILURE:
 		g_return_val_if_reached (CKR_GENERAL_ERROR);
@@ -831,7 +831,7 @@ gkm_user_storage_real_write_value (GkmStore *base, GkmTransaction *transaction,
 		}
 	}
 
-	res = gkm_data_file_write_value (self->file, identifier, attr->type, attr->pValue, attr->ulValueLen);
+	res = gkm_user_file_write_value (self->file, identifier, attr->type, attr->pValue, attr->ulValueLen);
 	switch (res) {
 	case GKM_DATA_FAILURE:
 		rv = CKR_FUNCTION_FAILED;
@@ -871,7 +871,7 @@ gkm_user_storage_constructor (GType type, guint n_props, GObjectConstructParam *
 static void
 gkm_user_storage_init (GkmUserStorage *self)
 {
-	self->file = gkm_data_file_new ();
+	self->file = gkm_user_file_new ();
 	g_signal_connect (self->file, "entry-added", G_CALLBACK (data_file_entry_added), self);
 	g_signal_connect (self->file, "entry-changed", G_CALLBACK (data_file_entry_changed), self);
 	g_signal_connect (self->file, "entry-removed", G_CALLBACK (data_file_entry_removed), self);
@@ -1081,7 +1081,7 @@ gkm_user_storage_create (GkmUserStorage *self, GkmTransaction *transaction, GkmO
 
 	/* Create an identifier guaranteed unique by this transaction */
 	identifier = identifier_for_object (object);
-	if (gkm_data_file_unique_entry (self->file, &identifier) != GKM_DATA_SUCCESS) {
+	if (gkm_user_file_unique_entry (self->file, &identifier) != GKM_DATA_SUCCESS) {
 		gkm_transaction_fail (transaction, CKR_FUNCTION_FAILED);
 		g_return_if_reached ();
 	}
@@ -1090,8 +1090,8 @@ gkm_user_storage_create (GkmUserStorage *self, GkmTransaction *transaction, GkmO
 	g_signal_handlers_block_by_func (self->file, data_file_entry_added, self);
 	g_signal_handlers_block_by_func (self->file, data_file_entry_changed, self);
 
-	res = gkm_data_file_create_entry (self->file, identifier,
-	                                  is_private ? GKM_DATA_FILE_SECTION_PRIVATE : GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (self->file, identifier,
+	                                  is_private ? GKM_USER_FILE_SECTION_PRIVATE : GKM_USER_FILE_SECTION_PUBLIC);
 
 	g_signal_handlers_unblock_by_func (self->file, data_file_entry_added, self);
 	g_signal_handlers_unblock_by_func (self->file, data_file_entry_changed, self);
@@ -1162,7 +1162,7 @@ gkm_user_storage_destroy (GkmUserStorage *self, GkmTransaction *transaction, Gkm
 		return;
 
 	/* Now delete the entry from our store */
-	res = gkm_data_file_destroy_entry (self->file, identifier);
+	res = gkm_user_file_destroy_entry (self->file, identifier);
 	switch(res) {
 	case GKM_DATA_FAILURE:
 	case GKM_DATA_UNRECOGNIZED:
@@ -1185,7 +1185,7 @@ void
 gkm_user_storage_relock (GkmUserStorage *self, GkmTransaction *transaction,
                          GkmSecret *old_login, GkmSecret *new_login)
 {
-	GkmDataFile *file;
+	GkmUserFile *file;
 	GkmDataResult res;
 	RelockArgs args;
 
@@ -1196,10 +1196,10 @@ gkm_user_storage_relock (GkmUserStorage *self, GkmTransaction *transaction,
 	if (!begin_write_state (self, transaction))
 		return;
 
-	file = gkm_data_file_new ();
+	file = gkm_user_file_new ();
 
 	/* Read in from the old file */
-	res = gkm_data_file_read_fd (file, self->read_fd, old_login);
+	res = gkm_user_file_read_fd (file, self->read_fd, old_login);
 	switch(res) {
 	case GKM_DATA_FAILURE:
 	case GKM_DATA_UNRECOGNIZED:
@@ -1215,7 +1215,7 @@ gkm_user_storage_relock (GkmUserStorage *self, GkmTransaction *transaction,
 	}
 
 	/* Write out to new path as new file */
-	res = gkm_data_file_write_fd (file, self->write_fd, new_login);
+	res = gkm_user_file_write_fd (file, self->write_fd, new_login);
 	switch(res) {
 	case GKM_DATA_FAILURE:
 	case GKM_DATA_UNRECOGNIZED:
@@ -1234,7 +1234,7 @@ gkm_user_storage_relock (GkmUserStorage *self, GkmTransaction *transaction,
 	args.transaction = transaction;
 	args.old_login = old_login;
 	args.new_login = new_login;
-	gkm_data_file_foreach_entry (file, relock_each_object, &args);
+	gkm_user_file_foreach_entry (file, relock_each_object, &args);
 
 	if (!gkm_transaction_get_failed (transaction) && self->login) {
 		if (new_login)
@@ -1351,7 +1351,7 @@ gkm_user_storage_token_flags (GkmUserStorage *self)
 	}
 
 	/* No private stuff in the file? */
-	if (gkm_data_file_have_section (self->file, GKM_DATA_FILE_SECTION_PRIVATE))
+	if (gkm_user_file_have_section (self->file, GKM_USER_FILE_SECTION_PRIVATE))
 		flags |= CKF_USER_PIN_INITIALIZED;
 
 	return flags;
diff --git a/pkcs11/user-store/tests/.gitignore b/pkcs11/user-store/tests/.gitignore
new file mode 100644
index 0000000..15db330
--- /dev/null
+++ b/pkcs11/user-store/tests/.gitignore
@@ -0,0 +1 @@
+/dump-data-file
diff --git a/pkcs11/user-store/tests/Makefile.am b/pkcs11/user-store/tests/Makefile.am
index ac1058a..1616ac3 100644
--- a/pkcs11/user-store/tests/Makefile.am
+++ b/pkcs11/user-store/tests/Makefile.am
@@ -1,8 +1,7 @@
 
 TESTING_FILES = \
-	test-module.c
-
-UNIT_PROMPT =
+	test-module.c \
+	unit-test-user-file.c
 
 TESTING_LIBS = \
 	$(top_builddir)/pkcs11/user-store/libgkm-user-store.la \
@@ -14,3 +13,17 @@ include $(top_srcdir)/testing/testing.make
 EXTRA_DIST = \
 	test-data \
 	p11-tests.conf
+
+# ---------------------------------------------------------------------
+
+noinst_PROGRAMS += \
+	dump-data-file
+
+dump_data_file_SOURCES = \
+	dump-data-file.c
+
+dump_data_file_LDADD = \
+	$(top_builddir)/pkcs11/gkm/libgkm.la \
+	$(top_builddir)/pkcs11/user-store/libgkm-user-store.la \
+	$(top_builddir)/egg/libegg.la \
+	$(DAEMON_LIBS)
diff --git a/pkcs11/gkm/tests/dump-data-file.c b/pkcs11/user-store/tests/dump-data-file.c
similarity index 92%
rename from pkcs11/gkm/tests/dump-data-file.c
rename to pkcs11/user-store/tests/dump-data-file.c
index aa2e763..60d668c 100644
--- a/pkcs11/gkm/tests/dump-data-file.c
+++ b/pkcs11/user-store/tests/dump-data-file.c
@@ -21,8 +21,9 @@
    Author: Stef Walter <stef memberwebs com>
 */
 
-#include "gkm-crypto.h"
-#include "gkm-data-file.h"
+#include "gkm-user-file.h"
+
+#include "gkm/gkm-crypto.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -54,7 +55,7 @@ main(int argc, char* argv[])
 {
 	const gchar *password;
 	GkmDataResult res;
-	GkmDataFile *file;
+	GkmUserFile *file;
 	GkmSecret *login;
 	int fd;
 
@@ -71,8 +72,8 @@ main(int argc, char* argv[])
 	password = getpass ("Password: ");
 	login = gkm_secret_new ((guchar*)password, strlen (password));
 
-	file = gkm_data_file_new ();
-	res = gkm_data_file_read_fd (file, fd, login);
+	file = gkm_user_file_new ();
+	res = gkm_user_file_read_fd (file, fd, login);
 	g_object_unref (login);
 
 	switch(res) {
@@ -88,7 +89,7 @@ main(int argc, char* argv[])
 		g_assert_not_reached ();
 	}
 
-	gkm_data_file_dump (file);
+	gkm_user_file_dump (file);
 	g_object_unref (file);
 
 	return 0;
diff --git a/pkcs11/gkm/tests/test-data/data-file-private.store b/pkcs11/user-store/tests/test-data/data-file-private.store
similarity index 100%
rename from pkcs11/gkm/tests/test-data/data-file-private.store
rename to pkcs11/user-store/tests/test-data/data-file-private.store
diff --git a/pkcs11/gkm/tests/test-data/data-file-public.store b/pkcs11/user-store/tests/test-data/data-file-public.store
similarity index 100%
rename from pkcs11/gkm/tests/test-data/data-file-public.store
rename to pkcs11/user-store/tests/test-data/data-file-public.store
diff --git a/pkcs11/gkm/tests/unit-test-data-file.c b/pkcs11/user-store/tests/unit-test-user-file.c
similarity index 64%
rename from pkcs11/gkm/tests/unit-test-data-file.c
rename to pkcs11/user-store/tests/unit-test-user-file.c
index d4dd10a..80e954d 100644
--- a/pkcs11/gkm/tests/unit-test-data-file.c
+++ b/pkcs11/user-store/tests/unit-test-user-file.c
@@ -23,15 +23,18 @@
 
 #include "test-suite.h"
 
-#include "gkm/gkm-data-file.h"
+#include "egg/egg-libgcrypt.h"
+
 #include "gkm/gkm-object.h"
 
+#include "gkm-user-file.h"
+
 #include <glib/gstdio.h>
 
 #include <fcntl.h>
 
 /* Both point to the same thing */
-static GkmDataFile *data_file = NULL;
+static GkmUserFile *data_file = NULL;
 static gchar *public_filename = NULL;
 static gchar *private_filename = NULL;
 static gchar *write_filename = NULL;
@@ -42,11 +45,13 @@ static GkmSecret *login = NULL;
 
 DEFINE_SETUP(file_store)
 {
+	egg_libgcrypt_initialize ();
+
 	public_filename = testing_data_filename ("data-file-public.store");
 	private_filename = testing_data_filename ("data-file-private.store");
 	write_filename = testing_scratch_filename ("unit-test-file.store");
 
-	data_file = gkm_data_file_new ();
+	data_file = gkm_user_file_new ();
 
 	public_fd = g_open (public_filename, O_RDONLY, 0);
 	g_assert (public_fd != -1);
@@ -84,11 +89,11 @@ DEFINE_TEST(test_file_create)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should be able to create private in a new file */
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -97,14 +102,14 @@ DEFINE_TEST(test_file_write_value)
 	GkmDataResult res;
 
 	/* Can't write when no identifier present */
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should be able to write now */
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -116,30 +121,30 @@ DEFINE_TEST(test_file_read_value)
 	guint number = 7778;
 
 	/* Write some stuff in */
-	res = gkm_data_file_create_entry (data_file, "ident", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "ident", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_write_value (data_file, "ident", CKA_LABEL, "TWO-label", 10);
+	res = gkm_user_file_write_value (data_file, "ident", CKA_LABEL, "TWO-label", 10);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_write_value (data_file, "ident", CKA_VALUE, &number, sizeof (number));
+	res = gkm_user_file_write_value (data_file, "ident", CKA_VALUE, &number, sizeof (number));
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Read for an invalid item */
-	res = gkm_data_file_read_value (data_file, "non-existant", CKA_LABEL, &value, &n_value);
+	res = gkm_user_file_read_value (data_file, "non-existant", CKA_LABEL, &value, &n_value);
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 
 	/* Read for an invalid attribute */
-	res = gkm_data_file_read_value (data_file, "ident", CKA_ID, &value, &n_value);
+	res = gkm_user_file_read_value (data_file, "ident", CKA_ID, &value, &n_value);
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 
 	/* Read out a valid number */
-	res = gkm_data_file_read_value (data_file, "ident", CKA_VALUE, &value, &n_value);
+	res = gkm_user_file_read_value (data_file, "ident", CKA_VALUE, &value, &n_value);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (value);
 	g_assert (n_value == sizeof (number));
 	g_assert_cmpuint (*((guint*)value), ==, number);
 
 	/* Read out the valid string */
-	res = gkm_data_file_read_value (data_file, "ident", CKA_LABEL, &value, &n_value);
+	res = gkm_user_file_read_value (data_file, "ident", CKA_LABEL, &value, &n_value);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (value);
 	g_assert (n_value == 10);
@@ -150,7 +155,7 @@ DEFINE_TEST(test_file_read)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -161,19 +166,19 @@ DEFINE_TEST(test_file_lookup)
 	gboolean ret;
 
 	/* Invalid shouldn't succeed */
-	ret = gkm_data_file_lookup_entry (data_file, "non-existant", &section);
+	ret = gkm_user_file_lookup_entry (data_file, "non-existant", &section);
 	g_assert (ret == FALSE);
 
 	/* Create a test item */
-	res = gkm_data_file_create_entry (data_file, "test-ident", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "test-ident", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	ret = gkm_data_file_lookup_entry (data_file, "test-ident", &section);
+	ret = gkm_user_file_lookup_entry (data_file, "test-ident", &section);
 	g_assert (ret == TRUE);
-	g_assert (section == GKM_DATA_FILE_SECTION_PUBLIC);
+	g_assert (section == GKM_USER_FILE_SECTION_PUBLIC);
 
 	/* Should be able to call without asking for section */
-	ret = gkm_data_file_lookup_entry (data_file, "test-ident", NULL);
+	ret = gkm_user_file_lookup_entry (data_file, "test-ident", NULL);
 	g_assert (ret == TRUE);
 }
 
@@ -185,32 +190,32 @@ DEFINE_TEST(file_read_private_without_login)
 	gsize n_value;
 	gboolean ret;
 
-	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, private_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Items from the private section should exist */
-	ret = gkm_data_file_lookup_entry (data_file, "identifier-private", &section);
+	ret = gkm_user_file_lookup_entry (data_file, "identifier-private", &section);
 	g_assert (ret);
-	g_assert (section == GKM_DATA_FILE_SECTION_PRIVATE);
+	g_assert (section == GKM_USER_FILE_SECTION_PRIVATE);
 
 	/* But we shouldn't be able to read values from those private items */
-	ret = gkm_data_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
+	ret = gkm_user_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
 	g_assert (ret == GKM_DATA_LOCKED);
 
 	/* Shouldn't be able to create private items */
-	res = gkm_data_file_create_entry (data_file, "dummy-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "dummy-private", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_LOCKED);
 
 	/* Shouldn't be able to write with another login */
-	res = gkm_data_file_write_fd (data_file, write_fd, login);
+	res = gkm_user_file_write_fd (data_file, write_fd, login);
 	g_assert (res == GKM_DATA_LOCKED);
 
 	/* Now load a public file without private bits*/
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Now we should be able to load private stuff */
-	res = gkm_data_file_create_entry (data_file, "dummy-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "dummy-private", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -218,16 +223,16 @@ DEFINE_TEST(test_file_write)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_create_entry (data_file, "identifier-two", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-two", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_write_fd (data_file, write_fd, NULL);
+	res = gkm_user_file_write_fd (data_file, write_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -235,10 +240,10 @@ DEFINE_TEST(cant_write_private_without_login)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_create_entry (data_file, "identifier_private", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "identifier_private", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_write_fd (data_file, write_fd, NULL);
+	res = gkm_user_file_write_fd (data_file, write_fd, NULL);
 	g_assert (res == GKM_DATA_LOCKED);
 }
 
@@ -247,25 +252,25 @@ DEFINE_TEST(write_private_with_login)
 	GkmDataResult res;
 	gulong value;
 
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "public-label", 12);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_create_entry (data_file, "identifier-two", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-two", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_write_value (data_file, "identifier-two", CKA_LABEL, "TWO-label", 9);
+	res = gkm_user_file_write_value (data_file, "identifier-two", CKA_LABEL, "TWO-label", 9);
 	g_assert (res == GKM_DATA_SUCCESS);
 	value = 555;
-	res = gkm_data_file_write_value (data_file, "identifier-two", CKA_VALUE, &value, sizeof (value));
+	res = gkm_user_file_write_value (data_file, "identifier-two", CKA_VALUE, &value, sizeof (value));
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_create_entry (data_file, "identifier-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "identifier-private", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_write_value (data_file, "identifier-private", CKA_LABEL, "private-label", 13);
+	res = gkm_user_file_write_value (data_file, "identifier-private", CKA_LABEL, "private-label", 13);
 	g_assert (res == GKM_DATA_SUCCESS);
 
-	res = gkm_data_file_write_fd (data_file, write_fd, login);
+	res = gkm_user_file_write_fd (data_file, write_fd, login);
 	g_assert (res == GKM_DATA_SUCCESS);
 }
 
@@ -275,11 +280,11 @@ DEFINE_TEST(read_private_with_login)
 	gconstpointer value;
 	gsize n_value;
 
-	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	res = gkm_user_file_read_fd (data_file, private_fd, login);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should be able to read private items */
-	res = gkm_data_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
+	res = gkm_user_file_read_value (data_file, "identifier-private", CKA_LABEL, &value, &n_value);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert_cmpuint (n_value, ==, 13);
 	g_assert (memcmp (value, "private-label", 13) == 0);
@@ -289,20 +294,20 @@ DEFINE_TEST(destroy_entry)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_destroy_entry (data_file, "non-existant");
+	res = gkm_user_file_destroy_entry (data_file, "non-existant");
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Make sure it's here */
-	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-public", NULL));
+	g_assert (gkm_user_file_lookup_entry (data_file, "identifier-public", NULL));
 
-	res = gkm_data_file_destroy_entry (data_file, "identifier-public");
+	res = gkm_user_file_destroy_entry (data_file, "identifier-public");
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Make sure it's gone */
-	g_assert (!gkm_data_file_lookup_entry (data_file, "identifier-public", NULL));
+	g_assert (!gkm_user_file_lookup_entry (data_file, "identifier-public", NULL));
 }
 
 DEFINE_TEST(destroy_entry_by_loading)
@@ -310,18 +315,18 @@ DEFINE_TEST(destroy_entry_by_loading)
 	GkmDataResult res;
 
 	/* Create some extra idenifiers */
-	res = gkm_data_file_create_entry (data_file, "my-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "my-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
-	res = gkm_data_file_create_entry (data_file, "my-private", GKM_DATA_FILE_SECTION_PRIVATE);
+	res = gkm_user_file_create_entry (data_file, "my-private", GKM_USER_FILE_SECTION_PRIVATE);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Now read from the file */
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Both should be gone */
-	g_assert (!gkm_data_file_lookup_entry (data_file, "my-public", NULL));
-	g_assert (!gkm_data_file_lookup_entry (data_file, "my-private", NULL));
+	g_assert (!gkm_user_file_lookup_entry (data_file, "my-public", NULL));
+	g_assert (!gkm_user_file_lookup_entry (data_file, "my-private", NULL));
 }
 
 
@@ -329,24 +334,24 @@ DEFINE_TEST(destroy_private_without_login)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, private_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Make sure it's here */
-	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-private", NULL));
+	g_assert (gkm_user_file_lookup_entry (data_file, "identifier-private", NULL));
 
 	/* Shouldn't be able to destroy */
-	res = gkm_data_file_destroy_entry (data_file, "identifier-private");
+	res = gkm_user_file_destroy_entry (data_file, "identifier-private");
 	g_assert (res == GKM_DATA_LOCKED);
 
 	/* Make sure it's still here */
-	g_assert (gkm_data_file_lookup_entry (data_file, "identifier-private", NULL));
+	g_assert (gkm_user_file_lookup_entry (data_file, "identifier-private", NULL));
 }
 
 static void
-entry_added_one (GkmDataFile *df, const gchar *identifier, gboolean *added)
+entry_added_one (GkmUserFile *df, const gchar *identifier, gboolean *added)
 {
-	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (GKM_IS_USER_FILE (df));
 	g_assert (df == data_file);
 	g_assert (identifier);
 	g_assert (added);
@@ -365,21 +370,21 @@ DEFINE_TEST(entry_added_signal)
 
 	/* Should fire the signal */
 	added = FALSE;
-	res = gkm_data_file_create_entry (data_file, "identifier-public", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "identifier-public", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (added == TRUE);
 
 	/* Another one should be added when we load */
 	added = FALSE;
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (added == TRUE);
 }
 
 static void
-entry_changed_one (GkmDataFile *df, const gchar *identifier, gulong type, gboolean *changed)
+entry_changed_one (GkmUserFile *df, const gchar *identifier, gulong type, gboolean *changed)
 {
-	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (GKM_IS_USER_FILE (df));
 	g_assert (df == data_file);
 	g_assert (identifier);
 	g_assert (changed);
@@ -399,40 +404,40 @@ DEFINE_TEST(entry_changed_signal)
 
 	/* Loading shouldn't fire the signal */
 	changed = FALSE;
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (changed == FALSE);
 
 	/* Shouldn't fire the signal on nonexistant */
 	changed = FALSE;
-	res = gkm_data_file_write_value (data_file, "non-existant", CKA_LABEL, "new-value", 10);
+	res = gkm_user_file_write_value (data_file, "non-existant", CKA_LABEL, "new-value", 10);
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 	g_assert (changed == FALSE);
 
 	/* Should fire the signal */
 	changed = FALSE;
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (changed == TRUE);
 
 	/* Shouldn't fire the signal, same value again */
 	changed = FALSE;
-	res = gkm_data_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
+	res = gkm_user_file_write_value (data_file, "identifier-public", CKA_LABEL, "new-value", 10);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (changed == FALSE);
 
 	/* Reload file, should revert, fire signal */
 	changed = FALSE;
 	g_assert (lseek (public_fd, 0, SEEK_SET) != -1);
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (changed == TRUE);
 }
 
 static void
-entry_removed_one (GkmDataFile *df, const gchar *identifier, gboolean *removed)
+entry_removed_one (GkmUserFile *df, const gchar *identifier, gboolean *removed)
 {
-	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (GKM_IS_USER_FILE (df));
 	g_assert (df == data_file);
 	g_assert (identifier);
 	g_assert (removed);
@@ -451,36 +456,36 @@ DEFINE_TEST(entry_removed_signal)
 
 	/* Loading shouldn't fire the signal */
 	removed = FALSE;
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (removed == FALSE);
 
 	/* Shouldn't fire the signal on removing nonexistant */
 	removed = FALSE;
-	res = gkm_data_file_destroy_entry (data_file, "non-existant");
+	res = gkm_user_file_destroy_entry (data_file, "non-existant");
 	g_assert (res == GKM_DATA_UNRECOGNIZED);
 	g_assert (removed == FALSE);
 
 	/* Remove a real entry */
 	removed = FALSE;
-	res = gkm_data_file_destroy_entry (data_file, "identifier-public");
+	res = gkm_user_file_destroy_entry (data_file, "identifier-public");
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (removed == TRUE);
 
 	/* Add a dummy entry */
-	res = gkm_data_file_create_entry (data_file, "extra-dummy", GKM_DATA_FILE_SECTION_PUBLIC);
+	res = gkm_user_file_create_entry (data_file, "extra-dummy", GKM_USER_FILE_SECTION_PUBLIC);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* That one should go away when we reload, fire signal */
 	removed = FALSE;
 	g_assert (lseek (public_fd, 0, SEEK_SET) != -1);
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (removed == TRUE);
 }
 
 static void
-foreach_entry (GkmDataFile *df, const gchar *identifier, gpointer data)
+foreach_entry (GkmUserFile *df, const gchar *identifier, gpointer data)
 {
 	GPtrArray *array = data;
 	const gchar *ident;
@@ -488,7 +493,7 @@ foreach_entry (GkmDataFile *df, const gchar *identifier, gpointer data)
 
 	g_assert (data);
 	g_assert (identifier);
-	g_assert (GKM_IS_DATA_FILE (df));
+	g_assert (GKM_IS_USER_FILE (df));
 
 	/* Check that this is unique */
 	for (i = 0; i < array->len; ++i) {
@@ -506,11 +511,11 @@ DEFINE_TEST(data_file_foreach)
 	GkmDataResult res;
 	GPtrArray *array;
 
-	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	res = gkm_user_file_read_fd (data_file, private_fd, login);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	array = g_ptr_array_new ();
-	gkm_data_file_foreach_entry (data_file, foreach_entry, array);
+	gkm_user_file_foreach_entry (data_file, foreach_entry, array);
 	g_assert (array->len == 4);
 
 	g_ptr_array_add (array, NULL);
@@ -522,26 +527,26 @@ DEFINE_TEST(unique_entry)
 	GkmDataResult res;
 	gchar *identifier;
 
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should change an identifier that conflicts */
 	identifier = g_strdup ("identifier-public");
-	res = gkm_data_file_unique_entry (data_file, &identifier);
+	res = gkm_user_file_unique_entry (data_file, &identifier);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert_cmpstr (identifier, !=, "identifier-public");
 	g_free (identifier);
 
 	/* Shouldn't change a unique identifier */
 	identifier = g_strdup ("identifier-unique");
-	res = gkm_data_file_unique_entry (data_file, &identifier);
+	res = gkm_user_file_unique_entry (data_file, &identifier);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert_cmpstr (identifier, ==, "identifier-unique");
 	g_free (identifier);
 
 	/* Should be able to get from NULL */
 	identifier = NULL;
-	res = gkm_data_file_unique_entry (data_file, &identifier);
+	res = gkm_user_file_unique_entry (data_file, &identifier);
 	g_assert (res == GKM_DATA_SUCCESS);
 	g_assert (identifier != NULL);
 	g_assert (identifier[0] != 0);
@@ -552,36 +557,36 @@ DEFINE_TEST(have_sections)
 {
 	GkmDataResult res;
 
-	res = gkm_data_file_read_fd (data_file, public_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, public_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* No private section */
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
-	g_assert (!gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PUBLIC));
+	g_assert (!gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PRIVATE));
 
 	/* Read private stuff into file, without login */
-	res = gkm_data_file_read_fd (data_file, private_fd, NULL);
+	res = gkm_user_file_read_fd (data_file, private_fd, NULL);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should have a private section even without login */
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PUBLIC));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PRIVATE));
 
 	/* Read private stuff into file, with login */
 	g_assert (lseek (private_fd, 0, SEEK_SET) == 0);
-	res = gkm_data_file_read_fd (data_file, private_fd, login);
+	res = gkm_user_file_read_fd (data_file, private_fd, login);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Should have a private section now with login */
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PUBLIC));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PRIVATE));
 
 	/* Read public stuff back into file*/
 	g_assert (lseek (public_fd, 0, SEEK_SET) == 0);
-	res = gkm_data_file_read_fd (data_file, public_fd, login);
+	res = gkm_user_file_read_fd (data_file, public_fd, login);
 	g_assert (res == GKM_DATA_SUCCESS);
 
 	/* Shouldn't have a private section now  */
-	g_assert (gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PUBLIC));
-	g_assert (!gkm_data_file_have_section (data_file, GKM_DATA_FILE_SECTION_PRIVATE));
+	g_assert (gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PUBLIC));
+	g_assert (!gkm_user_file_have_section (data_file, GKM_USER_FILE_SECTION_PRIVATE));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]