1.1 --- a/dstest_host_client.cc Thu Mar 04 23:50:40 2021 +0100
1.2 +++ b/dstest_host_client.cc Sun Mar 07 23:05:04 2021 +0100
1.3 @@ -72,7 +72,7 @@
1.4
1.5 file_t file;
1.6
1.7 - err = file_open(&file, context.ref);
1.8 + err = file_open(&file, &context);
1.9
1.10 if (err)
1.11 {
2.1 --- a/dstest_test_client.cc Thu Mar 04 23:50:40 2021 +0100
2.2 +++ b/dstest_test_client.cc Sun Mar 07 23:05:04 2021 +0100
2.3 @@ -50,7 +50,7 @@
2.4
2.5 /* An activity opening and reading from a file. */
2.6
2.7 -static long activity(l4_cap_idx_t context_ref, unsigned long fileid, unsigned int start_page)
2.8 +static long activity(file_t *context, unsigned long fileid, unsigned int start_page)
2.9 {
2.10 unsigned long step = page(1);
2.11 unsigned long sample = page(1);
2.12 @@ -63,7 +63,7 @@
2.13
2.14 file_t file;
2.15
2.16 - long err = file_open(&file, context_ref);
2.17 + long err = file_open(&file, context);
2.18
2.19 if (err)
2.20 {
2.21 @@ -118,7 +118,7 @@
2.22
2.23
2.24
2.25 -static long activity_iterate(file_t *file, unsigned long fileid, unsigned int start_page)
2.26 +static long activity_iterate(file_t *context, unsigned long fileid, unsigned int start_page)
2.27 {
2.28 long err;
2.29
2.30 @@ -126,7 +126,7 @@
2.31
2.32 for (unsigned int iteration = 0; iteration < ACTIVITY_ITERATIONS; iteration++)
2.33 {
2.34 - err = activity(file->ref, fileid, start_page);
2.35 + err = activity(context, fileid, start_page);
2.36 if (err)
2.37 break;
2.38 }
3.1 --- a/file.cc Thu Mar 04 23:50:40 2021 +0100
3.2 +++ b/file.cc Sun Mar 07 23:05:04 2021 +0100
3.3 @@ -89,13 +89,13 @@
3.4 return ipc_attach_dataspace(file->ref, file->end_pos - file->start_pos, (void **) &file->memory);
3.5 }
3.6
3.7 -/* Open a file using the given structure and context reference. */
3.8 +/* Open a file using the given structure and context. */
3.9
3.10 -long file_open(file_t *file, l4_cap_idx_t context_ref)
3.11 +long file_open(file_t *file, file_t *context)
3.12 {
3.13 - client_OpenerContext context(context_ref);
3.14 + client_OpenerContext openercontext(context->ref);
3.15 file_init(file);
3.16 - return context.open(L4_FPAGE_RW, &file->size, &file->ref);
3.17 + return openercontext.open(L4_FPAGE_RW, &file->size, &file->ref);
3.18 }
3.19
3.20 /* Return the amount of data in the mapped region for the given file. */
4.1 --- a/file.h Thu Mar 04 23:50:40 2021 +0100
4.2 +++ b/file.h Sun Mar 07 23:05:04 2021 +0100
4.3 @@ -41,19 +41,24 @@
4.4
4.5 /* File region parameters. */
4.6
4.7 - offset_t start_pos, end_pos; /* start and end of region */
4.8 + offset_t start_pos, end_pos; /* start and end positions of region */
4.9 offset_t data_end; /* amount of data in the region */
4.10 - offset_t size; /* total size of file */
4.11 +
4.12 + /* Total size of file. */
4.13 +
4.14 + offset_t size;
4.15
4.16 } file_t;
4.17
4.18 +
4.19 +
4.20 /* File access operations. */
4.21
4.22 void file_close(file_t *file);
4.23 long file_context(file_t *file, l4_cap_idx_t server);
4.24 void file_init(file_t *file);
4.25 long file_mmap(file_t *file, offset_t position, offset_t length);
4.26 -long file_open(file_t *file, l4_cap_idx_t context_ref);
4.27 +long file_open(file_t *file, file_t *context);
4.28 offset_t file_span(file_t *file);
4.29
4.30 EXTERN_C_END