Changeset 92574f4 in mainline for uspace/srv/fs/devfs/devfs_ops.c


Ignore:
Timestamp:
2011-02-24T12:03:27Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7b7ebd5
Parents:
4837092 (diff), a80849c (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:

Merged development (changes in DDF, etc.).

Conflicts in uspace/drv/usbkbd/main.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/devfs/devfs_ops.c

    r4837092 r92574f4  
    3636 */
    3737
    38 #include <ipc/ipc.h>
    3938#include <macros.h>
    4039#include <bool.h>
     
    131130{
    132131        devfs_node_t *node = (devfs_node_t *) pfn->data;
     132        int ret;
    133133       
    134134        if (node->handle == 0) {
     
    146146                               
    147147                                if (str_cmp(devs[pos].name, component) == 0) {
     148                                        ret = devfs_node_get_internal(rfn, DEV_HANDLE_NAMESPACE, devs[pos].handle);
    148149                                        free(devs);
    149                                         return devfs_node_get_internal(rfn, DEV_HANDLE_NAMESPACE, devs[pos].handle);
     150                                        return ret;
    150151                                }
    151152                        }
     
    163164                                for (pos = 0; pos < count; pos++) {
    164165                                        if (str_cmp(devs[pos].name, component) == 0) {
     166                                                ret = devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);
    165167                                                free(devs);
    166                                                 return devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);
     168                                                return ret;
    167169                                        }
    168170                                }
     
    185187                        for (pos = 0; pos < count; pos++) {
    186188                                if (str_cmp(devs[pos].name, component) == 0) {
     189                                        ret = devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);
    187190                                        free(devs);
    188                                         return devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);
     191                                        return ret;
    189192                                }
    190193                        }
     
    275278                                fibril_mutex_unlock(&devices_mutex);
    276279
    277                                 free(dev);
    278280                                return ENOENT;
    279281                        }
     
    465467            0, NULL);
    466468        if (retval != EOK) {
    467                 ipc_answer_0(rid, retval);
     469                async_answer_0(rid, retval);
    468470                return;
    469471        }
    470472       
    471473        free(opts);
    472         ipc_answer_3(rid, EOK, 0, 0, 0);
     474        async_answer_3(rid, EOK, 0, 0, 0);
    473475}
    474476
     
    480482void devfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    481483{
    482         ipc_answer_0(rid, ENOTSUP);
     484        async_answer_0(rid, ENOTSUP);
    483485}
    484486
     
    513515                size_t size;
    514516                if (!async_data_read_receive(&callid, &size)) {
    515                         ipc_answer_0(callid, EINVAL);
    516                         ipc_answer_0(rid, EINVAL);
     517                        async_answer_0(callid, EINVAL);
     518                        async_answer_0(rid, EINVAL);
    517519                        return;
    518520                }
     
    535537                        async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    536538                        free(desc);
    537                         ipc_answer_1(rid, EOK, 1);
     539                        async_answer_1(rid, EOK, 1);
    538540                        return;
    539541                }
     
    550552                                async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    551553                                free(desc);
    552                                 ipc_answer_1(rid, EOK, 1);
     554                                async_answer_1(rid, EOK, 1);
    553555                                return;
    554556                        }
     
    557559                }
    558560               
    559                 ipc_answer_0(callid, ENOENT);
    560                 ipc_answer_1(rid, ENOENT, 0);
     561                async_answer_0(callid, ENOENT);
     562                async_answer_1(rid, ENOENT, 0);
    561563                return;
    562564        }
     
    569571                size_t size;
    570572                if (!async_data_read_receive(&callid, &size)) {
    571                         ipc_answer_0(callid, EINVAL);
    572                         ipc_answer_0(rid, EINVAL);
     573                        async_answer_0(callid, EINVAL);
     574                        async_answer_0(rid, EINVAL);
    573575                        return;
    574576                }
     
    580582                        async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    581583                        free(desc);
    582                         ipc_answer_1(rid, EOK, 1);
     584                        async_answer_1(rid, EOK, 1);
    583585                        return;
    584586                }
    585587               
    586588                free(desc);
    587                 ipc_answer_0(callid, ENOENT);
    588                 ipc_answer_1(rid, ENOENT, 0);
     589                async_answer_0(callid, ENOENT);
     590                async_answer_1(rid, ENOENT, 0);
    589591                return;
    590592        }
     
    601603                if (lnk == NULL) {
    602604                        fibril_mutex_unlock(&devices_mutex);
    603                         ipc_answer_0(rid, ENOENT);
     605                        async_answer_0(rid, ENOENT);
    604606                        return;
    605607                }
     
    611613                if (!async_data_read_receive(&callid, NULL)) {
    612614                        fibril_mutex_unlock(&devices_mutex);
    613                         ipc_answer_0(callid, EINVAL);
    614                         ipc_answer_0(rid, EINVAL);
     615                        async_answer_0(callid, EINVAL);
     616                        async_answer_0(rid, EINVAL);
    615617                        return;
    616618                }
     
    623625               
    624626                /* Forward the IPC_M_DATA_READ request to the driver */
    625                 ipc_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     627                async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    626628                fibril_mutex_unlock(&devices_mutex);
    627629               
     
    632634               
    633635                /* Driver reply is the final result of the whole operation */
    634                 ipc_answer_1(rid, rc, bytes);
    635                 return;
    636         }
    637        
    638         ipc_answer_0(rid, ENOENT);
     636                async_answer_1(rid, rc, bytes);
     637                return;
     638        }
     639       
     640        async_answer_0(rid, ENOENT);
    639641}
    640642
     
    643645        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    644646        if (index == 0) {
    645                 ipc_answer_0(rid, ENOTSUP);
     647                async_answer_0(rid, ENOTSUP);
    646648                return;
    647649        }
     
    651653        if (type == DEV_HANDLE_NAMESPACE) {
    652654                /* Namespace directory */
    653                 ipc_answer_0(rid, ENOTSUP);
     655                async_answer_0(rid, ENOTSUP);
    654656                return;
    655657        }
     
    665667                if (lnk == NULL) {
    666668                        fibril_mutex_unlock(&devices_mutex);
    667                         ipc_answer_0(rid, ENOENT);
     669                        async_answer_0(rid, ENOENT);
    668670                        return;
    669671                }
     
    675677                if (!async_data_write_receive(&callid, NULL)) {
    676678                        fibril_mutex_unlock(&devices_mutex);
    677                         ipc_answer_0(callid, EINVAL);
    678                         ipc_answer_0(rid, EINVAL);
     679                        async_answer_0(callid, EINVAL);
     680                        async_answer_0(rid, EINVAL);
    679681                        return;
    680682                }
     
    687689               
    688690                /* Forward the IPC_M_DATA_WRITE request to the driver */
    689                 ipc_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     691                async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    690692               
    691693                fibril_mutex_unlock(&devices_mutex);
     
    697699               
    698700                /* Driver reply is the final result of the whole operation */
    699                 ipc_answer_1(rid, rc, bytes);
    700                 return;
    701         }
    702        
    703         ipc_answer_0(rid, ENOENT);
     701                async_answer_1(rid, rc, bytes);
     702                return;
     703        }
     704       
     705        async_answer_0(rid, ENOENT);
    704706}
    705707
    706708void devfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    707709{
    708         ipc_answer_0(rid, ENOTSUP);
     710        async_answer_0(rid, ENOTSUP);
    709711}
    710712
     
    714716       
    715717        if (index == 0) {
    716                 ipc_answer_0(rid, EOK);
     718                async_answer_0(rid, EOK);
    717719                return;
    718720        }
     
    722724        if (type == DEV_HANDLE_NAMESPACE) {
    723725                /* Namespace directory */
    724                 ipc_answer_0(rid, EOK);
     726                async_answer_0(rid, EOK);
    725727                return;
    726728        }
     
    735737                if (lnk == NULL) {
    736738                        fibril_mutex_unlock(&devices_mutex);
    737                         ipc_answer_0(rid, ENOENT);
     739                        async_answer_0(rid, ENOENT);
    738740                        return;
    739741                }
     
    744746               
    745747                if (dev->refcount == 0) {
    746                         ipc_hangup(dev->phone);
     748                        async_hangup(dev->phone);
    747749                        hash_table_remove(&devices, key, DEVICES_KEYS);
    748750                }
     
    750752                fibril_mutex_unlock(&devices_mutex);
    751753               
    752                 ipc_answer_0(rid, EOK);
    753                 return;
    754         }
    755        
    756         ipc_answer_0(rid, ENOENT);
     754                async_answer_0(rid, EOK);
     755                return;
     756        }
     757       
     758        async_answer_0(rid, ENOENT);
    757759}
    758760
     
    762764       
    763765        if (index == 0) {
    764                 ipc_answer_0(rid, EOK);
     766                async_answer_0(rid, EOK);
    765767                return;
    766768        }
     
    770772        if (type == DEV_HANDLE_NAMESPACE) {
    771773                /* Namespace directory */
    772                 ipc_answer_0(rid, EOK);
     774                async_answer_0(rid, EOK);
    773775                return;
    774776        }
     
    783785                if (lnk == NULL) {
    784786                        fibril_mutex_unlock(&devices_mutex);
    785                         ipc_answer_0(rid, ENOENT);
     787                        async_answer_0(rid, ENOENT);
    786788                        return;
    787789                }
     
    802804               
    803805                /* Driver reply is the final result of the whole operation */
    804                 ipc_answer_0(rid, rc);
    805                 return;
    806         }
    807        
    808         ipc_answer_0(rid, ENOENT);
     806                async_answer_0(rid, rc);
     807                return;
     808        }
     809       
     810        async_answer_0(rid, ENOENT);
    809811}
    810812
    811813void devfs_destroy(ipc_callid_t rid, ipc_call_t *request)
    812814{
    813         ipc_answer_0(rid, ENOTSUP);
     815        async_answer_0(rid, ENOTSUP);
    814816}
    815817
Note: See TracChangeset for help on using the changeset viewer.