Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 368ee04 in mainline for uspace/lib/pcut/src/os/helenos.c


Ignore:
Timestamp:
2017-04-05T18:10:39Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
93ad8166
Parents:
39f892a9 (diff), 2166728 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/vfs-2.5-cherrypick

This merge cherry-picks some of the changesets from Jiri Zarevucky's:

lp:~zarevucky-jiri/helenos/vfs-2.5

and then continues independently, yet sometime in a similar vein.

Roughly speaking, Jiri's branch is merged entirely up to its revision
1926 and then cherry-picked on and off until its revision 1965. Among
these changes are:

  • relativization of the API,
  • client-side roots,
  • server-side mounts,
  • inbox for passing arbitrary files from parent to child,
  • some streamlining and cleanup.

Additional changes include:

  • addressing issues introduced by the above changes,
  • client-side I/O cursors (file positions),
  • all HelenOS file system APIs begin with the vfs_ prefix and can be used after including vfs/vfs.h,
  • removal of some POSIX-ish headers and definitions,
  • additional cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/src/os/helenos.c

    r39f892a9 r368ee04  
    4141#include <stdio.h>
    4242#include <task.h>
    43 #include <fcntl.h>
    4443#include <fibril_synch.h>
     44#include <vfs/vfs.h>
    4545#include "../internal.h"
    4646
     
    161161        char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
    162162        snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id());
    163         int tempfile = open(tempfile_name, O_CREAT | O_RDWR);
     163        int tempfile = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE);
    164164        if (tempfile < 0) {
    165165                pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL);
     
    169169        char test_number_argument[MAX_TEST_NUMBER_WIDTH];
    170170        snprintf(test_number_argument, MAX_TEST_NUMBER_WIDTH, "-t%d", test->id);
    171 
    172         int *files[4];
    173         int fd_stdin = fileno(stdin);
    174         files[0] = &fd_stdin;
    175         files[1] = &tempfile;
    176         files[2] = &tempfile;
    177         files[3] = NULL;
    178171
    179172        const char *const arguments[3] = {
     
    186179
    187180        task_wait_t test_task_wait;
    188         int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments, files);
     181        int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
     182            fileno(stdin), tempfile, tempfile);
    189183        if (rc != EOK) {
    190184                status = TEST_OUTCOME_ERROR;
     
    220214        fibril_mutex_unlock(&forced_termination_mutex);
    221215
    222         read(tempfile, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     216        aoff64_t pos = 0;
     217        vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE);
    223218
    224219leave_close_tempfile:
    225         close(tempfile);
    226         unlink(tempfile_name);
     220        vfs_put(tempfile);
     221        vfs_unlink_path(tempfile_name);
    227222
    228223        pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
Note: See TracChangeset for help on using the changeset viewer.