From: Michael Vrable Date: Wed, 23 Sep 2009 00:29:09 +0000 (-0700) Subject: Miscellaneous fixes. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=03476a3d39444ff2a09174e945ab645508c2224c;p=bluesky.git Miscellaneous fixes. --- diff --git a/bluesky/CMakeLists.txt b/bluesky/CMakeLists.txt index ad9eff5..aa5b5c5 100644 --- a/bluesky/CMakeLists.txt +++ b/bluesky/CMakeLists.txt @@ -2,7 +2,8 @@ include_directories("${LIBS3_BUILD_DIR}/include") 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}") diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 09d2755..7419cd4 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -18,6 +18,8 @@ extern "C" { 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 { diff --git a/bluesky/crypto.c b/bluesky/crypto.c index df0af66..fff4e0d 100644 --- a/bluesky/crypto.c +++ b/bluesky/crypto.c @@ -30,8 +30,6 @@ void bluesky_crypt_init() 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"); diff --git a/bluesky/util.c b/bluesky/util.c new file mode 100644 index 0000000..85f6a70 --- /dev/null +++ b/bluesky/util.c @@ -0,0 +1,26 @@ +/* Blue Sky: File Systems in the Cloud + * + * Copyright (C) 2009 The Regents of the University of California + * Written by Michael Vrable + * + * TODO: Licensing + */ + +#include +#include +#include +#include + +#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); +} diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index aabac28..004aed8 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -16,7 +16,7 @@ static void *null_result = (void *)&null_int; * 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') diff --git a/nfs3/nfsd.c b/nfs3/nfsd.c index e3862aa..323c1b1 100644 --- a/nfs3/nfsd.c +++ b/nfs3/nfsd.c @@ -19,7 +19,6 @@ #include #include -#include "libs3.h" #include "bluesky.h" void register_rpc();