Changeset bb9ec2d in mainline for uspace/srv/vfs/vfs_file.c


Ignore:
Timestamp:
2017-03-07T20:47:35Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a737667e
Parents:
e796dc8
git-author:
Jiri Zarevucky <zarevucky.jiri@…> (2017-03-07 20:47:35)
git-committer:
Jakub Jermar <jakub@…> (2017-03-07 20:47:35)
Message:

Merge from lp:~zarevucky-jiri/helenos/vfs-2.5/ revision 1941-1944

Original commit messages:

1944: Jiri Zarevucky 2013-08-06 Replace legacy file descriptor presetting with inbox.
1943: Jiri Zarevucky 2013-08-06 Do not preserve open state when passing file descriptor to another task. Allow receiver to specify, whether the descriptor is low or high.
1942: Jiri Zarevucky 2013-08-06 C style.
1941: Jiri Zarevucky 2013-08-06 Make loader accept file reference instead of a pathname.

Modifications:

  • Keep version of elf_load_file() that accepts file name
  • Changes required for loading dynamically linked executables
  • Update to newer list_foreach
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_file.c

    re796dc8 rbb9ec2d  
    5959typedef struct {
    6060        link_t link;
    61         int handle;
     61        vfs_node_t *node;
     62        int permissions;
    6263} vfs_boxed_handle_t;
    6364
     
    365366        vfs_client_data_t *acceptor_data = NULL;
    366367        vfs_file_t *donor_file = NULL;
    367         vfs_file_t *acceptor_file = NULL;
    368368        vfs_boxed_handle_t *bh;
    369         int acceptor_fd;
    370369
    371370        acceptor_data = async_get_client_data_by_id(acceptor_id);
     
    377376
    378377        link_initialize(&bh->link);
    379         bh->handle = -1;
     378        bh->node = NULL;
    380379
    381380        donor_data = async_get_client_data_by_id(donor_id);
     
    386385        if (!donor_file)
    387386                goto out;
    388 
    389         acceptor_fd = _vfs_fd_alloc(acceptor_data, &acceptor_file, false);
    390         if (acceptor_fd < 0)
    391                 goto out;
    392 
    393         bh->handle = acceptor_fd;
    394387
    395388        /*
     
    397390         */
    398391        vfs_node_addref(donor_file->node);
    399 
    400         assert(acceptor_file);
    401 
    402         /*
    403          * Inherit attributes from the donor.
    404          */
    405         acceptor_file->node = donor_file->node;
    406         acceptor_file->permissions = donor_file->permissions;
    407        
    408         // TODO: The file should not inherit its open status, but clients depend on this.
    409         acceptor_file->pos = donor_file->pos;
    410         acceptor_file->append = donor_file->append;
    411         acceptor_file->open_read = donor_file->open_read;
    412         acceptor_file->open_write = donor_file->open_write;
    413 
    414         if (acceptor_file->open_read || acceptor_file->open_write) {
    415                 (void) vfs_open_node_remote(acceptor_file->node);
    416         }
     392        bh->node = donor_file->node;
     393        bh->permissions = donor_file->permissions;
    417394
    418395out:
     
    428405        if (donor_file)
    429406                _vfs_file_put(donor_data, donor_file);
    430         if (acceptor_file)
    431                 _vfs_file_put(acceptor_data, acceptor_file);
    432 
    433 }
    434 
    435 int vfs_wait_handle_internal(void)
     407}
     408
     409int vfs_wait_handle_internal(bool high_fd)
    436410{
    437411        vfs_client_data_t *vfs_data = VFS_DATA;
    438         int fd;
    439412       
    440413        fibril_mutex_lock(&vfs_data->lock);
     
    446419
    447420        vfs_boxed_handle_t *bh = list_get_instance(lnk, vfs_boxed_handle_t, link);
    448         fd = bh->handle;
     421
     422        vfs_file_t *file;
     423        int fd = _vfs_fd_alloc(vfs_data, &file, high_fd);
     424        if (fd < 0) {
     425                vfs_node_delref(bh->node);
     426                free(bh);
     427                return fd;
     428        }
     429       
     430        file->node = bh->node;
     431        file->permissions = bh->permissions;
     432        vfs_file_put(file);
    449433        free(bh);
    450 
    451434        return fd;
    452435}
Note: See TracChangeset for help on using the changeset viewer.