MCPcopy Create free account
hub / github.com/axboe/liburing / open_files

Function open_files

test/file-update.c:34–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34static int *open_files(int nr_files, int extra, int add)
35{
36 char fname[32];
37 int *files;
38 int i;
39
40 files = t_calloc(nr_files + extra, sizeof(int));
41
42 for (i = 0; i < nr_files; i++) {
43 if (!add)
44 sprintf(fname, ".reg.%d", i);
45 else
46 sprintf(fname, ".add.%d", i + add);
47 files[i] = open(fname, O_RDWR | O_CREAT, 0644);
48 if (files[i] < 0) {
49 perror("open");
50 free(files);
51 files = NULL;
52 break;
53 }
54 }
55 if (extra) {
56 for (i = nr_files; i < nr_files + extra; i++)
57 files[i] = -1;
58 }
59
60 return files;
61}
62
63static int test_update_multiring(struct io_uring *r1, struct io_uring *r2,
64 struct io_uring *r3, int do_unreg)

Callers 1

test_update_multiringFunction · 0.70

Calls 1

t_callocFunction · 0.85

Tested by 1

test_update_multiringFunction · 0.56