Displaying 3 results from an estimated 3 matches for "ansi_c_get_size".
2019 Jan 18
1
Re: [PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...plugin plugin = {
> + 0, 0, 0,
I'd typically use NULL for pointers, but using 0 is strictly portable,
so I'm fine with it.
> + "ansic",
> + 0,
> + PACKAGE_VERSION,
> + 0,
> + ansi_c_load,
> + 0,
> + 0, 0, 0,
> + ansi_c_open,
> + 0,
> + ansi_c_get_size,
> + 0, 0, 0, 0,
> + ansi_c_pread
> +};
> +
> +NBDKIT_REGISTER_PLUGIN(plugin)
> +++ b/tests/Makefile.am
>
> +# This builds a plugin using an ANSI (ISO C90) compiler to ensure that
> +# the header file is compatible. The plugin does nothing very
> +# interesting,...
2019 Jan 14
4
[PATCH nbdkit 0/2] tests: Test that public headers are ANSI (ISO C90) compatible.
We previously discussed allowing the plugin API to be consumed by
non-GCC/non-Clang/old compilers. This implements a test.
Rich.
2019 Jan 14
0
[PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
+};
+static unsigned char data[104857600];
+
+static void
+ansi_c_load (void)
+{
+ memcpy (data, bootsector, sizeof bootsector);
+}
+
+static void *
+ansi_c_open (int readonly)
+{
+ return NBDKIT_HANDLE_NOT_NEEDED;
+}
+
+static int64_t
+ansi_c_get_size (void *handle)
+{
+ return (int64_t) sizeof (data);
+}
+
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS
+
+static int
+ansi_c_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
+{
+ memcpy (buf, data+offset, count);
+ return 0;
+}
+
+/* Strictly speaking (and we...