Changeset f29a3a2 in mainline


Ignore:
Timestamp:
2010-01-30T10:37:35Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64aed80
Parents:
1715b6af
Message:

Clean up the table of open files after the client closes its VFS connection.

Location:
uspace/srv/vfs
Files:
4 edited

Legend:

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

    r1715b6af rf29a3a2  
    137137        }
    138138       
    139         /* TODO: cleanup after the client */
     139        vfs_files_done();
    140140}
    141141
  • uspace/srv/vfs/vfs.h

    r1715b6af rf29a3a2  
    177177    vfs_pair_t *, ...);
    178178extern int vfs_open_node_internal(vfs_lookup_res_t *);
     179extern int vfs_close_internal(vfs_file_t *);
    179180
    180181extern bool vfs_nodes_init(void);
     
    188189
    189190extern bool vfs_files_init(void);
     191extern void vfs_files_done(void);
    190192extern vfs_file_t *vfs_file_get(int);
    191193extern int vfs_fd_assign(vfs_file_t *file, int fd);
  • uspace/srv/vfs/vfs_file.c

    r1715b6af rf29a3a2  
    7272        }
    7373        return true;
     74}
     75
     76/** Cleanup the table of open files. */
     77void vfs_files_done(void)
     78{
     79        int i;
     80
     81        if (!files)
     82                return;
     83
     84        for (i = 0; i < MAX_OPEN_FILES; i++) {
     85                if (files[i]) {
     86                        (void) vfs_close_internal(files[i]);
     87                        (void) vfs_fd_free(i);
     88                }
     89        }
     90       
     91        free(files);
    7492}
    7593
  • uspace/srv/vfs/vfs_ops.c

    r1715b6af rf29a3a2  
    817817}
    818818
    819 static int vfs_close_internal(vfs_file_t *file)
     819int vfs_close_internal(vfs_file_t *file)
    820820{
    821821        /*
Note: See TracChangeset for help on using the changeset viewer.