Changeset 17aca1c in mainline for uspace/srv/fs/devfs/devfs_ops.c


Ignore:
Timestamp:
2011-02-04T20:56:52Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0397e5a4, e29e09cf
Parents:
e778543 (diff), 0b37882 (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:

Merge mainline changes

File:
1 edited

Legend:

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

    re778543 r17aca1c  
    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                        }
     
    465468            0, NULL);
    466469        if (retval != EOK) {
    467                 ipc_answer_0(rid, retval);
     470                async_answer_0(rid, retval);
    468471                return;
    469472        }
    470473       
    471474        free(opts);
    472         ipc_answer_3(rid, EOK, 0, 0, 0);
     475        async_answer_3(rid, EOK, 0, 0, 0);
    473476}
    474477
     
    480483void devfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    481484{
    482         ipc_answer_0(rid, ENOTSUP);
     485        async_answer_0(rid, ENOTSUP);
    483486}
    484487
     
    513516                size_t size;
    514517                if (!async_data_read_receive(&callid, &size)) {
    515                         ipc_answer_0(callid, EINVAL);
    516                         ipc_answer_0(rid, EINVAL);
     518                        async_answer_0(callid, EINVAL);
     519                        async_answer_0(rid, EINVAL);
    517520                        return;
    518521                }
     
    535538                        async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    536539                        free(desc);
    537                         ipc_answer_1(rid, EOK, 1);
     540                        async_answer_1(rid, EOK, 1);
    538541                        return;
    539542                }
     
    550553                                async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    551554                                free(desc);
    552                                 ipc_answer_1(rid, EOK, 1);
     555                                async_answer_1(rid, EOK, 1);
    553556                                return;
    554557                        }
     
    557560                }
    558561               
    559                 ipc_answer_0(callid, ENOENT);
    560                 ipc_answer_1(rid, ENOENT, 0);
     562                async_answer_0(callid, ENOENT);
     563                async_answer_1(rid, ENOENT, 0);
    561564                return;
    562565        }
     
    569572                size_t size;
    570573                if (!async_data_read_receive(&callid, &size)) {
    571                         ipc_answer_0(callid, EINVAL);
    572                         ipc_answer_0(rid, EINVAL);
     574                        async_answer_0(callid, EINVAL);
     575                        async_answer_0(rid, EINVAL);
    573576                        return;
    574577                }
     
    580583                        async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
    581584                        free(desc);
    582                         ipc_answer_1(rid, EOK, 1);
     585                        async_answer_1(rid, EOK, 1);
    583586                        return;
    584587                }
    585588               
    586589                free(desc);
    587                 ipc_answer_0(callid, ENOENT);
    588                 ipc_answer_1(rid, ENOENT, 0);
     590                async_answer_0(callid, ENOENT);
     591                async_answer_1(rid, ENOENT, 0);
    589592                return;
    590593        }
     
    601604                if (lnk == NULL) {
    602605                        fibril_mutex_unlock(&devices_mutex);
    603                         ipc_answer_0(rid, ENOENT);
     606                        async_answer_0(rid, ENOENT);
    604607                        return;
    605608                }
     
    611614                if (!async_data_read_receive(&callid, NULL)) {
    612615                        fibril_mutex_unlock(&devices_mutex);
    613                         ipc_answer_0(callid, EINVAL);
    614                         ipc_answer_0(rid, EINVAL);
     616                        async_answer_0(callid, EINVAL);
     617                        async_answer_0(rid, EINVAL);
    615618                        return;
    616619                }
     
    623626               
    624627                /* 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);
     628                async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    626629                fibril_mutex_unlock(&devices_mutex);
    627630               
     
    632635               
    633636                /* 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);
     637                async_answer_1(rid, rc, bytes);
     638                return;
     639        }
     640       
     641        async_answer_0(rid, ENOENT);
    639642}
    640643
     
    643646        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    644647        if (index == 0) {
    645                 ipc_answer_0(rid, ENOTSUP);
     648                async_answer_0(rid, ENOTSUP);
    646649                return;
    647650        }
     
    651654        if (type == DEV_HANDLE_NAMESPACE) {
    652655                /* Namespace directory */
    653                 ipc_answer_0(rid, ENOTSUP);
     656                async_answer_0(rid, ENOTSUP);
    654657                return;
    655658        }
     
    665668                if (lnk == NULL) {
    666669                        fibril_mutex_unlock(&devices_mutex);
    667                         ipc_answer_0(rid, ENOENT);
     670                        async_answer_0(rid, ENOENT);
    668671                        return;
    669672                }
     
    675678                if (!async_data_write_receive(&callid, NULL)) {
    676679                        fibril_mutex_unlock(&devices_mutex);
    677                         ipc_answer_0(callid, EINVAL);
    678                         ipc_answer_0(rid, EINVAL);
     680                        async_answer_0(callid, EINVAL);
     681                        async_answer_0(rid, EINVAL);
    679682                        return;
    680683                }
     
    687690               
    688691                /* 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);
     692                async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    690693               
    691694                fibril_mutex_unlock(&devices_mutex);
     
    697700               
    698701                /* 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);
     702                async_answer_1(rid, rc, bytes);
     703                return;
     704        }
     705       
     706        async_answer_0(rid, ENOENT);
    704707}
    705708
    706709void devfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    707710{
    708         ipc_answer_0(rid, ENOTSUP);
     711        async_answer_0(rid, ENOTSUP);
    709712}
    710713
     
    714717       
    715718        if (index == 0) {
    716                 ipc_answer_0(rid, EOK);
     719                async_answer_0(rid, EOK);
    717720                return;
    718721        }
     
    722725        if (type == DEV_HANDLE_NAMESPACE) {
    723726                /* Namespace directory */
    724                 ipc_answer_0(rid, EOK);
     727                async_answer_0(rid, EOK);
    725728                return;
    726729        }
     
    735738                if (lnk == NULL) {
    736739                        fibril_mutex_unlock(&devices_mutex);
    737                         ipc_answer_0(rid, ENOENT);
     740                        async_answer_0(rid, ENOENT);
    738741                        return;
    739742                }
     
    744747               
    745748                if (dev->refcount == 0) {
    746                         ipc_hangup(dev->phone);
     749                        async_hangup(dev->phone);
    747750                        hash_table_remove(&devices, key, DEVICES_KEYS);
    748751                }
     
    750753                fibril_mutex_unlock(&devices_mutex);
    751754               
    752                 ipc_answer_0(rid, EOK);
    753                 return;
    754         }
    755        
    756         ipc_answer_0(rid, ENOENT);
     755                async_answer_0(rid, EOK);
     756                return;
     757        }
     758       
     759        async_answer_0(rid, ENOENT);
    757760}
    758761
     
    762765       
    763766        if (index == 0) {
    764                 ipc_answer_0(rid, EOK);
     767                async_answer_0(rid, EOK);
    765768                return;
    766769        }
     
    770773        if (type == DEV_HANDLE_NAMESPACE) {
    771774                /* Namespace directory */
    772                 ipc_answer_0(rid, EOK);
     775                async_answer_0(rid, EOK);
    773776                return;
    774777        }
     
    783786                if (lnk == NULL) {
    784787                        fibril_mutex_unlock(&devices_mutex);
    785                         ipc_answer_0(rid, ENOENT);
     788                        async_answer_0(rid, ENOENT);
    786789                        return;
    787790                }
     
    802805               
    803806                /* 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);
     807                async_answer_0(rid, rc);
     808                return;
     809        }
     810       
     811        async_answer_0(rid, ENOENT);
    809812}
    810813
    811814void devfs_destroy(ipc_callid_t rid, ipc_call_t *request)
    812815{
    813         ipc_answer_0(rid, ENOTSUP);
     816        async_answer_0(rid, ENOTSUP);
    814817}
    815818
Note: See TracChangeset for help on using the changeset viewer.