[Libguestfs] [nbdkit PATCH 1/4] filters: Drop useless .open callbacks

Richard W.M. Jones rjones at redhat.com
Mon Apr 29 12:23:41 UTC 2019


On Sat, Apr 27, 2019 at 04:26:43PM -0500, Eric Blake wrote:
> 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.

Yes these are both bogus and removing them is correct, ACK.

Rich.

> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  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 b3fef42..19ce555 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 add7566..8932292 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.20.1
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list