Displaying 8 results from an estimated 8 matches for "random_pread".
2019 Jan 05
0
[PATCH nbdkit v2 06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
...20 100644
--- a/plugins/random/random.c
+++ b/plugins/random/random.c
@@ -107,6 +107,13 @@ random_get_size (void *handle)
return size;
}
+/* Serves the same data over multiple connections. */
+static int
+random_can_multi_conn (void *handle)
+{
+ return 1;
+}
+
/* Read data. */
static int
random_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
@@ -148,6 +155,7 @@ static struct nbdkit_plugin plugin = {
.config_help = random_config_help,
.open = random_open,
.get_size = random_get_size,
+ .can_multi_conn = random_can_multi_conn,
.pread...
2018 Dec 28
2
[PATCH v2 nbdkit] common: Improve pseudo-random number generation.
v2:
- Fix seeding.
- Add a test that nbdkit-random-plugin is producing something
which looks at least somewhat random.
Rich.
2018 Dec 31
1
Re: [PATCH v2 nbdkit] common: Improve pseudo-random number generation.
...des enough information to justify this
choice of a PRNG.
> +++ b/plugins/random/random.c
> /* Seed. */
> static uint32_t seed;
>
Interesting that you kept this as a 32-bit number; I don't see it as
being a real drawback, though, especially since...
> @@ -135,13 +117,27 @@ random_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
> {
> uint32_t i;
> unsigned char *b = buf;
> - uint32_t s;
> + uint64_t s;
>
> for (i = 0; i < count; ++i) {
> - s = LCG (seed) + offset + i;
> - s = LCG (s);
> - s = LCG (s);
> -...
2018 Dec 28
1
[PATCH nbdkit] common: Improve pseudo-random number generation.
...index i+1 LCG(seed) -> +i+1 -> LCG -> LCG -> mod 256 -> b[i+1]
- * etc
- *
- * This LCG is the same one as used in glibc.
- */
-static inline uint32_t
-LCG (uint32_t s)
-{
- s *= 1103515245;
- s += 12345;
- return s;
-}
-
static void
random_load (void)
{
@@ -135,13 +117,27 @@ random_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
{
uint32_t i;
unsigned char *b = buf;
- uint32_t s;
+ uint64_t s;
+ struct random_state state;
for (i = 0; i < count; ++i) {
- s = LCG (seed) + offset + i;
- s = LCG (s);
- s = LCG (s);
- s = s % 255;
+ /* W...
2018 Dec 28
0
[PATCH v2 nbdkit] common: Improve pseudo-random number generation.
...index i+1 LCG(seed) -> +i+1 -> LCG -> LCG -> mod 256 -> b[i+1]
- * etc
- *
- * This LCG is the same one as used in glibc.
- */
-static inline uint32_t
-LCG (uint32_t s)
-{
- s *= 1103515245;
- s += 12345;
- return s;
-}
-
static void
random_load (void)
{
@@ -135,13 +117,27 @@ random_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
{
uint32_t i;
unsigned char *b = buf;
- uint32_t s;
+ uint64_t s;
for (i = 0; i < count; ++i) {
- s = LCG (seed) + offset + i;
- s = LCG (s);
- s = LCG (s);
- s = s % 255;
+ /* We use nbdkit common/include/ra...
2019 Jan 05
15
[PATCH nbdkit v2 01/11] server: Implement NBD_FLAG_CAN_MULTI_CONN.
For existing commits, this is almost identical to v1, except that I
updated some commit messages and reordered the commits in a somewhat
more logical sequence.
The main changes are the extra commits:
[06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
- Readonly plugins that can set the flag unconditionally.
[09/11] partitioning: Return NBD_FLAG_CAN_MULTI_CONN.
[10/11]
2019 May 10
11
[nbdkit PATCH 0/9] RFC: implement NBD_CMD_CACHE
I'm still working my way through the filters before this series will
be complete, but this is enough of a start to at least get some
feedback on the idea of implementing another NBD protocol extension.
Eric Blake (9):
server: Internal hooks for implementing NBD_CMD_CACHE
plugins: Add .cache callback
file, split: Implement .cache with posix_fadvise
nbd: Implement NBD_CMD_CACHE
2019 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1:
- rework .can_cache to be tri-state, with default of no advertisement
(ripple effect through other patches)
- add a lot more patches in order to round out filter support
And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so
in theory we now have a way to test cache commands through the entire
stack.
Eric Blake (24):
server: Internal hooks for implementing