Changes in / [f2f4c00:1f1fa64] in mainline


Ignore:
Location:
uspace
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nic/nic.c

    rf2f4c00 r1f1fa64  
    226226                }
    227227
    228                 printf("%zu: %s\n", i, svc_name);
     228                printf("%d: %s\n", i, svc_name);
    229229                printf("\tMAC address: %s\n", addr_str);
    230230                printf("\tVendor name: %s\n",
  • uspace/drv/block/ata_bd/Makefile

    rf2f4c00 r1f1fa64  
    2828
    2929USPACE_PREFIX = ../../..
    30 LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBSCSI_PREFIX)/libscsi.a
    31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBSCSI_PREFIX)/include
     30LIBS = $(LIBDRV_PREFIX)/libdrv.a
     31EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
    3232BINARY = ata_bd
    3333
  • uspace/drv/block/ata_bd/ata_bd.c

    rf2f4c00 r1f1fa64  
    5454#include <bd_srv.h>
    5555#include <fibril_synch.h>
    56 #include <scsi/sbc.h>
    5756#include <stdint.h>
    5857#include <str.h>
     
    104103static int ata_identify_pkt_dev(disk_t *disk, void *buf);
    105104static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
    106     void *obuf, size_t obuf_size, size_t *rcvd_size);
    107 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
    108     size_t *rcvd_size);
     105    void *obuf, size_t obuf_size);
     106static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size);
    109107static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
    110108    void *obuf, size_t obuf_size);
    111 static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
    112     size_t *block_size);
    113109static int ata_pcmd_read_toc(disk_t *disk, uint8_t ses,
    114110    void *obuf, size_t obuf_size);
     
    344340        uint8_t model[40];
    345341        ata_inquiry_data_t inq_data;
    346         size_t isize;
    347342        uint16_t w;
    348343        uint8_t c;
    349344        uint16_t bc;
    350         uint64_t nblocks;
    351         size_t block_size;
    352345        size_t pos, len;
    353346        int rc;
     
    464457        if (d->dev_type == ata_pkt_dev) {
    465458                /* Send inquiry. */
    466                 rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data), &isize);
    467                 if (rc != EOK || isize < sizeof(inq_data)) {
     459                rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data));
     460                if (rc != EOK) {
    468461                        ddf_msg(LVL_ERROR, "Device inquiry failed.");
    469462                        d->present = false;
     
    475468                        ddf_msg(LVL_WARN, "Peripheral device type is not CD-ROM.");
    476469
    477                 rc = ata_pcmd_read_capacity(d, &nblocks, &block_size);
    478                 if (rc != EOK) {
    479                         ddf_msg(LVL_ERROR, "Read capacity command failed.");
    480                         d->present = false;
    481                         return EIO;
    482                 }
    483 
    484                 d->blocks = nblocks;
    485                 d->block_size = block_size;
     470                /* Assume 2k block size for now. */
     471                d->block_size = 2048;
    486472        } else {
    487473                /* Assume register Read always uses 512-byte blocks. */
     
    736722 * @param obuf          Buffer for storing data read from device
    737723 * @param obuf_size     Size of obuf in bytes
    738  * @param rcvd_size     Place to store number of bytes read or @c NULL
    739724 *
    740725 * @return EOK on success, EIO on error.
    741726 */
    742727static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
    743     void *obuf, size_t obuf_size, size_t *rcvd_size)
     728    void *obuf, size_t obuf_size)
    744729{
    745730        ata_ctrl_t *ctrl = disk->ctrl;
     
    815800                return EIO;
    816801
    817         if (rcvd_size != NULL)
    818                 *rcvd_size = data_size;
    819802        return EOK;
    820803}
     
    828811 * @return EOK on success, EIO on error.
    829812 */
    830 static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
    831     size_t *rcvd_size)
     813static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size)
    832814{
    833815        ata_pcmd_inquiry_t cp;
     
    839821        cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */
    840822
    841         rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, rcvd_size);
     823        rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size);
    842824        if (rc != EOK)
    843825                return rc;
    844 
    845         return EOK;
    846 }
    847 
    848 /** Issue ATAPI read capacity(10) command.
    849  *
    850  * @param disk          Disk
    851  * @param nblocks       Place to store number of blocks
    852  * @param block_size    Place to store block size
    853  *
    854  * @return EOK on success, EIO on error.
    855  */
    856 static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
    857     size_t *block_size)
    858 {
    859         scsi_cdb_read_capacity_10_t cdb;
    860         scsi_read_capacity_10_data_t data;
    861         size_t rsize;
    862         int rc;
    863 
    864         memset(&cdb, 0, sizeof(cdb));
    865         cdb.op_code = SCSI_CMD_READ_CAPACITY_10;
    866 
    867         rc = ata_cmd_packet(disk, &cdb, sizeof(cdb), &data, sizeof(data), &rsize);
    868         if (rc != EOK)
    869                 return rc;
    870 
    871         if (rsize != sizeof(data))
    872                 return EIO;
    873 
    874         *nblocks = uint32_t_be2host(data.last_lba) + 1;
    875         *block_size = uint32_t_be2host(data.block_size);
    876826
    877827        return EOK;
     
    906856        cp.nblocks = host2uint32_t_be(cnt);
    907857
    908         rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, NULL);
     858        rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size);
    909859        if (rc != EOK)
    910860                return rc;
     
    945895        cp.oldformat = 0x40; /* 0x01 = multi-session mode (shifted to MSB) */
    946896       
    947         rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size, NULL);
     897        rc = ata_cmd_packet(disk, &cp, sizeof(cp), obuf, obuf_size);
    948898        if (rc != EOK)
    949899                return rc;
  • uspace/drv/bus/isa/isa.dev

    rf2f4c00 r1f1fa64  
    1414        irq 12
    1515        io_range 060 5
    16 
    17 ne2k:
    18         match 100 isa/ne2k
    19         irq 5
    20         io_range 300 20
    21 
    22 sb16:
    23         match 100 isa/sb16
    24         io_range 220 20
    25         io_range 330 2
    26         irq 5
    27         dma 1
    28         dma 5
    2916
    3017cmos-rtc:
  • uspace/lib/block/block.c

    rf2f4c00 r1f1fa64  
    5555#include "block.h"
    5656
    57 #define MAX_WRITE_RETRIES 10
    58 
    5957/** Lock protecting the device connection list */
    6058static FIBRIL_MUTEX_INITIALIZE(dcl_lock);
     
    8179        void *bb_buf;
    8280        aoff64_t bb_addr;
    83         aoff64_t pblocks;    /**< Number of physical blocks */
    8481        size_t pblock_size;  /**< Physical block size. */
    8582        cache_t *cache;
     
    106103
    107104static int devcon_add(service_id_t service_id, async_sess_t *sess,
    108     size_t bsize, aoff64_t dev_size, bd_t *bd)
     105    size_t bsize, bd_t *bd)
    109106{
    110107        devcon_t *devcon;
     
    121118        devcon->bb_addr = 0;
    122119        devcon->pblock_size = bsize;
    123         devcon->pblocks = dev_size;
    124120        devcon->cache = NULL;
    125121       
     
    168164                return rc;
    169165        }
    170 
    171         aoff64_t dev_size;
    172         rc = bd_get_num_blocks(bd, &dev_size);
    173         if (rc != EOK) {
    174                 bd_close(bd);
    175                 async_hangup(sess);
    176                 return rc;
    177         }
    178        
    179         rc = devcon_add(service_id, sess, bsize, dev_size, bd);
     166       
     167        rc = devcon_add(service_id, sess, bsize, bd);
    180168        if (rc != EOK) {
    181169                bd_close(bd);
     
    361349        fibril_mutex_initialize(&b->lock);
    362350        b->refcnt = 1;
    363         b->write_failures = 0;
    364351        b->dirty = false;
    365352        b->toxic = false;
     
    386373        block_t *b;
    387374        link_t *link;
    388         aoff64_t p_ba;
     375
    389376        int rc;
    390377       
     
    395382       
    396383        cache = devcon->cache;
    397 
    398         /* Check whether the logical block (or part of it) is beyond
    399          * the end of the device or not.
    400          */
    401         p_ba = ba_ltop(devcon, ba);
    402         p_ba += cache->blocks_cluster;
    403         if (p_ba >= devcon->pblocks) {
    404                 /* This request cannot be satisfied */
    405                 return EIO;
    406         }
    407 
    408384
    409385retry:
     
    482458                                         * another block next time.
    483459                                         */
    484                                         if (b->write_failures < MAX_WRITE_RETRIES) {
    485                                                 b->write_failures++;
    486                                                 fibril_mutex_unlock(&b->lock);
    487                                                 goto retry;
    488                                         } else {
    489                                                 printf("Too many errors writing block %"
    490                                                     PRIuOFF64 "from device handle %" PRIun "\n"
    491                                                     "SEVERE DATA LOSS POSSIBLE\n",
    492                                                     b->lba, devcon->service_id);
    493                                         }
    494                                 } else
    495                                         b->write_failures = 0;
    496 
     460                                        fibril_mutex_unlock(&b->lock);
     461                                        goto retry;
     462                                }
    497463                                b->dirty = false;
    498464                                if (!fibril_mutex_trylock(&cache->lock)) {
     
    611577                rc = write_blocks(devcon, block->pba, cache->blocks_cluster,
    612578                    block->data, block->size);
    613                 if (rc == EOK)
    614                         block->write_failures = 0;
    615579                block->dirty = false;
    616580        }
     
    638602                                 */
    639603                                block->refcnt++;
    640 
    641                                 if (block->write_failures < MAX_WRITE_RETRIES) {
    642                                         block->write_failures++;
    643                                         fibril_mutex_unlock(&block->lock);
    644                                         fibril_mutex_unlock(&cache->lock);
    645                                         goto retry;
    646                                 } else {
    647                                         printf("Too many errors writing block %"
    648                                             PRIuOFF64 "from device handle %" PRIun "\n"
    649                                             "SEVERE DATA LOSS POSSIBLE\n",
    650                                             block->lba, devcon->service_id);
    651                                 }
     604                                fibril_mutex_unlock(&block->lock);
     605                                fibril_mutex_unlock(&cache->lock);
     606                                goto retry;
    652607                        }
    653608                        /*
     
    815770        devcon_t *devcon = devcon_search(service_id);
    816771        assert(devcon);
    817 
     772       
    818773        return bd_get_num_blocks(devcon->bd, nblocks);
    819774}
  • uspace/lib/block/block.h

    rf2f4c00 r1f1fa64  
    8181        /** Size of the block. */
    8282        size_t size;
    83         /** Number of write failures. */
    84         int write_failures;
    8583        /** Link for placing the block into the free block list. */
    8684        link_t free_link;
  • uspace/lib/c/generic/adt/hash_table.c

    rf2f4c00 r1f1fa64  
    370370                         */
    371371                        if (!f(cur_link, arg))
    372                                 goto out;
    373                 }
    374         }
    375 out:
     372                                return;
     373                }
     374        }
     375       
    376376        h->apply_ongoing = false;
    377377       
  • uspace/lib/mbr/libmbr.c

    rf2f4c00 r1f1fa64  
    9090mbr_t *mbr_alloc_mbr(void)
    9191{
    92         return (mbr_t *)alloc_br();
     92        return malloc(sizeof(mbr_t));
    9393}
    9494
  • uspace/lib/mbr/libmbr.h

    rf2f4c00 r1f1fa64  
    3737#define LIBMBR_LIBMBR_H_
    3838
    39 #include <adt/list.h>
    40 #include <loc.h>
    4139#include <sys/types.h>
    4240#include "mbr.h"
  • uspace/srv/fs/cdfs/cdfs_ops.c

    rf2f4c00 r1f1fa64  
    249249        cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
    250250       
    251         if (node->type == CDFS_DIRECTORY) {
    252                 link_t *link;
    253                 while ((link = list_first(&node->cs_list)) != NULL) {
    254                         cdfs_dentry_t *dentry = list_get_instance(link, cdfs_dentry_t, link);
    255                         list_remove(&dentry->link);
    256                         free(dentry);
    257                 }
     251        assert(node->type == CDFS_DIRECTORY);
     252       
     253        link_t *link;
     254        while ((link = list_first(&node->cs_list)) != NULL) {
     255                cdfs_dentry_t *dentry = list_get_instance(link, cdfs_dentry_t, link);
     256                list_remove(&dentry->link);
     257                free(dentry);
    258258        }
    259259       
  • uspace/srv/net/ethip/ethip_nic.c

    rf2f4c00 r1f1fa64  
    309309                        break;
    310310                default:
    311                         log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %d", (int) IPC_GET_IMETHOD(call));
     311                        log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %d", IPC_GET_IMETHOD(call));
    312312                        async_answer_0(callid, ENOTSUP);
    313313                }
Note: See TracChangeset for help on using the changeset viewer.