Displaying 4 results from an estimated 4 matches for "guestfs_internal_feature_avail".
2015 Nov 04
2
[PATCH] tests/c-api: cache available features
Build a list of all the features used in action tests, and lazily read
them as needed. This reduces the number of guestfs_feature_available
calls for a full run from 117 to 18.
---
generator/tests_c_api.ml | 77 +++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 73 insertions(+), 4 deletions(-)
diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
index 6be753f..8c4e5ef
2015 Nov 05
0
[PATCH 2/2] actions: refactor available & feature_available
...ed_feature *
+find_or_cache_feature (guestfs_h *g, const char *group)
+{
+ struct cached_feature *f;
+ size_t i;
+ int res;
+
+ for (i = 0; i < g->nr_features; ++i) {
+ f = &g->features[i];
+
+ if (STRNEQ (f->group, group))
+ continue;
+
+ return f;
+ }
+
+ res = guestfs_internal_feature_available (g, group);
+ if (res < 0)
+ return 0; /* internal_feature_available sent an error. */
+
+ g->features = safe_realloc (g, g->features,
+ (g->nr_features+1) * sizeof (struct cached_feature));
+ f = &g->features[g->nr_features];
+ ++g->...
2015 Nov 05
4
[PATCH 1/2] actions: turn available & feature_available as non-daemon
...h>
+
+#include "guestfs.h"
+#include "guestfs-internal-actions.h"
+
+int
+guestfs_impl_available (guestfs_h *g, char *const *groups)
+{
+ return guestfs_internal_available (g, groups);
+}
+
+int
+guestfs_impl_feature_available (guestfs_h *g, char *const *groups)
+{
+ return guestfs_internal_feature_available (g, groups);
+}
--
2.1.0
2015 Nov 04
0
Re: [PATCH] tests/c-api: cache available features
...te:
> Build a list of all the features used in action tests, and lazily read
> them as needed. This reduces the number of guestfs_feature_available
> calls for a full run from 117 to 18.
ACK.
But even better if you turned guestfs_feature_available into a
non_daemon_function, added a new guestfs_internal_feature_available
daemon_function, and then cached the results on the library side.
They can never change for the duration of a libguestfs library load,
as far as I know.
That would benefit all libguestfs users.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my pr...