diff src/os/win32/ngx_files.c @ 2615:ceef364208c8

ngx_fs_bsize()
author Igor Sysoev <igor@sysoev.ru>
date Mon, 30 Mar 2009 07:43:06 +0000
parents 90d5ddfedbb1
children 64a10d6b97bd
line wrap: on
line diff
--- a/src/os/win32/ngx_files.c
+++ b/src/os/win32/ngx_files.c
@@ -504,8 +504,28 @@ ngx_directio_on(ngx_fd_t fd)
     return 0;
 }
 
+
 ngx_int_t
 ngx_directio_off(ngx_fd_t fd)
 {
     return 0;
 }
+
+
+size_t
+ngx_fs_bsize(u_char *name)
+{
+    u_char  root[4];
+    u_long  sc, bs, nfree, ncl;
+
+    if (name[2] == ':') {
+        ngx_cpystrn(root, name, 4);
+        name = root;
+    }
+
+    if (GetDiskFreeSpace((const char *) name, &sc, &bs, &nfree, &ncl) == 0) {
+        return 512;
+    }
+
+    return sc * bs;
+}