search for: empty_list

Displaying 20 results from an estimated 30 matches for "empty_list".

2005 May 17
1
returning an empty list.
I would like to return an empty list from a C function. This I would do as: if (file.exists()) { /* do something */ } else { SEXP empty_list; PROTECT(empty_list = NEW_LIST(0)); UNPROTECT(1); return empty_list; } The PROTECT, UNPROTECT lines seemed like overkill to me, but as far as I understood the documentation this seemed like the correct usage. It seems like I could really just do the following: return NEW_LIST(0); b...
2015 Jun 17
0
[PATCH 4/4] daemon: add split_lines_sb
...@ extern int compare_device_names (const char *a, const char *b); extern char *concat_strings (char *const *argv); extern char *join_strings (const char *separator, char *const *argv); +extern struct stringsbuf split_lines_sb (char *str); extern char **split_lines (char *str); extern char **empty_list (void); diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 198b2b2..21b3600 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -1115,7 +1115,8 @@ commandrvf (char **stdoutput, char **stderror, int flags, return -1; } -/* Split an output string into a NULL-terminated list of lin...
2020 Mar 12
0
[PATCH libguestfs 2/3] daemon: Add filter_list utility function.
...--git a/daemon/daemon.h b/daemon/daemon.h index 4d7504b3f..a16953f23 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -74,6 +74,7 @@ extern void free_stringsbuf (struct stringsbuf *sb); extern struct stringsbuf split_lines_sb (char *str); extern char **split_lines (char *str); extern char **empty_list (void); +extern char **filter_list (int (*p) (const char *), char **strs); extern int is_power_of_2 (unsigned long v); extern void trim (char *str); extern int parse_btrfsvol (const char *desc, mountable_t *mountable); diff --git a/daemon/utils.c b/daemon/utils.c index 1cf1b07f6..1fc8d2c80 10064...
2020 Mar 16
0
[PATCH libguestfs v2 2/3] daemon: Add filter_list utility function.
...arg.h> #include <stdint.h> +#include <stdbool.h> #include <errno.h> #include <unistd.h> @@ -74,6 +75,7 @@ extern void free_stringsbuf (struct stringsbuf *sb); extern struct stringsbuf split_lines_sb (char *str); extern char **split_lines (char *str); extern char **empty_list (void); +extern char **filter_list (bool (*p) (const char *), char **strs); extern int is_power_of_2 (unsigned long v); extern void trim (char *str); extern int parse_btrfsvol (const char *desc, mountable_t *mountable); diff --git a/daemon/utils.c b/daemon/utils.c index 1cf1b07f6..21008b40e 1006...
2016 Mar 02
1
[PATCH] daemon: do not fail list-disk-labels w/o labels set
...,13 @@ do_list_disk_labels (void) dir = opendir (GUESTFSDIR); if (!dir) { + if (errno == ENOENT) { + /* The directory does not exist, and usually this happens when + * there are no labels set. In this case, act as if the directory + * was empty. + */ + return empty_list (); + } reply_with_perror ("opendir: %s", GUESTFSDIR); return NULL; } diff --git a/generator/actions.ml b/generator/actions.ml index 9c34463..287d7f5 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -11336,6 +11336,18 @@ silently create an ext2 filesystem in...
2015 Dec 02
3
[PATCH] daemon: improve internal commandrvf
...p;err, flags, (const char * const *) argv); - CHROOT_OUT; free_bind_state (&bind_state); free_resolver_state (&resolver_state); diff --git a/daemon/daemon.h b/daemon/daemon.h index 7fbb2a2..af6f68c 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -128,6 +128,7 @@ extern char **empty_list (void); #define COMMAND_FLAG_FD_MASK (1024-1) #define COMMAND_FLAG_FOLD_STDOUT_ON_STDERR 1024 #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 +#define COMMAND_FLAG_DO_CHROOT 4096 extern int commandf (char **stdoutput, char **stderror, int flags,...
2020 Mar 12
8
[PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
https://bugzilla.redhat.com/show_bug.cgi?id=1811539 Commands including virt-diff which read extended attributes will sometimes fail on NTFS filesystems that are using system compressed. The reason is complex, see comment 5 of the bug linked above. This patch filters out the troublesome xattr. For justification, see the comment I added in patch 3. Patch 1 & 2 are refactoring. I was on the
2015 Jun 17
4
[PATCH 1/4] daemon: introduce free_stringsbuf
Simple shortcut to easily cleanup a stringsbuf. --- daemon/daemon.h | 1 + daemon/guestfsd.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index 53cb797..bed4dbc 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char *str); extern int add_sprintf (struct stringsbuf *sb, const
2017 Jul 14
0
[PATCH 13/27] daemon: Reimplement ‘list_ldm_(volumes|partitions)’ APIs in OCaml.
...y to read these - * names back after they have been created. - */ -char ** -do_list_ldm_volumes (void) -{ - struct stat buf; - - /* If /dev/mapper doesn't exist at all, don't give an error. */ - if (stat ("/dev/mapper", &buf) == -1) { - if (errno == ENOENT) - return empty_list (); - reply_with_perror ("/dev/mapper"); - return NULL; - } - - return get_devices ("/dev/mapper/ldm_vol_*"); -} - -/* Same as above but /dev/mapper/ldm_part_*. See comment above. */ -char ** -do_list_ldm_partitions (void) -{ - struct stat buf; - - /* If /dev/mapper d...
2020 Mar 16
6
[PATCH libguestfs v2 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
v1 here: https://www.redhat.com/archives/libguestfs/2020-March/msg00099.html This one fixes most of the points picked up in review, and does not strdup the strings which should keep down memory usage if that is a concern. Rich.
2015 Dec 02
0
Re: [PATCH] daemon: improve internal commandrvf
...gt; - CHROOT_OUT; > > free_bind_state (&bind_state); > free_resolver_state (&resolver_state); > diff --git a/daemon/daemon.h b/daemon/daemon.h > index 7fbb2a2..af6f68c 100644 > --- a/daemon/daemon.h > +++ b/daemon/daemon.h > @@ -128,6 +128,7 @@ extern char **empty_list (void); > #define COMMAND_FLAG_FD_MASK (1024-1) > #define COMMAND_FLAG_FOLD_STDOUT_ON_STDERR 1024 > #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 > +#define COMMAND_FLAG_DO_CHROOT 4096 > Any eason for having this decimal? The standard...
2013 Aug 24
46
[PATCH 00/46] Proposed patches for libguestfs 1.20.11.
Tested with 'make check-release'. tests/parallel (in check-slow) failed, although it does regularly and that seems to be because of libvirt. Rich.
2013 Aug 24
67
[PATCH 00/67] Proposed patches for libguestfs 1.22.6.
In the kernel and qemu communities it is routine for patches that will be backported to stable branches to be posted for review. I'm proposing we do the same for libguestfs stable branches. All of the attached have been tested with 'make check-release'. Rich.
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -32,6 +32,9 @@ #include "guestfs-internal-all.h" +#include "cleanups.h" +#include "command.h" + /* Mountables */ typedef struct { @@ -117,28 +120,9 @@ extern char **split_lines (char *str); extern char **empty_list (void); -#define command(out,err,name,...) commandf((out),(err),0,(name),__VA_ARGS__) -#define commandr(out,err,name,...) commandrf((out),(err),0,(name),__VA_ARGS__) -#define commandv(out,err,argv) commandvf((out),(err),0,(argv)) -#define commandrv(out,err,argv) commandrvf((out),(err),0,(argv)) -...
2007 Jan 12
9
Nil object in E1 capture the order
I''m following the depot application in the rails bible Agile Web Development with Rails. In interation E1 NoMethodError in Admin#checkout Showing app/views/admin/checkout.rhtml where line #12 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.include? Extracted source (around line #12):
2009 Nov 09
1
use STREQ(a,b), not strcmp(a,b) == 0
...--git a/daemon/guestfsd.c b/daemon/guestfsd.c index 5789fed..db0bff9 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -831,7 +831,7 @@ split_lines (char *str) int size = 0, alloc = 0; char *p, *pend; - if (strcmp (str, "") == 0) + if (STREQ (str, "")) goto empty_list; p = str; diff --git a/daemon/ls.c b/daemon/ls.c index 3e3183a..0af2356 100644 --- a/daemon/ls.c +++ b/daemon/ls.c @@ -47,7 +47,7 @@ do_ls (const char *path) } while ((d = readdir (dir)) != NULL) { - if (strcmp (d->d_name, ".") == 0 || strcmp (d->d_name, ".."...
2012 Mar 13
2
[PATCH 0/2] 'int' to 'size_t' changes
These two patches are probably not completely independent, but separating them is a lot of work. With *both* patches applied, all the tests and extra-tests pass. That's no guarantee however that there isn't a mistake, so I don't think this patch is a candidate for the 1.16 branch, until it's had a lot more testing in development. Rich.
2017 Aug 03
9
[PATCH 0/6] tests: Fix handling of device API parameters (RHBZ#1477623).
https://bugzilla.redhat.com/show_bug.cgi?id=1477623 The first two patches are cleanups. The third patch changes the way that we handle Device and Dev_or_Path parameters so that a parameter marked as such can really only contain a block device name (and not, for instance, a chardev). Using a chardev here caused hangs in the API. The next two patches fix API usage to conform to this new stricter
2017 Jul 24
6
[PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
Replace GUESTFSD_EXT_CMD with a command line option ‘./guestfsd --print-external-commands’
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers. These aren't valid for global names in C++. (http://stackoverflow.com/a/228797) These large but completely mechanical patches change the illegal identifiers to legal ones. Rich.