From 0e6176bc8246735681e2289b92c15639b9201bc9 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Sun, 30 Nov 2008 12:30:08 +0100 Subject: [PATCH] Added switch CONFIG_DIRECT Turns on and off if fb-direct is compiled. --- ucw/Makefile | 6 +++++- ucw/default.cfg | 3 +++ ucw/fb-param.c | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ucw/Makefile b/ucw/Makefile index 41ca1c3f..954cfec3 100644 --- a/ucw/Makefile +++ b/ucw/Makefile @@ -60,10 +60,14 @@ LIBUCW_MAIN_INCLUDES= \ ifdef CONFIG_UCW_THREADS # Some modules require threading -LIBUCW_MODS+=threads-conf workqueue asio fb-direct +LIBUCW_MODS+=threads-conf workqueue asio LIBUCW_MAIN_INCLUDES+=workqueue.h semaphore.h asio.h endif +ifdef CONFIG_DIRECT +LIBUCW_MODS+=fb-direct +endif + ifdef CONFIG_OWN_GETOPT include $(s)/ucw/getopt/Makefile endif diff --git a/ucw/default.cfg b/ucw/default.cfg index f042800f..58b14592 100644 --- a/ucw/default.cfg +++ b/ucw/default.cfg @@ -50,5 +50,8 @@ UnSet("ENV_VAR_CONFIG"); # Use obsolete URL escaping rules (if you need behavior identical to the older versions of libucw) UnSet("CONFIG_URL_ESCAPE_COMPAT"); +# Allow use of direct IO on files +Set("CONFIG_DIRECT"); + # Return success 1; diff --git a/ucw/fb-param.c b/ucw/fb-param.c index dafd23ed..514f987b 100644 --- a/ucw/fb-param.c +++ b/ucw/fb-param.c @@ -28,6 +28,10 @@ fbpar_cf_commit(struct fb_params *p UNUSED) #ifndef CONFIG_UCW_THREADS if (p->type == FB_DIRECT) return "Direct I/O is supported only with CONFIG_UCW_THREADS"; +#endif +#ifndef CONFIG_DIRECT + if (p->type == FB_DIRECT) + return "Direct I/O is disabled"; #endif return NULL; } @@ -72,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_UCW_THREADS +#ifdef CONFIG_DIRECT case FB_DIRECT: fb = fbdir_open_fd_internal(fd, name, params->asio, params->buffer_size ? : fbpar_def.buffer_size, @@ -102,7 +106,7 @@ bopen_file_internal(const char *name, int mode, struct fb_params *params, int tr { if (!params) params = &fbpar_def; -#ifdef CONFIG_UCW_THREADS +#ifdef CONFIG_DIRECT if (params->type == FB_DIRECT && !fbdir_cheat) mode |= O_DIRECT; #endif -- 2.39.2