From: Michal Vaner Date: Sun, 30 Nov 2008 16:00:29 +0000 (+0100) Subject: Better names for direct IO switches X-Git-Tag: holmes-import~128 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=44697ea9c408bbbd5b359e716c6dc8283b471423;p=libucw.git Better names for direct IO switches CONFIG_DIRECT_IO to allow/disallow use of direct IO. Auto-disabled on darwin. CONFIG_UCW_FB_DIRECT to include/exclude fb-direct. Available only with CONFIG_DIRECT_IO and CONFIG_UCW_THREADS. --- diff --git a/ucw/Makefile b/ucw/Makefile index 954cfec3..55b274a4 100644 --- a/ucw/Makefile +++ b/ucw/Makefile @@ -64,7 +64,7 @@ LIBUCW_MODS+=threads-conf workqueue asio LIBUCW_MAIN_INCLUDES+=workqueue.h semaphore.h asio.h endif -ifdef CONFIG_DIRECT +ifdef CONFIG_UCW_FB_DIRECT LIBUCW_MODS+=fb-direct endif diff --git a/ucw/default.cfg b/ucw/default.cfg index 58b14592..9ce2ae4f 100644 --- a/ucw/default.cfg +++ b/ucw/default.cfg @@ -51,7 +51,8 @@ UnSet("ENV_VAR_CONFIG"); UnSet("CONFIG_URL_ESCAPE_COMPAT"); # Allow use of direct IO on files -Set("CONFIG_DIRECT"); +Set("CONFIG_DIRECT_IO"); +Set("CONFIG_UCW_FB_DIRECT"); # Return success 1; diff --git a/ucw/fastbuf.h b/ucw/fastbuf.h index 325b35fd..2c1c1a10 100644 --- a/ucw/fastbuf.h +++ b/ucw/fastbuf.h @@ -279,7 +279,7 @@ void bfix_tmp_file(struct fastbuf *fb, const char *name); struct fastbuf *bfdopen_internal(int fd, const char *name, uns buflen); struct fastbuf *bfmmopen_internal(int fd, const char *name, uns mode); -#ifdef CONFIG_DIRECT +#ifdef CONFIG_UCW_FB_DIRECT extern uns fbdir_cheat; struct asio_queue; struct fastbuf *fbdir_open_fd_internal(int fd, const char *name, struct asio_queue *io_queue, uns buffer_size, uns read_ahead, uns write_back); diff --git a/ucw/fb-param.c b/ucw/fb-param.c index 514f987b..0d9d6904 100644 --- a/ucw/fb-param.c +++ b/ucw/fb-param.c @@ -29,7 +29,7 @@ fbpar_cf_commit(struct fb_params *p UNUSED) if (p->type == FB_DIRECT) return "Direct I/O is supported only with CONFIG_UCW_THREADS"; #endif -#ifndef CONFIG_DIRECT +#ifndef CONFIG_UCW_FB_DIRECT if (p->type == FB_DIRECT) return "Direct I/O is disabled"; #endif @@ -76,7 +76,7 @@ bopen_fd_internal(int fd, struct fb_params *params, uns mode, const char *name) struct fastbuf *fb; switch (params->type) { -#ifdef CONFIG_DIRECT +#ifdef CONFIG_UCW_FB_DIRECT case FB_DIRECT: fb = fbdir_open_fd_internal(fd, name, params->asio, params->buffer_size ? : fbpar_def.buffer_size, @@ -106,7 +106,7 @@ bopen_file_internal(const char *name, int mode, struct fb_params *params, int tr { if (!params) params = &fbpar_def; -#ifdef CONFIG_DIRECT +#ifdef CONFIG_UCW_FB_DIRECT if (params->type == FB_DIRECT && !fbdir_cheat) mode |= O_DIRECT; #endif diff --git a/ucw/perl/UCW/Configure/C.pm b/ucw/perl/UCW/Configure/C.pm index 6219a164..3e65c1f2 100644 --- a/ucw/perl/UCW/Configure/C.pm +++ b/ucw/perl/UCW/Configure/C.pm @@ -256,10 +256,10 @@ if (IsSet("CONFIG_DARWIN")) { Append("COPT" => "-I/sw/include"); # Fill in some constants not found in the system header files Set("SOL_TCP" => 6); # missing in /usr/include/netinet/tcp.h - if (IsGiven("CONFIG_DIRECT") && IsSet("CONFIG_DIRECT")) { + if (IsGiven("CONFIG_DIRECT_IO") && IsSet("CONFIG_DIRECT_IO")) { Fail("Direct I/O is not available on darwin"); } else { - UnSet("CONFIG_DIRECT"); + UnSet("CONFIG_DIRECT_IO"); } } diff --git a/ucw/perl/UCW/Configure/LibUCW.pm b/ucw/perl/UCW/Configure/LibUCW.pm index 19fcb038..194742cd 100644 --- a/ucw/perl/UCW/Configure/LibUCW.pm +++ b/ucw/perl/UCW/Configure/LibUCW.pm @@ -43,19 +43,6 @@ if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) { Set("CONFIG_UCW_RADIX_SORTER_BITS" => 12); } -# fb_direct needs threads -if (!IsSet("CONFIG_UCW_THREADS")) { - if (IsGiven("CONFIG_DIRECT") && IsSet("CONFIG_DIRECT")) { - if (!IsGiven("CONFIG_UCW_THREADS")) { - Set("CONFIG_UCW_THREADS"); - } else { - Fail("CONFIG_DIRECT needs CONFIG_UCW_THREADS"); - } - } else { - UnSet("CONFIG_DIRECT"); - } -} - PostConfig { AtWrite { UCW::Configure::C::ConfigHeader("ucw/autoconf.h", [ @@ -69,6 +56,20 @@ PostConfig { ]); } if Get("CONFIG_INSTALL_API"); + + # Include direct FB? + if (IsGiven("CONFIG_UCW_FB_DIRECT") && IsSet("CONFIG_UCW_FB_DIRECT")) { + } + if (!IsSet("CONFIG_UCW_THREADS") || !IsSet("CONFIG_DIRECT_IO")) { + if (IsGiven("CONFIG_UCW_FB_DIRECT") && IsSet("CONFIG_UCW_FB_DIRECT")) { + if (!IsSet("CONFIG_UCW_THREADS")) { + Fail("CONFIG_UCW_FB_DIRECT needs CONFIG_UCW_THREADS"); + } else { + Fail("CONFIG_UCW_FB_DIRECT needs CONFIG_DIRECT_IO"); + } + } + UnSet("CONFIG_UCW_FB_DIRECT"); + } }; # We succeeded