src/server/daemon/vfs.c

changeset 415
d938228c382e
parent 366
47bc686fafe4
child 450
d7b276de183b
--- a/src/server/daemon/vfs.c	Wed Nov 02 19:19:01 2022 +0100
+++ b/src/server/daemon/vfs.c	Sun Nov 06 15:53:32 2022 +0100
@@ -33,7 +33,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <aio.h>
-#include <ucx/map.h>
+#include <cx/hash_map.h>
 
 #include "../util/pool.h"
 #include "netsite.h"
@@ -45,7 +45,7 @@
 #define VFS_MALLOC(pool, size) pool ? pool_malloc(pool, size) : malloc(size)
 #define VFS_FREE(pool, ptr) pool ? pool_free(pool, ptr) : free(ptr)
 
-static UcxMap *vfs_type_map;
+static CxMap *vfs_type_map;
 
 static VFS sys_vfs = {
     sys_vfs_open,
@@ -80,7 +80,7 @@
 };
 
 int vfs_init(void) {
-    vfs_type_map = ucx_map_new(16);
+    vfs_type_map = cxHashMapCreate(cxDefaultAllocator, 16);
     if(!vfs_type_map) {
         return -1;
     }
@@ -103,11 +103,11 @@
     vfsType->init = vfsInit;
     vfsType->create = vfsCreate;
     
-    return ucx_map_cstr_put(vfs_type_map, name, vfsType);
+    return cxMapPut(vfs_type_map, cx_hash_key_str(name), vfsType);
 }
 
-VfsType* vfs_get_type(scstr_t vfs_class) {
-    return ucx_map_sstr_get(vfs_type_map, vfs_class);
+VfsType* vfs_get_type(cxstring vfs_class) {
+    return cxMapGet(vfs_type_map, cx_hash_key_bytes((const unsigned char*)vfs_class.ptr, vfs_class.length));
 }
 
 void* vfs_init_backend(ServerConfiguration *cfg, pool_handle_t *pool, VfsType *vfs_class, WSConfigNode *config, int *error) {
@@ -124,7 +124,7 @@
 }
 
 VFS* vfs_create(Session *sn, Request *rq, const char *vfs_class, pblock *pb, void *initData) {
-    VfsType *vfsType = ucx_map_cstr_get(vfs_type_map, vfs_class);
+    VfsType *vfsType = cxMapGet(vfs_type_map, cx_hash_key_str(vfs_class));
     if(!vfsType) {
         log_ereport(LOG_MISCONFIG, "vfs_create: unkown VFS type %s", vfs_class);
         return NULL;

mercurial