Changeset b7c62a9 in mainline for uspace/lib/fs/libfs.c


Ignore:
Timestamp:
2013-07-29T11:44:35Z (11 years ago)
Author:
Jiri Zarevucky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
677745a
Parents:
9e9b168
Message:

Make the server oblivious to the link count. It is just another source of potential problems. Also clean up some confusion with file types and node refcount.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/fs/libfs.c

    r9e9b168 rb7c62a9  
    203203        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
    204204        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
     205
    205206        int rc;
    206 
    207         rc = vfs_out_ops->destroy(service_id, index);
    208 
     207        fs_node_t *node = NULL;
     208        rc = libfs_ops->node_get(&node, service_id, index);
     209        if (rc == EOK && node != NULL) {
     210                bool destroy = (libfs_ops->lnkcnt_get(node) == 0);
     211                libfs_ops->node_put(node);
     212                if (destroy) {
     213                        rc = vfs_out_ops->destroy(service_id, index);
     214                }
     215        }
    209216        async_answer_0(rid, rc);
    210217}
     
    769776                        async_answer_5(rid, fs_handle, service_id,
    770777                            ops->index_get(cur), LOWER32(size), UPPER32(size),
    771                             ops->lnkcnt_get(cur));
     778                            ops->is_directory(cur) ? VFS_NODE_DIRECTORY : VFS_NODE_FILE);
    772779                        LOG_EXIT(EOK);
    773780                } else {
     
    831838        async_answer_5(rid, fs_handle, service_id,
    832839                ops->index_get(cur), LOWER32(size), UPPER32(size),
    833                 ops->lnkcnt_get(cur));
     840                ops->is_directory(cur) ? VFS_NODE_DIRECTORY : VFS_NODE_FILE);
    834841       
    835842        LOG_EXIT(EOK);
Note: See TracChangeset for help on using the changeset viewer.