From fbd1058761b4dca7c2aa5e067886200e7500dfd5 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 27 Apr 2019 15:43:28 -0500 Subject: [PATCH] filters: Drop useless .open callbacks The cache filter .open has never done any useful work; since its introduction in c10d126f, it appears to exist purely as copy-and-paste from the cow filter (differing only in whether the readonly parameter is massaged before passing on to next). The error filter .open used to track a per-connection handle, but for testing purposes, it was changed to use only global state in commit b33ccbb8. Drop these two .open callbacks in favor of using nbdkit's default behavior, with no semantic change. All other filters with an .open callback either massage parameters passed to next, create a per-connection handle, or both. Signed-off-by: Eric Blake --- filters/cache/cache.c | 10 ---------- filters/error/error.c | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/filters/cache/cache.c b/filters/cache/cache.c index b3fef42d..19ce5553 100644 --- a/filters/cache/cache.c +++ b/filters/cache/cache.c @@ -186,15 +186,6 @@ cache_config_complete (nbdkit_next_config_complete *next, void *nxdata) return next (nxdata); } -static void * -cache_open (nbdkit_next_open *next, void *nxdata, int readonly) -{ - if (next (nxdata, readonly) == -1) - return NULL; - - return NBDKIT_HANDLE_NOT_NEEDED; -} - /* Get the file size and ensure the cache is the correct size. */ static int64_t cache_get_size (struct nbdkit_next_ops *next_ops, void *nxdata, @@ -476,7 +467,6 @@ static struct nbdkit_filter filter = { .unload = cache_unload, .config = cache_config, .config_complete = cache_config_complete, - .open = cache_open, .prepare = cache_prepare, .get_size = cache_get_size, .pread = cache_pread, diff --git a/filters/error/error.c b/filters/error/error.c index add7566e..89322920 100644 --- a/filters/error/error.c +++ b/filters/error/error.c @@ -252,15 +252,6 @@ error_config (nbdkit_next_config *next, void *nxdata, "error-pread*, error-pwrite*, error-trim*, error-zero*, error-extents*\n" \ " Apply settings only to read/write/etc" -static void * -error_open (nbdkit_next_open *next, void *nxdata, int readonly) -{ - if (next (nxdata, readonly) == -1) - return NULL; - - return NBDKIT_HANDLE_NOT_NEEDED; -} - /* This function injects a random error. */ static bool random_error (const struct error_settings *error_settings, @@ -366,7 +357,6 @@ static struct nbdkit_filter filter = { .unload = error_unload, .config = error_config, .config_help = error_config_help, - .open = error_open, .pread = error_pread, .pwrite = error_pwrite, .trim = error_trim, -- 2.11.4.GIT