File: started.c

package info (click to toggle)
libblkio 1.5.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,040 kB
  • sloc: ansic: 3,443; sh: 460; makefile: 35; python: 16
file content (35 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-License-Identifier: (MIT OR Apache-2.0)
#include "util.h"

enum {
    TEST_FILE_SIZE = 2 * 1024 * 1024,
};

static char filename[] = "started-XXXXXX";

int main(int argc, char **argv)
{
    struct test_opts opts;
    struct blkio *b;

    parse_generic_opts(&opts, argc, argv);

    create(&b, &opts, filename, TEST_FILE_SIZE);

    ok(blkio_connect(b));

    /* Calling it twice works */
    ok(blkio_connect(b));

    ok(blkio_start(b));

    /* Calling it twice works */
    ok(blkio_start(b));

    err(blkio_connect(b), -EBUSY);

    blkio_destroy(&b);
    assert(!b);

    return 0;
}