Displaying 20 results from an estimated 32 matches for "ret_false".
2006 Mar 16
2
[LLVMdev] Stupid '-load-vn -licm' question (LLVM 1.6)
...br label %loop_test
loop_test: ; preds = %loop_step, %entry
%iter = phi ubyte* [ %begin, %entry ], [ %next, %
loop_step ] ; <ubyte*> [#uses=4]
%done = setgt ubyte* %iter, %scan_end ; <bool>
[#uses=1]
br bool %done, label %ret_false, label %regex6
ret_true: ; preds = %regex2, %regex6
ret bool true
ret_false: ; preds = %loop_test
ret bool false
}
2018 Dec 15
1
Re: [PATCH nbdkit v2 3/4] sh: Switch nbdkit-sh-plugin to use API version 2.
...gt; + switch (call_read (&s, &slen, args)) {
> + case OK:
> + if (slen > 0 && s[slen-1] == '\n')
> + s[slen-1] = '\0';
Good - you do ignore trailing newline. Makes it easier for the author to
not worry about it either way.
> +
> + case RET_FALSE:
> + free (s);
> + nbdkit_error ("%s: %s method returned unexpected code (3/false)",
> + script, "can_fua");
> + errno = EIO;
> + return -1;
> +
So you decided not to take the suggestion of a false return being
equivalent to a suc...
2006 Mar 17
0
[LLVMdev] Stupid '-load-vn -licm' question (LLVM 1.6)
...%loop_test
>
> loop_test: ; preds = %loop_step, %entry
> %iter = phi ubyte* [ %begin, %entry ], [ %next, %loop_step ]
> ; <ubyte*> [#uses=4]
> %done = setgt ubyte* %iter, %scan_end ; <bool> [#uses=1]
> br bool %done, label %ret_false, label %regex6
>
> ret_true: ; preds = %regex2, %regex6
> ret bool true
>
> ret_false: ; preds = %loop_test
> ret bool false
> }
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at...
2019 May 16
0
[nbdkit PATCH v2 07/24] sh: Implement .cache script callback
...;
+
+ case MISSING:
+ /* NBDKIT_CACHE_EMULATE means that nbdkit will call .pread. However
+ * we cannot know if that fallback would be efficient, so the safest
+ * default is to return NBDKIT_CACHE_NONE.
+ */
+ return NBDKIT_CACHE_NONE;
+
+ case ERROR:
+ return -1;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, "can_cache");
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
static int
sh_flush (void *handle, uint32_t flags)
{
@@ -782,6 +829,38 @@ sh_extents (void *han...
2020 Mar 19
0
[nbdkit PATCH 1/2] sh, eval: Cache .can_zero and .can_flush
...*/
- free (h);
- h = strdup ("");
- if (h == NULL)
+ free (h->h);
+ h->h = strdup ("");
+ if (h->h == NULL)
nbdkit_error ("strdup: %m");
return h;
case ERROR:
+ free (h->h);
free (h);
return NULL;
case RET_FALSE:
+ free (h->h);
free (h);
nbdkit_error ("%s: %s method returned unexpected code (3/false)",
script, method);
@@ -249,14 +264,15 @@ sh_close (void *handle)
{
const char *method = "close";
const char *script = get_script (method);
- char...
2019 May 10
0
[nbdkit PATCH 6/9] sh: Implement .cache script callback
...sizeof cbuf, "%" PRIu32, count);
+ snprintf (obuf, sizeof obuf, "%" PRIu64, offset);
+ assert (!flags);
+
+ switch (call (args)) {
+ case OK:
+ return 0;
+
+ case MISSING:
+ /* Ignore lack of cache callback. */
+ return 0;
+
+ case ERROR:
+ return -1;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, "cache");
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
#define sh_config_help \
"script=<FILENAME> (required) The shell script to run.\n&q...
2018 Dec 15
5
[PATCH nbdkit v2 0/4] tests: Test export flags (eflags).
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-December/thread.html#00123
v2:
- Document "-" instead of "script=-" and use it in the test; and
verify this also works on FreeBSD; and verify that it doesn't
depend on the particular behaviour of our wrapper script and should
work with installed nbdkit too.
- Fix handling of zero flags parameter.
-
2018 Dec 14
0
[PATCH nbdkit 2/3] sh: Switch nbdkit-sh-plugin to use API version 2.
...MISSING:
+ free (s);
+ /* NBDKIT_FUA_EMULATE means that nbdkit will call .flush. However
+ * we cannot know if that callback exists, so the safest default
+ * is to return NBDKIT_FUA_NONE.
+ */
+ return NBDKIT_FUA_NONE;
+
+ case ERROR:
+ free (s);
+ return -1;
+
+ case RET_FALSE:
+ free (s);
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, "can_fua");
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
+static int
+sh_flush (void *handle, uint32_t flags)
{
char *h = handle;
const...
2018 Dec 15
0
[PATCH nbdkit v2 3/4] sh: Switch nbdkit-sh-plugin to use API version 2.
...MISSING:
+ free (s);
+ /* NBDKIT_FUA_EMULATE means that nbdkit will call .flush. However
+ * we cannot know if that callback exists, so the safest default
+ * is to return NBDKIT_FUA_NONE.
+ */
+ return NBDKIT_FUA_NONE;
+
+ case ERROR:
+ free (s);
+ return -1;
+
+ case RET_FALSE:
+ free (s);
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, "can_fua");
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
+static int
+sh_flush (void *handle, uint32_t flags)
{
char *h = handle;
const...
2018 Dec 14
6
[PATCH nbdkit 0/3] tests: Test export flags (eflags).
Some feature additions to the shell script plugin allow us to test the
export flags field reasonably easily.
Rich.
2020 Aug 25
0
[nbdkit PATCH 5/5] sh, eval: Implement .default_export
...s, "NAMES\n")) != NULL)
+ ;
+ else
+ p = s;
+ n = strchr (p, '\n') ?: s + slen;
+ name = strndup (p, n - p);
+ return nbdkit_string_intern (name);
+
+ case MISSING:
+ return nbdkit_string_intern ("");
+
+ case ERROR:
+ return NULL;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, method);
+ errno = EIO;
+ return NULL;
+
+ default: abort ();
+ }
+}
+
void *
sh_open (int readonly)
{
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index 374888a4..4fcc2a5a 1006...
2019 May 20
3
[nbdkit PATCH 0/2] More on .thread_model
Rich pointed out that making thread_model dynamic even for plugins
makes some sense, so here is the code for doing it for 'sh'.
I'm less confident on how to do it for OCaml and Rust (not to mention
that those allow the plugin to already compile in their model, rather
than the language binding glue forcing a model). The other languages
(lua, perl, python, ruby) still need to be
2020 Jul 31
0
[RFC nbdkit PATCH 4/4] sh, eval: Add .list_exports support
...;, NULL };
+ CLEANUP_FREE char *s = NULL;
+ size_t slen;
+
+ switch (call_read (&s, &slen, args)) {
+ case OK:
+ return parse_exports (script, s, slen, exports);
+
+ case MISSING:
+ return nbdkit_add_export (exports, "", NULL);
+
+ case ERROR:
+ return -1;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, method);
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
void *
sh_open (int readonly)
{
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index 9e484823..374888a4 100644...
2020 Mar 19
5
[nbdkit PATCH 0/2] More caching of initial setup
When I added .can_FOO caching in 1.16, I missed the case that the sh
plugin itself was calling .can_flush twice in some situations (in
order to default .can_fua). Then right after, I regressed it to call
.can_zero twice (in order to default .can_fast_zero). I also missed
that .thread_model could use better caching, because at the time, I
did not add testsuite coverage. Fix that now.
Eric Blake
2020 Aug 06
0
[nbdkit PATCH v2 5/5] sh, eval: Add .list_exports support
...;, NULL };
+ CLEANUP_FREE char *s = NULL;
+ size_t slen;
+
+ switch (call_read (&s, &slen, args)) {
+ case OK:
+ return parse_exports (script, s, slen, exports);
+
+ case MISSING:
+ return nbdkit_add_export (exports, "", NULL);
+
+ case ERROR:
+ return -1;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, method);
+ errno = EIO;
+ return -1;
+
+ default: abort ();
+ }
+}
+
void *
sh_open (int readonly)
{
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index 9e484823..374888a4 100644...
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...har *)
+ __attribute__((__nonnull__ (1, 4)));
extern void create_gpt_layout (void);
#endif /* NBDKIT_VIRTUAL_DISK_H */
diff --git a/plugins/sh/call.h b/plugins/sh/call.h
index 204a404..b5916b0 100644
--- a/plugins/sh/call.h
+++ b/plugins/sh/call.h
@@ -42,9 +42,13 @@ typedef enum exit_code {
RET_FALSE = 3 /* script exited with code 3 meaning false */
} exit_code;
-extern exit_code call (const char **argv);
-extern exit_code call_read (char **rbuf, size_t *rbuflen, const char **argv);
-extern exit_code call_write (const char *wbuf, size_t wbuflen, const char **argv);
+extern exit_code c...
2020 Sep 21
0
[nbdkit PATCH v3 06/14] api: Add .export_description
...= NULL;
+ size_t slen;
+
+ switch (call_read (&s, &slen, args)) {
+ case OK:
+ if (slen > 0 && s[slen-1] == '\n')
+ s[slen-1] = '\0';
+ return nbdkit_strdup_intern (s);
+
+ case MISSING:
+ return NULL;
+
+ case ERROR:
+ return NULL;
+
+ case RET_FALSE:
+ nbdkit_error ("%s: %s method returned unexpected code (3/false)",
+ script, method);
+ errno = EIO;
+ return NULL;
+
+ default: abort ();
+ }
+}
+
int64_t
sh_get_size (void *handle)
{
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index 4fcc2a5a..db75d386...
2020 Aug 27
0
[PATCH nbdkit 2/2] api: Remove .list_exports from nbdkit 1.22 release.
...;, NULL };
- CLEANUP_FREE char *s = NULL;
- size_t slen;
-
- switch (call_read (&s, &slen, args)) {
- case OK:
- return parse_exports (script, s, slen, exports);
-
- case MISSING:
- return nbdkit_add_export (exports, "", NULL);
-
- case ERROR:
- return -1;
-
- case RET_FALSE:
- nbdkit_error ("%s: %s method returned unexpected code (3/false)",
- script, method);
- errno = EIO;
- return -1;
-
- default: abort ();
- }
-}
-
void *
sh_open (int readonly)
{
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index 374888a4..9e484823 100644...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html
In v2 I have provided two patches:
The first patch extends attribute((nonnull)) to most internal
functions, but not to the external API.
The second patch uses a macro so that attribute((format)) is only used
in the public API on GCC or Clang. At least in theory these headers
could be used by a C compiler which
2019 Aug 23
2
[nbdkit PATCH 3/3] plugins: Add .can_fast_zero hook
...boolean_method (void *handle, const char *method_name)
+boolean_method (void *handle, const char *method_name, int def)
{
char *h = handle;
const char *args[] = { script, method_name, h, NULL };
@@ -546,8 +549,8 @@ boolean_method (void *handle, const char *method_name)
return 1;
case RET_FALSE: /* false */
return 0;
- case MISSING: /* missing => assume false */
- return 0;
+ case MISSING: /* missing => caller chooses default */
+ return def;
case ERROR: /* error cases */
return -1;
default: abor...