implement Location VFS directive

Sun, 23 Nov 2025 15:05:37 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 23 Nov 2025 15:05:37 +0100
changeset 641
159172937c86
parent 640
a95045234b9b
child 642
7b71e2973acc

implement Location VFS directive

src/server/daemon/location.c file | annotate | diff | comparison | revisions
src/server/safs/nametrans.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/location.c	Sun Nov 23 14:59:52 2025 +0100
+++ b/src/server/daemon/location.c	Sun Nov 23 15:05:37 2025 +0100
@@ -71,6 +71,13 @@
                 return 1;
             }
         }
+    } else if(!cx_strcasecmp(name, "VFS")) {
+        DIR_CHECK_ARGC(1);
+        location->config.vfs = cx_strdup_a(a, dir->args->value);
+        VfsType *vfs = vfs_get_type(cx_strcast(location->config.vfs));
+        if(!vfs) {
+            log_ereport(LOG_MISCONFIG, "unknown VFS type %s", location->config.vfs.ptr);
+        }
     } else if(!cx_strcasecmp(name, "Location")) {
         WSLocation *sub_location = cfg_location_get(cfg, dir);
         if(!sub_location) {
--- a/src/server/safs/nametrans.c	Sun Nov 23 14:59:52 2025 +0100
+++ b/src/server/safs/nametrans.c	Sun Nov 23 15:05:37 2025 +0100
@@ -289,6 +289,14 @@
     }
     req->location = config;
     
+    if(config->vfs.ptr) {
+        VFS *vfs = vfs_create(sn, rq, config->vfs.ptr, pb, NULL);
+        if(!vfs) {
+            return REQ_ABORTED;
+        }
+        rq->vfs = vfs;
+    }
+    
     return REQ_NOACTION;
 }
 

mercurial