link_directories("${LIBS3_BUILD_DIR}/lib")
add_library(bluesky SHARED
- crypto.c dir.c file.c init.c inode.c serialize.c store.c s3store.c)
+ crypto.c dir.c file.c init.c inode.c serialize.c store.c s3store.c
+ util.c)
add_executable(bluesky-test main.c)
set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
void bluesky_init(void);
+gchar *bluesky_lowercase(const gchar *s);
+
/* Reference-counted blocks of memory, used for passing data in and out of
* storage backends and in other places. */
typedef struct {
if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
return;
- g_print("libgcrypt not yet initialized, initializing...\n");
-
if (!gcry_check_version(GCRYPT_VERSION))
g_error("libgcrypt version mismatch\n");
--- /dev/null
+/* Blue Sky: File Systems in the Cloud
+ *
+ * Copyright (C) 2009 The Regents of the University of California
+ * Written by Michael Vrable <mvrable@cs.ucsd.edu>
+ *
+ * TODO: Licensing
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <glib.h>
+#include <string.h>
+
+#include "bluesky.h"
+
+/* Miscellaneous useful functions that don't really fit anywhere else. */
+
+
+/* Convert a UTF-8 string to lowercase. This can be used to implement
+ * case-insensitive lookups and comparisons, by normalizing all values to
+ * lowercase first. Returns a newly-allocated string as a result. */
+gchar *bluesky_lowercase(const gchar *s)
+{
+ /* TODO: Unicode handling; for now just do ASCII. */
+ return g_ascii_strdown(s, -1);
+}
* UTF-8, that it not be empty, and that it not contain embedded forward
* slashes. Also checks that the length of the string is not more than the
* maximum allowed length. This function does allow the names "." and "..".
- * Returns TRUE if te string is allowed as a filename. */
+ * Returns TRUE if the string is allowed as a filename. */
gboolean validate_filename(const char *filename)
{
if (filename == NULL || filename[0] == '\0')
#include <netinet/in.h>
#include <glib.h>
-#include "libs3.h"
#include "bluesky.h"
void register_rpc();