Changeset 5126f80 in mainline for uspace/srv/vfs/vfs_file.c


Ignore:
Timestamp:
2017-03-08T11:42:17Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d35511
Parents:
a737667e
git-author:
Jiri Zarevucky <zarevucky.jiri@…> (2017-03-08 11:42:17)
git-committer:
Jakub Jermar <jakub@…> (2017-03-08 11:42:17)
Message:

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

Original commit messages:

1946: Jiri Zarevucky 2013-08-06 Relativize mount, add root handle to libc and remove root from VFS server. This wraps up the "relativization" phase.

Breakage:

  • Dynamic builds broken
  • Mount table lookups by name
File:
1 edited

Legend:

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

    ra737667e r5126f80  
    178178                 * endpoint FS and drop our reference to the underlying VFS node.
    179179                 */
    180                 if (file->open_read || file->open_write) {
    181                         rc = vfs_file_close_remote(file);
    182                 }
    183                 vfs_node_delref(file->node);
     180               
     181                if (file->node != NULL) {
     182                        if (file->open_read || file->open_write) {
     183                                rc = vfs_file_close_remote(file);
     184                        }
     185                        vfs_node_delref(file->node);
     186                }
    184187                free(file);
    185188        }
     
    312315}
    313316
     317static void _vfs_file_put(vfs_client_data_t *vfs_data, vfs_file_t *file)
     318{
     319        fibril_mutex_unlock(&file->_lock);
     320       
     321        fibril_mutex_lock(&vfs_data->lock);
     322        vfs_file_delref(vfs_data, file);
     323        fibril_mutex_unlock(&vfs_data->lock);
     324}
     325
    314326static vfs_file_t *_vfs_file_get(vfs_client_data_t *vfs_data, int fd)
    315327{
     
    323335                        vfs_file_addref(vfs_data, file);
    324336                        fibril_mutex_unlock(&vfs_data->lock);
     337                       
    325338                        fibril_mutex_lock(&file->_lock);
     339                        if (file->node == NULL) {
     340                                _vfs_file_put(vfs_data, file);
     341                                return NULL;
     342                        }
     343                        assert(file != NULL);
     344                        assert(file->node != NULL);
    326345                        return file;
    327346                }
     
    341360{
    342361        return _vfs_file_get(VFS_DATA, fd);
    343 }
    344 
    345 static void _vfs_file_put(vfs_client_data_t *vfs_data, vfs_file_t *file)
    346 {
    347         fibril_mutex_unlock(&file->_lock);
    348        
    349         fibril_mutex_lock(&vfs_data->lock);
    350         vfs_file_delref(vfs_data, file);
    351         fibril_mutex_unlock(&vfs_data->lock);
    352362}
    353363
Note: See TracChangeset for help on using the changeset viewer.