Changeset d061efe in mainline


Ignore:
Timestamp:
2009-08-31T21:55:50Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d01790
Parents:
cfa8738 (diff), 00b1d20e (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 MBR partition driver.

Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rcfa8738 rd061efe  
    5252        $(USPACEDIR)/srv/fs/fat/fat \
    5353        $(USPACEDIR)/srv/bd/ata_bd/ata_bd \
    54         $(USPACEDIR)/srv/bd/file_bd/file_bd
     54        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     55        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    5556
    5657RD_APPS = \
  • boot/arch/arm32/loader/Makefile

    rcfa8738 rd061efe  
    9393        $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
    9494        $(USPACEDIR)/srv/fs/fat/fat \
    95         $(USPACEDIR)/srv/bd/file_bd/file_bd
     95        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     96        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    9697ifeq ($(MACHINE),testarm)
    9798        RD_SRVS += \
  • boot/arch/ia32/Makefile.inc

    rcfa8738 rd061efe  
    5252        $(USPACEDIR)/srv/fs/fat/fat \
    5353        $(USPACEDIR)/srv/bd/ata_bd/ata_bd \
    54         $(USPACEDIR)/srv/bd/file_bd/file_bd
     54        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     55        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    5556
    5657RD_APPS = \
  • boot/arch/ia64/loader/Makefile

    rcfa8738 rd061efe  
    104104        $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
    105105        $(USPACEDIR)/srv/fs/fat/fat \
    106         $(USPACEDIR)/srv/bd/file_bd/file_bd
     106        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     107        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    107108
    108109RD_APPS = \
  • boot/arch/mips32/loader/Makefile

    rcfa8738 rd061efe  
    106106        $(USPACEDIR)/srv/fs/fat/fat \
    107107        $(USPACEDIR)/srv/bd/file_bd/file_bd \
    108         $(USPACEDIR)/srv/bd/gxe_bd/gxe_bd
     108        $(USPACEDIR)/srv/bd/gxe_bd/gxe_bd \
     109        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    109110
    110111RD_APPS = \
  • boot/arch/ppc32/loader/Makefile

    rcfa8738 rd061efe  
    9494        $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
    9595        $(USPACEDIR)/srv/fs/fat/fat \
    96         $(USPACEDIR)/srv/bd/file_bd/file_bd
     96        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     97        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    9798
    9899RD_APPS = \
  • boot/arch/sparc64/loader/Makefile

    rcfa8738 rd061efe  
    104104        $(USPACEDIR)/srv/fs/devfs/devfs \
    105105        $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
    106         $(USPACEDIR)/srv/bd/file_bd/file_bd
     106        $(USPACEDIR)/srv/bd/file_bd/file_bd \
     107        $(USPACEDIR)/srv/part/mbr_part/mbr_part
    107108
    108109ifeq ($(MACHINE),generic)
  • uspace/Makefile

    rcfa8738 rd061efe  
    5252        srv/vfs \
    5353        srv/devmap \
     54        srv/part/mbr_part \
    5455        app/tetris \
    5556        app/tester \
  • uspace/lib/libblock/libblock.c

    rcfa8738 rd061efe  
    8686static int read_blocks(devcon_t *devcon, bn_t ba, size_t cnt);
    8787static int write_blocks(devcon_t *devcon, bn_t ba, size_t cnt);
    88 static size_t get_block_size(int dev_phone, size_t *bsize);
     88static int get_block_size(int dev_phone, size_t *bsize);
    8989
    9090static devcon_t *devcon_search(dev_handle_t dev_handle)
     
    652652}
    653653
     654/** Read blocks directly from device (bypass cache).
     655 *
     656 * @param dev_handle    Device handle of the block device.
     657 * @param ba            Address of first block.
     658 * @param cnt           Number of blocks.
     659 * @param src           Buffer for storing the data.
     660 *
     661 * @return              EOK on success or negative error code on failure.
     662 */
     663int block_read_direct(dev_handle_t dev_handle, bn_t ba, size_t cnt, void *buf)
     664{
     665        devcon_t *devcon;
     666        int rc;
     667
     668        devcon = devcon_search(dev_handle);
     669        assert(devcon);
     670       
     671        fibril_mutex_lock(&devcon->comm_area_lock);
     672
     673        rc = read_blocks(devcon, ba, cnt);
     674        if (rc == EOK)
     675                memcpy(buf, devcon->comm_area, devcon->pblock_size * cnt);
     676
     677        fibril_mutex_unlock(&devcon->comm_area_lock);
     678
     679        return rc;
     680}
     681
     682/** Write blocks directly to device (bypass cache).
     683 *
     684 * @param dev_handle    Device handle of the block device.
     685 * @param ba            Address of first block.
     686 * @param cnt           Number of blocks.
     687 * @param src           The data to be written.
     688 *
     689 * @return              EOK on success or negative error code on failure.
     690 */
     691int block_write_direct(dev_handle_t dev_handle, bn_t ba, size_t cnt,
     692    const void *data)
     693{
     694        devcon_t *devcon;
     695        int rc;
     696
     697        devcon = devcon_search(dev_handle);
     698        assert(devcon);
     699       
     700        fibril_mutex_lock(&devcon->comm_area_lock);
     701
     702        memcpy(devcon->comm_area, data, devcon->pblock_size * cnt);
     703        rc = read_blocks(devcon, ba, cnt);
     704
     705        fibril_mutex_unlock(&devcon->comm_area_lock);
     706
     707        return rc;
     708}
     709
     710/** Get device block size.
     711 *
     712 * @param dev_handle    Device handle of the block device.
     713 * @param bsize         Output block size.
     714 *
     715 * @return              EOK on success or negative error code on failure.
     716 */
     717int block_get_bsize(dev_handle_t dev_handle, size_t *bsize)
     718{
     719        devcon_t *devcon;
     720
     721        devcon = devcon_search(dev_handle);
     722        assert(devcon);
     723       
     724        return get_block_size(devcon->dev_phone, bsize);
     725}
     726
    654727/** Read blocks from block device.
    655728 *
     
    691764
    692765/** Get block size used by the device. */
    693 static size_t get_block_size(int dev_phone, size_t *bsize)
     766static int get_block_size(int dev_phone, size_t *bsize)
    694767{
    695768        ipcarg_t bs;
  • uspace/lib/libblock/libblock.h

    rcfa8738 rd061efe  
    109109    size_t);
    110110
     111extern int block_get_bsize(dev_handle_t, size_t *);
     112extern int block_read_direct(dev_handle_t, bn_t, size_t, void *);
     113extern int block_write_direct(dev_handle_t, bn_t, size_t, const void *);
     114
    111115#endif
    112116
Note: See TracChangeset for help on using the changeset viewer.