search for: have_attribute_cleanup

Displaying 20 results from an estimated 67 matches for "have_attribute_cleanup".

2013 Jan 24
2
[PATCH 1/2] lib: Add CLEANUP_FREE macro which automatically calls 'free' when leaving scope.
...t;stdio.h> +#include <stdlib.h> + +void +freep (void *ptr) +{ + exit (0); +} + +void +test (void) +{ + __attribute__((cleanup(freep))) char *ptr = malloc (100); +} + +int +main (int argc, char *argv[]) +{ + test (); + exit (1); +} +]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_ATTRIBUTE_CLEANUP],[1],[Define to 1 if '__attribute__((cleanup(...)))' works with this compiler.]) + ],[ + AC_MSG_RESULT([no]) + ]) + dnl Check if dirent (readdir) supports d_type member. AC_STRUCT_DIRENT_D_TYPE diff --git a/src/alloc.c b/src/alloc.c index 25d7f42..cf3741a 100644 --- a/src/alloc...
2017 Mar 10
2
[PATCH 1/2] daemon: generate cleanup handlers for structs
...+ generate_header CStyle GPLv2plus; + + pr "\ +/* These CLEANUP_* macros automatically free the struct or struct list + * pointed to by the local variable at the end of the current scope. + */ + +#ifndef GUESTFS_DAEMON_STRUCTS_CLEANUPS_H_ +#define GUESTFS_DAEMON_STRUCTS_CLEANUPS_H_ + +#ifdef HAVE_ATTRIBUTE_CLEANUP +"; + + List.iter ( + fun { s_name = name } -> + pr "#define CLEANUP_FREE_%s \\\n" (String.uppercase_ascii name); + pr " __attribute__((cleanup(cleanup_free_int_%s)))\n" name; + pr "#define CLEANUP_FREE_%s_LIST \\\n" (String.uppercase_ascii...
2017 Nov 23
1
Re: [PATCH 1/1] Switch from YAJL to Jansson
...@ -38,53 +38,46 @@ > #include <sys/resource.h> > #endif > >-#include <yajl/yajl_tree.h> >+#include <jansson.h> > > #include "guestfs.h" > #include "guestfs-internal.h" > #include "guestfs-internal-actions.h" > > #ifdef HAVE_ATTRIBUTE_CLEANUP >-#define CLEANUP_YAJL_TREE_FREE __attribute__((cleanup(cleanup_yajl_tree_free))) >+#define CLEANUP_JSON_T_DECREF __attribute__((cleanup(cleanup_json_t_decref))) > > static void >-cleanup_yajl_tree_free (void *ptr) >+cleanup_json_t_decref (void *ptr) > { >- yajl_tree_free (...
2014 Oct 31
1
[PATCH] launch: libvirt: Implement drive secrets (RHBZ#1159016).
...++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 3 deletions(-) diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index 7206b33..45e215c 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -97,6 +97,25 @@ xmlBufferDetach (xmlBufferPtr buf) } #endif +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_VIRSECRETFREE __attribute__((cleanup(cleanup_virSecretFree))) + +static void +cleanup_virSecretFree (void *ptr) +{ + virSecretFree (* (virSecretPtr *) ptr); +} + +#else /* !HAVE_ATTRIBUTE_CLEANUP */ +#define CLEANUP_VIRSECRETFREE +#endif + +/* Use to store a mapping of secret to l...
2014 Oct 31
1
[PATCH v2] launch: libvirt: Implement drive secrets (RHBZ#1159016).
Since v1: - Base64 decode the Ceph secret before passing it to libvirt. - Don't call virSecretFree (NULL) [libvirt bug?] - Small cleanups.
2017 Apr 24
0
[PATCH v8 4/8] New API: yara_load
...rpc/xdr.h> +#include <rpc/types.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include "daemon.h" +#include "actions.h" +#include "optgroups.h" +#include "guestfs_protocol.h" + +#ifdef HAVE_YARA + +#include <yara.h> + +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_DESTROY_YARA_COMPILER \ + __attribute__((cleanup(cleanup_destroy_yara_compiler))) +#else +#define CLEANUP_DESTROY_YARA_COMPILER +#endif + +struct write_callback_data { + int fd; + uint64_t written; +}; + +/* Yara compiled rules. */ +static YR_RULES *rul...
2014 Sep 04
10
[PATCH 0/5] use augeas for /etc/shadow
Hi, currently /etc/shadow is edited manually when needed (i.e. when setting the password for an user), and it is not changed when removing users. Import the upstream shadow.aug (currently in their development serie, but not part of any released version yet), and use it only when the augeas version is less than a potential 1.2.1 (covering also the case when the new version is just 1.3.0). Pino
2017 Apr 20
6
[PATCH 0/5] generator: daemon: Various simplifications to stubs code.
This is a series of simplifications to the stubs code. It's all refactoring, there is no functional change. Rich.
2017 Feb 27
1
[PATCH] lib: Require libmagic.
...lude <sys/wait.h> #include <libintl.h> -#ifdef HAVE_LIBMAGIC #include <magic.h> -#endif #include "ignore-value.h" @@ -37,8 +35,6 @@ #include "guestfs-internal.h" #include "guestfs-internal-actions.h" -#if defined(HAVE_LIBMAGIC) - # ifdef HAVE_ATTRIBUTE_CLEANUP # define CLEANUP_MAGIC_T_FREE __attribute__((cleanup(cleanup_magic_t_free))) @@ -364,19 +360,3 @@ guestfs_impl_file_architecture (guestfs_h *g, const char *path) return ret; /* caller frees */ } - -#else /* no libmagic at compile time */ - -/* XXX Should be an optgroup. *...
2016 Jan 09
0
[PATCH] build: Require qemu >= 1.3.0 and yajl.
...tions.h" -static int which_parser (guestfs_h *g); -static char *get_disk_format (guestfs_h *g, const char *filename); -static int64_t get_disk_virtual_size (guestfs_h *g, const char *filename); -static int get_disk_has_backing_file (guestfs_h *g, const char *filename); -#if HAVE_YAJL +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_YAJL_TREE_FREE __attribute__((cleanup(cleanup_yajl_tree_free))) + +static void +cleanup_yajl_tree_free (void *ptr) +{ + yajl_tree_free (* (yajl_val *) ptr); +} + +#else +#define CLEANUP_YAJL_TREE_FREE +#endif + static yajl_val get_json_output (guestfs_h *g, const char *filename);...
2014 Aug 26
6
[PATCH 0/3] fix setting lvm filter with newer lvm2
Hi, newer lvm2 releases don't have have uncommented "filter" lines, so the current way to edit lvm.conf doesn't work anymore. Instead, switch to augeas (with a "custom" len) for a cleaner and working way to set the lvm filter. Pino Toscano (3): daemon: add add_sprintf daemon: move AUGEAS_ERROR to the common header daemon: lvm-filter: use augeas for setting the
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...free (void *ptr); -extern void cleanup_free_string_list (void *ptr); -extern void cleanup_unlink_free (void *ptr); -extern void cleanup_close (void *ptr); -extern void cleanup_fclose (void *ptr); -extern void cleanup_aug_close (void *ptr); -extern void cleanup_free_stringsbuf (void *ptr); - -#ifdef HAVE_ATTRIBUTE_CLEANUP -#define CLEANUP_FREE __attribute__((cleanup(cleanup_free))) -#define CLEANUP_FREE_STRING_LIST \ - __attribute__((cleanup(cleanup_free_string_list))) -#define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) -#define CLEANUP_CLOSE __attribute__((cleanup(cl...
2016 Jan 21
0
[PATCH v3 1/6] daemon: Rename daemon/command.c -> daemon/sh.c.
...pes.h> -#include <fcntl.h> - -#include "guestfs_protocol.h" -#include "daemon.h" -#include "actions.h" - -#include "ignore-value.h" - -GUESTFSD_EXT_CMD(str_cp, cp); -GUESTFSD_EXT_CMD(str_mount, mount); -GUESTFSD_EXT_CMD(str_umount, umount); - -#ifdef HAVE_ATTRIBUTE_CLEANUP -#define CLEANUP_BIND_STATE __attribute__((cleanup(free_bind_state))) -#define CLEANUP_RESOLVER_STATE __attribute__((cleanup(free_resolver_state))) -#else -#define CLEANUP_BIND_STATE -#define CLEANUP_RESOLVER_STATE -#endif - -struct bind_state { - bool mounted; - char *sysroot_dev; - char *sysro...
2020 Jan 09
0
[PATCH v2 4/4] daemon: drop usage of C augeas library
...daemon.h @@ -100,14 +100,11 @@ extern void cleanup_free_mountable (mountable_t *mountable); /* These functions are used internally by the CLEANUP_* macros. * Don't call them directly. */ -extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); #ifdef HAVE_ATTRIBUTE_CLEANUP -#define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close))) #define CLEANUP_FREE_STRINGSBUF __attribute__((cleanup(cleanup_free_stringsbuf))) #else -#define CLEANUP_AUG_CLOSE #define CLEANUP_FREE_STRINGSBUF #endif @@ -253,20 +250,6 @@ extern int lv_canonical (const char *device, ch...
2020 Mar 09
0
[PATCH v3 3/3] daemon: drop usage of C augeas library
...daemon.h @@ -100,14 +100,11 @@ extern void cleanup_free_mountable (mountable_t *mountable); /* These functions are used internally by the CLEANUP_* macros. * Don't call them directly. */ -extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); #ifdef HAVE_ATTRIBUTE_CLEANUP -#define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close))) #define CLEANUP_FREE_STRINGSBUF __attribute__((cleanup(cleanup_free_stringsbuf))) #else -#define CLEANUP_AUG_CLOSE #define CLEANUP_FREE_STRINGSBUF #endif @@ -254,20 +251,6 @@ extern int lv_canonical (const char *device, ch...
2017 Apr 25
1
Re: [PATCH v8 4/8] New API: yara_load
...s/types.h> > +#include <sys/stat.h> > + > +#include "daemon.h" > +#include "actions.h" > +#include "optgroups.h" > +#include "guestfs_protocol.h" > + > +#ifdef HAVE_YARA > + > +#include <yara.h> > + > +#ifdef HAVE_ATTRIBUTE_CLEANUP > +#define CLEANUP_DESTROY_YARA_COMPILER \ > + __attribute__((cleanup(cleanup_destroy_yara_compiler))) > +#else > +#define CLEANUP_DESTROY_YARA_COMPILER > +#endif > + > +struct write_callback_data { > + int fd; > + uint64_t written; > +}; &...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...e (void *ptr); extern void cleanup_close (void *ptr); +extern void cleanup_fclose (void *ptr); extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); +#ifdef HAVE_YARA +extern void cleanup_destroy_yara_compiler (void *ptr); +#endif /* !HAVE_YARA */ #ifdef HAVE_ATTRIBUTE_CLEANUP #define CLEANUP_FREE __attribute__((cleanup(cleanup_free))) @@ -35,8 +39,13 @@ extern void cleanup_free_stringsbuf (void *ptr); __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) #define CLEANUP_CLOSE __attribute__((c...
2018 Sep 13
1
[PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
...- static int shutdown_direct (guestfs_h *g, void *datav, int check_for_errors) { diff --git a/lib/qemu.c b/lib/qemu.c index 3e7f15946..212cda963 100644 --- a/lib/qemu.c +++ b/lib/qemu.c @@ -46,6 +46,19 @@ #include "guestfs-internal.h" #include "guestfs_protocol.h" +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_JSON_T_DECREF __attribute__((cleanup(cleanup_json_t_decref))) + +static void +cleanup_json_t_decref (void *ptr) +{ + json_decref (* (json_t **) ptr); +} + +#else +#define CLEANUP_JSON_T_DECREF +#endif + struct qemu_data { int generation; /* MEMO_GENERATION read f...
2017 Apr 24
10
[PATCH v8 0/8] Feature: Yara file scanning
v8: - Ignore returned value in daemon/upload.c - Report serialization errors in lib/yara.c Matteo Cafasso (8): daemon: ignore unused return value in upload function daemon: expose file upload logic appliance: add yara dependency New API: yara_load New API: yara_destroy New API: internal_yara_scan New API: yara_scan yara_scan: added API tests appliance/packagelist.in
2015 Sep 29
8
[PATCH 0/7] copy-in/copy-out: Capture errors from tar subprocess (RHBZ#1267032).
Commits 3c27f3d91e1566854747bbe844186783fc84f3a8 and 1b6f0daa9ae7fcc94e389232d0c397816cda973d added an internal API for running commands asynchronously. It is only used by the copy-in and copy-out APIs. Unfortunately this made the command code very complex: it was almost impossible to redirect stderr to a file, and there were a lot of long-range dependencies through the file. It was also buggy: