Changeset fb7e5a9a in mainline


Ignore:
Timestamp:
2011-09-06T20:03:31Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
038b289, f7d6b30
Parents:
7a46bfe (diff), 7e9fce6 (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

Files:
6 added
25 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r7a46bfe rfb7e5a9a  
    103103        $(USPACE_PATH)/srv/fs/fat/fat \
    104104        $(USPACE_PATH)/srv/fs/mfs/mfs \
     105        $(USPACE_PATH)/srv/fs/cdfs/cdfs \
    105106        $(USPACE_PATH)/srv/fs/exfat/exfat \
    106107        $(USPACE_PATH)/srv/fs/ext2fs/ext2fs \
  • tools/toolchain.sh

    r7a46bfe rfb7e5a9a  
    5353EOF
    5454
    55 BINUTILS_VERSION="2.21"
     55BINUTILS_VERSION="2.21.1"
     56BINUTILS_RELEASE="a"
    5657GCC_VERSION="4.6.1"
    57 GDB_VERSION="7.2"
     58GDB_VERSION="7.3.1"
    5859
    5960BASEDIR="`pwd`"
    60 BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2"
     61BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2"
    6162GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2"
    6263GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2"
     
    273274        GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/"
    274275       
    275         download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "c84c5acc9d266f1a7044b51c85a823f5"
     276        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "bde820eac53fa3a8d8696667418557ad"
    276277        download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "0c0e7e35d2215e19de9c97efba507553"
    277278        download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "cbf0d4b701827922cf37ba6a4ace0079"
    278279        download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "0d75ca7ca35b1e7f252223f9d23a6ad1"
    279         download_fetch "${GDB_SOURCE}" "${GDB}" "64260e6c56979ee750a01055f16091a5"
     280        download_fetch "${GDB_SOURCE}" "${GDB}" "b89a5fac359c618dda97b88645ceab47"
    280281}
    281282
  • uspace/Makefile

    r7a46bfe rfb7e5a9a  
    8282        srv/fs/exfat \
    8383        srv/fs/fat \
     84        srv/fs/cdfs \
    8485        srv/fs/tmpfs \
    8586        srv/fs/mfs \
  • uspace/app/mkmfs/mkmfs.c

    r7a46bfe rfb7e5a9a  
    114114        int rc, c, opt_ind;
    115115        char *device_name;
    116         aoff64_t devblock_size;
     116        size_t devblock_size;
    117117
    118118        struct mfs_sb_info sb;
  • uspace/drv/test/test1/test1.c

    r7a46bfe rfb7e5a9a  
    4242static int test1_add_device(ddf_dev_t *dev);
    4343static int test1_dev_remove(ddf_dev_t *dev);
     44static int test1_dev_gone(ddf_dev_t *dev);
    4445static int test1_fun_online(ddf_fun_t *fun);
    4546static int test1_fun_offline(ddf_fun_t *fun);
     
    4849        .add_device = &test1_add_device,
    4950        .dev_remove = &test1_dev_remove,
     51        .dev_gone = &test1_dev_gone,
    5052        .fun_online = &test1_fun_online,
    5153        .fun_offline = &test1_fun_offline
     
    213215}
    214216
     217static int fun_unbind(ddf_fun_t *fun, const char *name)
     218{
     219        int rc;
     220
     221        ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
     222        rc = ddf_fun_unbind(fun);
     223        if (rc != EOK) {
     224                ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
     225                return rc;
     226        }
     227
     228        ddf_fun_destroy(fun);
     229        return EOK;
     230}
     231
    215232static int test1_dev_remove(ddf_dev_t *dev)
    216233{
     
    234251        if (test1->child != NULL) {
    235252                rc = fun_remove(test1->child, "child");
     253                if (rc != EOK)
     254                        return rc;
     255        }
     256
     257        return EOK;
     258}
     259
     260static int test1_dev_gone(ddf_dev_t *dev)
     261{
     262        test1_t *test1 = (test1_t *)dev->driver_data;
     263        int rc;
     264
     265        ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
     266
     267        if (test1->fun_a != NULL) {
     268                rc = fun_unbind(test1->fun_a, "a");
     269                if (rc != EOK)
     270                        return rc;
     271        }
     272
     273        if (test1->clone != NULL) {
     274                rc = fun_unbind(test1->clone, "clone");
     275                if (rc != EOK)
     276                        return rc;
     277        }
     278
     279        if (test1->child != NULL) {
     280                rc = fun_unbind(test1->child, "child");
    236281                if (rc != EOK)
    237282                        return rc;
  • uspace/drv/test/test2/test2.c

    r7a46bfe rfb7e5a9a  
    4242static int test2_add_device(ddf_dev_t *dev);
    4343static int test2_dev_remove(ddf_dev_t *dev);
     44static int test2_dev_gone(ddf_dev_t *dev);
    4445static int test2_fun_online(ddf_fun_t *fun);
    4546static int test2_fun_offline(ddf_fun_t *fun);
     
    4849        .add_device = &test2_add_device,
    4950        .dev_remove = &test2_dev_remove,
     51        .dev_gone = &test2_dev_gone,
    5052        .fun_online = &test2_fun_online,
    5153        .fun_offline = &test2_fun_offline
     
    111113}
    112114
    113 /** Add child devices after some sleep.
     115/** Simulate plugging and surprise unplugging.
    114116 *
    115117 * @param arg Parent device structure (ddf_dev_t *).
    116118 * @return Always EOK.
    117119 */
    118 static int postponed_birth(void *arg)
     120static int plug_unplug(void *arg)
    119121{
    120122        test2_t *test2 = (test2_t *) arg;
     
    144146        test2->fun_a = fun_a;
    145147
     148        async_usleep(10000000);
     149
     150        ddf_msg(LVL_NOTE, "Unbinding function test1.");
     151        ddf_fun_unbind(test2->test1);
     152        async_usleep(1000000);
     153        ddf_msg(LVL_NOTE, "Unbinding function child.");
     154        ddf_fun_unbind(test2->child);
     155
    146156        return EOK;
    147157}
     
    158168        }
    159169
     170        rc = ddf_fun_unbind(fun);
     171        if (rc != EOK) {
     172                ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
     173                return rc;
     174        }
     175
     176        ddf_fun_destroy(fun);
     177        return EOK;
     178}
     179
     180static int fun_unbind(ddf_fun_t *fun, const char *name)
     181{
     182        int rc;
     183
     184        ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
    160185        rc = ddf_fun_unbind(fun);
    161186        if (rc != EOK) {
     
    184209
    185210        if (str_cmp(dev->name, "child") != 0) {
    186                 fid_t postpone = fibril_create(postponed_birth, test2);
     211                fid_t postpone = fibril_create(plug_unplug, test2);
    187212                if (postpone == 0) {
    188213                        ddf_msg(LVL_ERROR, "fibril_create() failed.");
     
    232257}
    233258
     259static int test2_dev_gone(ddf_dev_t *dev)
     260{
     261        test2_t *test2 = (test2_t *)dev->driver_data;
     262        int rc;
     263
     264        ddf_msg(LVL_DEBUG, "test2_dev_gone(%p)", dev);
     265
     266        if (test2->fun_a != NULL) {
     267                rc = fun_unbind(test2->fun_a, "a");
     268                if (rc != EOK)
     269                        return rc;
     270        }
     271
     272        if (test2->fun_err != NULL) {
     273                rc = fun_unbind(test2->fun_err, "ERROR");
     274                if (rc != EOK)
     275                        return rc;
     276        }
     277
     278        if (test2->child != NULL) {
     279                rc = fun_unbind(test2->child, "child");
     280                if (rc != EOK)
     281                        return rc;
     282        }
     283
     284        if (test2->test1 != NULL) {
     285                rc = fun_unbind(test2->test1, "test1");
     286                if (rc != EOK)
     287                        return rc;
     288        }
     289
     290        return EOK;
     291}
     292
    234293
    235294static int test2_fun_online(ddf_fun_t *fun)
     
    248307{
    249308        printf(NAME ": HelenOS test2 virtual device driver\n");
    250         ddf_log_init(NAME, LVL_ERROR);
     309        ddf_log_init(NAME, LVL_NOTE);
    251310        return ddf_driver_main(&test2_driver);
    252311}
  • uspace/lib/block/libblock.c

    r7a46bfe rfb7e5a9a  
    9393static int get_block_size(async_sess_t *, size_t *);
    9494static int get_num_blocks(async_sess_t *, aoff64_t *);
    95 static int read_toc(async_sess_t *, uint8_t);
    9695static aoff64_t ba_ltop(devcon_t *, aoff64_t);
    9796
     
    896895 * @param service_id Service ID of the block device.
    897896 * @param session    Starting session.
    898  * @param data       Buffer to read TOC into.
    899  *
    900  * @return EOK on success.
    901  * @return Error code on failure.
    902  *
    903  */
    904 int block_get_toc(service_id_t service_id, uint8_t session, void *data)
     897 *
     898 * @return Allocated TOC structure.
     899 * @return NULL on failure.
     900 *
     901 */
     902toc_block_t *block_get_toc(service_id_t service_id, uint8_t session)
    905903{
    906904        devcon_t *devcon = devcon_search(service_id);
    907905        assert(devcon);
    908906       
     907        toc_block_t *toc = NULL;
     908       
    909909        fibril_mutex_lock(&devcon->comm_area_lock);
    910910       
    911         int rc = read_toc(devcon->sess, session);
    912         if (rc == EOK)
    913                 memcpy(data, devcon->comm_area, devcon->pblock_size);
     911        async_exch_t *exch = async_exchange_begin(devcon->sess);
     912        int rc = async_req_1_0(exch, BD_READ_TOC, session);
     913        async_exchange_end(exch);
     914       
     915        if (rc == EOK) {
     916                toc = (toc_block_t *) malloc(sizeof(toc_block_t));
     917                if (toc != NULL) {
     918                        memset(toc, 0, sizeof(toc_block_t));
     919                        memcpy(toc, devcon->comm_area,
     920                            min(devcon->pblock_size, sizeof(toc_block_t)));
     921                }
     922        }
     923       
    914924       
    915925        fibril_mutex_unlock(&devcon->comm_area_lock);
    916926       
    917         return rc;
     927        return toc;
    918928}
    919929
     
    10081018}
    10091019
    1010 /** Get TOC from block device. */
    1011 static int read_toc(async_sess_t *sess, uint8_t session)
    1012 {
    1013         async_exch_t *exch = async_exchange_begin(sess);
    1014         int rc = async_req_1_0(exch, BD_READ_TOC, session);
    1015         async_exchange_end(exch);
    1016 
    1017         return rc;
    1018 }
    1019 
    10201020/** Convert logical block address to physical block address. */
    10211021static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
  • uspace/lib/block/libblock.h

    r7a46bfe rfb7e5a9a  
    9797};
    9898
     99typedef struct {
     100        uint16_t size;
     101        uint8_t first_session;
     102        uint8_t last_session;
     103       
     104        uint8_t res0;
     105        uint8_t adr_ctrl;
     106        uint8_t first_track;
     107        uint8_t res1;
     108       
     109        uint32_t first_lba;
     110} __attribute__((packed)) toc_block_t;
     111
    99112extern int block_init(exch_mgmt_t, service_id_t, size_t);
    100113extern void block_fini(service_id_t);
     
    114127extern int block_get_bsize(service_id_t, size_t *);
    115128extern int block_get_nblocks(service_id_t, aoff64_t *);
    116 extern int block_get_toc(service_id_t, uint8_t, void *);
     129extern toc_block_t *block_get_toc(service_id_t, uint8_t);
    117130extern int block_read_direct(service_id_t, aoff64_t, size_t, void *);
    118131extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
     
    123136/** @}
    124137 */
    125 
  • uspace/lib/c/generic/str.c

    r7a46bfe rfb7e5a9a  
    12911291}
    12921292
     1293/** Convert string to uint8_t.
     1294 *
     1295 * @param nptr   Pointer to string.
     1296 * @param endptr If not NULL, pointer to the first invalid character
     1297 *               is stored here.
     1298 * @param base   Zero or number between 2 and 36 inclusive.
     1299 * @param strict Do not allow any trailing characters.
     1300 * @param result Result of the conversion.
     1301 *
     1302 * @return EOK if conversion was successful.
     1303 *
     1304 */
     1305int str_uint8_t(const char *nptr, char **endptr, unsigned int base,
     1306    bool strict, uint8_t *result)
     1307{
     1308        assert(result != NULL);
     1309       
     1310        bool neg;
     1311        char *lendptr;
     1312        uint64_t res;
     1313        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1314       
     1315        if (endptr != NULL)
     1316                *endptr = (char *) lendptr;
     1317       
     1318        if (ret != EOK)
     1319                return ret;
     1320       
     1321        /* Do not allow negative values */
     1322        if (neg)
     1323                return EINVAL;
     1324       
     1325        /* Check whether we are at the end of
     1326           the string in strict mode */
     1327        if ((strict) && (*lendptr != 0))
     1328                return EINVAL;
     1329       
     1330        /* Check for overflow */
     1331        uint8_t _res = (uint8_t) res;
     1332        if (_res != res)
     1333                return EOVERFLOW;
     1334       
     1335        *result = _res;
     1336       
     1337        return EOK;
     1338}
     1339
     1340/** Convert string to uint16_t.
     1341 *
     1342 * @param nptr   Pointer to string.
     1343 * @param endptr If not NULL, pointer to the first invalid character
     1344 *               is stored here.
     1345 * @param base   Zero or number between 2 and 36 inclusive.
     1346 * @param strict Do not allow any trailing characters.
     1347 * @param result Result of the conversion.
     1348 *
     1349 * @return EOK if conversion was successful.
     1350 *
     1351 */
     1352int str_uint16_t(const char *nptr, char **endptr, unsigned int base,
     1353    bool strict, uint16_t *result)
     1354{
     1355        assert(result != NULL);
     1356       
     1357        bool neg;
     1358        char *lendptr;
     1359        uint64_t res;
     1360        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1361       
     1362        if (endptr != NULL)
     1363                *endptr = (char *) lendptr;
     1364       
     1365        if (ret != EOK)
     1366                return ret;
     1367       
     1368        /* Do not allow negative values */
     1369        if (neg)
     1370                return EINVAL;
     1371       
     1372        /* Check whether we are at the end of
     1373           the string in strict mode */
     1374        if ((strict) && (*lendptr != 0))
     1375                return EINVAL;
     1376       
     1377        /* Check for overflow */
     1378        uint16_t _res = (uint16_t) res;
     1379        if (_res != res)
     1380                return EOVERFLOW;
     1381       
     1382        *result = _res;
     1383       
     1384        return EOK;
     1385}
     1386
     1387/** Convert string to uint32_t.
     1388 *
     1389 * @param nptr   Pointer to string.
     1390 * @param endptr If not NULL, pointer to the first invalid character
     1391 *               is stored here.
     1392 * @param base   Zero or number between 2 and 36 inclusive.
     1393 * @param strict Do not allow any trailing characters.
     1394 * @param result Result of the conversion.
     1395 *
     1396 * @return EOK if conversion was successful.
     1397 *
     1398 */
     1399int str_uint32_t(const char *nptr, char **endptr, unsigned int base,
     1400    bool strict, uint32_t *result)
     1401{
     1402        assert(result != NULL);
     1403       
     1404        bool neg;
     1405        char *lendptr;
     1406        uint64_t res;
     1407        int ret = str_uint(nptr, &lendptr, base, &neg, &res);
     1408       
     1409        if (endptr != NULL)
     1410                *endptr = (char *) lendptr;
     1411       
     1412        if (ret != EOK)
     1413                return ret;
     1414       
     1415        /* Do not allow negative values */
     1416        if (neg)
     1417                return EINVAL;
     1418       
     1419        /* Check whether we are at the end of
     1420           the string in strict mode */
     1421        if ((strict) && (*lendptr != 0))
     1422                return EINVAL;
     1423       
     1424        /* Check for overflow */
     1425        uint32_t _res = (uint32_t) res;
     1426        if (_res != res)
     1427                return EOVERFLOW;
     1428       
     1429        *result = _res;
     1430       
     1431        return EOK;
     1432}
     1433
    12931434/** Convert string to uint64_t.
    12941435 *
  • uspace/lib/c/include/ipc/devman.h

    r7a46bfe rfb7e5a9a  
    147147        DRIVER_DEV_ADD = IPC_FIRST_USER_METHOD,
    148148        DRIVER_DEV_REMOVE,
     149        DRIVER_DEV_GONE,
    149150        DRIVER_FUN_ONLINE,
    150151        DRIVER_FUN_OFFLINE,
    151 
    152152} devman_to_driver_t;
    153153
  • uspace/lib/c/include/str.h

    r7a46bfe rfb7e5a9a  
    9797extern char *str_ndup(const char *, size_t max_size);
    9898
     99extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *);
     100extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *);
     101extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *);
    99102extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *);
    100103extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
  • uspace/lib/drv/generic/driver.c

    r7a46bfe rfb7e5a9a  
    333333}
    334334
     335static void driver_dev_gone(ipc_callid_t iid, ipc_call_t *icall)
     336{
     337        devman_handle_t devh;
     338        ddf_dev_t *dev;
     339        int rc;
     340       
     341        devh = IPC_GET_ARG1(*icall);
     342       
     343        fibril_mutex_lock(&devices_mutex);
     344        dev = driver_get_device(devh);
     345        if (dev != NULL)
     346                dev_add_ref(dev);
     347        fibril_mutex_unlock(&devices_mutex);
     348       
     349        if (dev == NULL) {
     350                async_answer_0(iid, ENOENT);
     351                return;
     352        }
     353       
     354        if (driver->driver_ops->dev_gone != NULL)
     355                rc = driver->driver_ops->dev_gone(dev);
     356        else
     357                rc = ENOTSUP;
     358       
     359        if (rc == EOK)
     360                dev_del_ref(dev);
     361       
     362        async_answer_0(iid, (sysarg_t) rc);
     363}
     364
    335365static void driver_fun_online(ipc_callid_t iid, ipc_call_t *icall)
    336366{
     
    423453                case DRIVER_DEV_REMOVE:
    424454                        driver_dev_remove(callid, &call);
     455                        break;
     456                case DRIVER_DEV_GONE:
     457                        driver_dev_gone(callid, &call);
    425458                        break;
    426459                case DRIVER_FUN_ONLINE:
  • uspace/lib/drv/include/ddf/driver.h

    r7a46bfe rfb7e5a9a  
    139139        /** Ask driver to remove a device */
    140140        int (*dev_remove)(ddf_dev_t *);
     141        /** Inform driver a device disappeared */
     142        int (*dev_gone)(ddf_dev_t *);
    141143        /** Ask driver to online a specific function */
    142144        int (*fun_online)(ddf_fun_t *);
  • uspace/lib/fs/libfs.c

    r7a46bfe rfb7e5a9a  
    837837        stat.is_directory = ops->is_directory(fn);
    838838        stat.size = ops->size_get(fn);
    839         stat.service = ops->device_get(fn);
     839        stat.service = ops->service_get(fn);
    840840       
    841841        ops->node_put(fn);
  • uspace/lib/fs/libfs.h

    r7a46bfe rfb7e5a9a  
    9292        bool (* is_directory)(fs_node_t *);
    9393        bool (* is_file)(fs_node_t *);
    94         service_id_t (* device_get)(fs_node_t *);
     94        service_id_t (* service_get)(fs_node_t *);
    9595} libfs_ops_t;
    9696
  • uspace/srv/devman/devman.c

    r7a46bfe rfb7e5a9a  
    878878       
    879879        return retval;
    880 
     880}
     881
     882int driver_dev_gone(dev_tree_t *tree, dev_node_t *dev)
     883{
     884        async_exch_t *exch;
     885        sysarg_t retval;
     886        driver_t *drv;
     887        devman_handle_t handle;
     888       
     889        assert(dev != NULL);
     890       
     891        log_msg(LVL_DEBUG, "driver_dev_gone(%p)", dev);
     892       
     893        fibril_rwlock_read_lock(&tree->rwlock);
     894        drv = dev->drv;
     895        handle = dev->handle;
     896        fibril_rwlock_read_unlock(&tree->rwlock);
     897       
     898        exch = async_exchange_begin(drv->sess);
     899        retval = async_req_1_0(exch, DRIVER_DEV_GONE, handle);
     900        async_exchange_end(exch);
     901       
     902        return retval;
    881903}
    882904
  • uspace/srv/devman/devman.h

    r7a46bfe rfb7e5a9a  
    263263extern bool start_driver(driver_t *);
    264264extern int driver_dev_remove(dev_tree_t *, dev_node_t *);
     265extern int driver_dev_gone(dev_tree_t *, dev_node_t *);
    265266extern int driver_fun_online(dev_tree_t *, fun_node_t *);
    266267extern int driver_fun_offline(dev_tree_t *, fun_node_t *);
  • uspace/srv/devman/main.c

    r7a46bfe rfb7e5a9a  
    316316                if (fun->child != NULL) {
    317317                        dev_node_t *dev = fun->child;
     318                        device_state_t dev_state;
    318319                       
    319320                        dev_add_ref(dev);
     321                        dev_state = dev->state;
     322                       
    320323                        fibril_rwlock_write_unlock(&device_tree.rwlock);
    321                        
     324
    322325                        /* If device is owned by driver, ask driver to give it up. */
    323                         if (dev->state == DEVICE_USABLE) {
     326                        if (dev_state == DEVICE_USABLE) {
    324327                                rc = driver_dev_remove(&device_tree, dev);
    325328                                if (rc != EOK) {
     
    333336                        if (!list_empty(&dev->functions)) {
    334337                                fibril_rwlock_read_unlock(&device_tree.rwlock);
     338                                dev_del_ref(dev);
    335339                                return EIO;
    336340                        }
     341                       
    337342                        driver_t *driver = dev->drv;
    338343                        fibril_rwlock_read_unlock(&device_tree.rwlock);
     
    507512        fun_node_t *fun;
    508513        int rc;
    509 
    510         printf("devman_drv_fun_online()\n");
     514       
     515        log_msg(LVL_DEBUG, "devman_drv_fun_online()");
     516       
    511517        fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall));
    512518        if (fun == NULL) {
     
    526532        rc = online_function(fun);
    527533        if (rc != EOK) {
    528                 printf("devman_drv_fun_online() online_fun->ERROR\n");
    529534                fun_del_ref(fun);
    530535                async_answer_0(iid, (sysarg_t) rc);
     
    533538       
    534539        fun_del_ref(fun);
    535         printf("devman_drv_fun_online() online_fun->OK\n");
    536540       
    537541        async_answer_0(iid, (sysarg_t) EOK);
     
    580584        int rc;
    581585       
    582        
    583586        fun_node_t *fun = find_fun_node(&device_tree, fun_handle);
    584587        if (fun == NULL) {
     
    599602       
    600603        if (fun->ftype == fun_inner) {
    601                 /* Handle possible descendants */
    602                 /* TODO - This is a surprise removal */
     604                /* This is a surprise removal. Handle possible descendants */
    603605                if (fun->child != NULL) {
    604                         log_msg(LVL_WARN, "devman_remove_function(): not handling "
    605                             "descendants\n");
     606                        dev_node_t *dev = fun->child;
     607                        device_state_t dev_state;
     608                        int gone_rc;
     609                       
     610                        dev_add_ref(dev);
     611                        dev_state = dev->state;
     612                       
     613                        fibril_rwlock_write_unlock(&device_tree.rwlock);
     614                       
     615                        /* If device is owned by driver, inform driver it is gone. */
     616                        if (dev_state == DEVICE_USABLE)
     617                                gone_rc = driver_dev_gone(&device_tree, dev);
     618                        else
     619                                gone_rc = EOK;
     620                       
     621                        fibril_rwlock_read_lock(&device_tree.rwlock);
     622                       
     623                        /* Verify that driver succeeded and removed all functions */
     624                        if (gone_rc != EOK || !list_empty(&dev->functions)) {
     625                                log_msg(LVL_ERROR, "Driver did not remove "
     626                                    "functions for device that is gone. "
     627                                    "Device node is now defunct.");
     628                               
     629                                /*
     630                                 * Not much we can do but mark the device
     631                                 * node as having invalid state. This
     632                                 * is a driver bug.
     633                                 */
     634                                dev->state = DEVICE_INVALID;
     635                                fibril_rwlock_read_unlock(&device_tree.rwlock);
     636                                dev_del_ref(dev);
     637                                return;
     638                        }
     639                       
     640                        driver_t *driver = dev->drv;
     641                        fibril_rwlock_read_unlock(&device_tree.rwlock);
     642                       
     643                        if (driver)
     644                                detach_driver(&device_tree, dev);
     645                       
     646                        fibril_rwlock_write_lock(&device_tree.rwlock);
     647                        remove_dev_node(&device_tree, dev);
     648                       
     649                        /* Delete ref created when node was inserted */
     650                        dev_del_ref(dev);
     651                        /* Delete ref created by dev_add_ref(dev) above */
     652                        dev_del_ref(dev);
    606653                }
    607654        } else {
  • uspace/srv/fs/exfat/exfat_ops.c

    r7a46bfe rfb7e5a9a  
    8787static bool exfat_is_directory(fs_node_t *);
    8888static bool exfat_is_file(fs_node_t *node);
    89 static service_id_t exfat_device_get(fs_node_t *node);
     89static service_id_t exfat_service_get(fs_node_t *node);
    9090
    9191/*
     
    898898}
    899899
    900 service_id_t exfat_device_get(fs_node_t *node)
     900service_id_t exfat_service_get(fs_node_t *node)
    901901{
    902902        return 0;
     
    921921        .is_directory = exfat_is_directory,
    922922        .is_file = exfat_is_file,
    923         .device_get = exfat_device_get
     923        .service_get = exfat_service_get
    924924};
    925925
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    r7a46bfe rfb7e5a9a  
    112112static bool ext2fs_is_directory(fs_node_t *);
    113113static bool ext2fs_is_file(fs_node_t *node);
    114 static service_id_t ext2fs_device_get(fs_node_t *node);
     114static service_id_t ext2fs_service_get(fs_node_t *node);
    115115
    116116/*
     
    557557}
    558558
    559 service_id_t ext2fs_device_get(fs_node_t *fn)
     559service_id_t ext2fs_service_get(fs_node_t *fn)
    560560{
    561561        EXT2FS_DBG("");
     
    581581        .is_directory = ext2fs_is_directory,
    582582        .is_file = ext2fs_is_file,
    583         .device_get = ext2fs_device_get
     583        .service_get = ext2fs_service_get
    584584};
    585585
  • uspace/srv/fs/fat/fat_ops.c

    r7a46bfe rfb7e5a9a  
    9090static bool fat_is_directory(fs_node_t *);
    9191static bool fat_is_file(fs_node_t *node);
    92 static service_id_t fat_device_get(fs_node_t *node);
     92static service_id_t fat_service_get(fs_node_t *node);
    9393
    9494/*
     
    838838}
    839839
    840 service_id_t fat_device_get(fs_node_t *node)
     840service_id_t fat_service_get(fs_node_t *node)
    841841{
    842842        return 0;
     
    860860        .is_directory = fat_is_directory,
    861861        .is_file = fat_is_file,
    862         .device_get = fat_device_get
     862        .service_get = fat_service_get
    863863};
    864864
  • uspace/srv/fs/locfs/locfs_ops.c

    r7a46bfe rfb7e5a9a  
    418418}
    419419
    420 static service_id_t locfs_device_get(fs_node_t *fn)
     420static service_id_t locfs_service_get(fs_node_t *fn)
    421421{
    422422        locfs_node_t *node = (locfs_node_t *) fn->data;
     
    445445        .is_directory = locfs_is_directory,
    446446        .is_file = locfs_is_file,
    447         .device_get = locfs_device_get
     447        .service_get = locfs_service_get
    448448};
    449449
  • uspace/srv/fs/mfs/mfs_ops.c

    r7a46bfe rfb7e5a9a  
    5555static int mfs_has_children(bool *has_children, fs_node_t *fsnode);
    5656static int mfs_root_get(fs_node_t **rfn, service_id_t service_id);
    57 static service_id_t mfs_device_get(fs_node_t *fsnode);
     57static service_id_t mfs_service_get(fs_node_t *fsnode);
    5858static aoff64_t mfs_size_get(fs_node_t *node);
    5959static int mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component);
     
    8181        .size_get = mfs_size_get,
    8282        .root_get = mfs_root_get,
    83         .device_get = mfs_device_get,
     83        .service_get = mfs_service_get,
    8484        .is_directory = mfs_is_directory,
    8585        .is_file = mfs_is_file,
     
    325325}
    326326
    327 service_id_t mfs_device_get(fs_node_t *fsnode)
     327service_id_t mfs_service_get(fs_node_t *fsnode)
    328328{
    329329        struct mfs_node *node = fsnode->data;
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r7a46bfe rfb7e5a9a  
    114114}
    115115
    116 static service_id_t tmpfs_device_get(fs_node_t *fn)
     116static service_id_t tmpfs_service_get(fs_node_t *fn)
    117117{
    118118        return 0;
     
    136136        .is_directory = tmpfs_is_directory,
    137137        .is_file = tmpfs_is_file,
    138         .device_get = tmpfs_device_get
     138        .service_get = tmpfs_service_get
    139139};
    140140
  • uspace/srv/loc/loc.c

    r7a46bfe rfb7e5a9a  
    12771277        categ_dir_add_cat(&cdir, cat);
    12781278
     1279        cat = category_new("test3");
     1280        categ_dir_add_cat(&cdir, cat);
     1281
    12791282        cat = category_new("usbhc");
    12801283        categ_dir_add_cat(&cdir, cat);
    12811284
     1285        cat = category_new("virt-null");
     1286        categ_dir_add_cat(&cdir, cat);
     1287
    12821288        cat = category_new("virtual");
    12831289        categ_dir_add_cat(&cdir, cat);
     1290
    12841291
    12851292        return true;
Note: See TracChangeset for help on using the changeset viewer.