Changes in / [664af708:f483a15] in mainline


Ignore:
Files:
27 added
7 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r664af708 rf483a15  
    9797        $(USPACE_PATH)/srv/fs/tmpfs/tmpfs \
    9898        $(USPACE_PATH)/srv/fs/fat/fat \
     99        $(USPACE_PATH)/srv/fs/pipefs/pipefs \
     100        $(USPACE_PATH)/srv/fs/ext2/ext2 \
    99101        $(USPACE_PATH)/srv/taskmon/taskmon \
    100102        $(USPACE_PATH)/srv/hw/netif/ne2000/ne2000 \
     
    124126
    125127RD_APPS_NON_ESSENTIAL = \
     128        $(USPACE_PATH)/app/blkdump/blkdump \
    126129        $(USPACE_PATH)/app/edit/edit \
     130        $(USPACE_PATH)/app/ext2info/ext2info \
    127131        $(USPACE_PATH)/app/kill/kill \
    128132        $(USPACE_PATH)/app/killall/killall \
  • uspace/Makefile

    r664af708 rf483a15  
    3535DIRS = \
    3636        app/bdsh \
     37        app/blkdump \
    3738        app/edit \
     39        app/ext2info \
    3840        app/getterm \
    3941        app/init \
     
    7274        srv/fs/tmpfs \
    7375        srv/fs/devfs \
     76        srv/fs/pipefs \
     77        srv/fs/ext2 \
    7478        srv/hid/adb_mouse \
    7579        srv/hid/char_mouse \
     
    148152        lib/drv \
    149153        lib/packet \
    150         lib/net
     154        lib/net \
     155        lib/ext2
    151156
    152157LIBC_BUILD = $(addsuffix .build,$(LIBC))
  • uspace/Makefile.common

    r664af708 rf483a15  
    8686LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
    8787
     88LIBEXT2_PREFIX = $(LIB_PREFIX)/ext2
     89
    8890LIBDRV_PREFIX = $(LIB_PREFIX)/drv
    8991LIBPACKET_PREFIX = $(LIB_PREFIX)/packet
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    r664af708 rf483a15  
    4444{
    4545        static char helpfmt[] =
    46             "Usage:  %s <fstype> <mp> <dev> [<moptions>]\n";
     46            "Usage:  %s <fstype> <mp> [dev] [<moptions>]\n";
    4747        if (level == HELP_SHORT) {
    4848                printf("'%s' mounts a file system.\n", cmdname);
     
    5959        unsigned int argc;
    6060        const char *mopts = "";
     61        const char *dev = "";
    6162        int rc;
    6263
    6364        argc = cli_count_args(argv);
    6465
    65         if ((argc < 4) || (argc > 5)) {
     66        if ((argc < 3) || (argc > 5)) {
    6667                printf("%s: invalid number of arguments.\n",
    6768                    cmdname);
    6869                return CMD_FAILURE;
    6970        }
     71        if (argc > 3)
     72                dev = argv[3];
    7073        if (argc == 5)
    7174                mopts = argv[4];
    7275
    73         rc = mount(argv[1], argv[2], argv[3], mopts, 0);
     76        rc = mount(argv[1], argv[2], dev, mopts, 0);
    7477        if (rc != EOK) {
    7578                printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n",
  • uspace/app/redir/redir.c

    r664af708 rf483a15  
    4949static void usage(void)
    5050{
    51         printf("Usage: %s [-i <stdin>] [-o <stdout>] [-e <stderr>] -- <cmd> [args ...]\n",
     51        fprintf(stderr, "Usage: %s [-i <stdin>] [-o <stdout>] [-e <stderr>] -- <cmd> [args ...]\n",
    5252            NAME);
    5353}
     
    8383        args = (const char **) calloc(argc + 1, sizeof(char *));
    8484        if (!args) {
    85                 printf("No memory available\n");
     85                fprintf(stderr, "No memory available\n");
    8686                return 0;
    8787        }
     
    9898       
    9999        if (rc != EOK) {
    100                 printf("%s: Error spawning %s (%s)\n", NAME, argv[0],
     100                fprintf(stderr, "%s: Error spawning %s (%s)\n", NAME, argv[0],
    101101                    str_error(rc));
     102                return 0;
    102103        }
    103104       
  • uspace/lib/block/libblock.c

    r664af708 rf483a15  
    22 * Copyright (c) 2008 Jakub Jermar
    33 * Copyright (c) 2008 Martin Decky
     4 * Copyright (c) 2011 Martin Sucha
    45 * All rights reserved.
    56 *
     
    810811}
    811812
     813/** Read bytes directly from the device (bypass cache)
     814 *
     815 * @param devmap_handle Device handle of the block device.
     816 * @param abs_offset    Absolute offset in bytes where to start reading
     817 * @param bytes                 Number of bytes to read
     818 * @param data                  Buffer that receives the data
     819 *
     820 * @return              EOK on success or negative error code on failure.
     821 */
     822int block_read_bytes_direct(devmap_handle_t devmap_handle, aoff64_t abs_offset,
     823    size_t bytes, void *data)
     824{
     825        int rc;
     826        size_t phys_block_size;
     827        size_t buf_size;
     828        void *buffer;
     829        aoff64_t first_block;
     830        aoff64_t last_block;
     831        size_t blocks;
     832        size_t offset;
     833       
     834        rc = block_get_bsize(devmap_handle, &phys_block_size);
     835        if (rc != EOK) {
     836                return rc;
     837        }
     838       
     839        // calculate data position and required space
     840        first_block = abs_offset / phys_block_size;
     841        offset = abs_offset % phys_block_size;
     842        last_block = (abs_offset + bytes - 1) / phys_block_size;
     843        blocks = last_block - first_block + 1;
     844        buf_size = blocks * phys_block_size;
     845       
     846        // read the data into memory
     847        buffer = malloc(buf_size);
     848        if (buffer == NULL) {
     849                return ENOMEM;
     850        }
     851       
     852        rc = block_read_direct(devmap_handle, first_block, blocks, buffer);
     853        if (rc != EOK) {
     854                free(buffer);
     855                return rc;
     856        }
     857       
     858        // copy the data from the buffer
     859        memcpy(data, buffer + offset, bytes);
     860        free(buffer);
     861       
     862        return EOK;
     863}
     864
    812865/** Read blocks from block device.
    813866 *
  • uspace/lib/block/libblock.h

    r664af708 rf483a15  
    22 * Copyright (c) 2008 Jakub Jermar
    33 * Copyright (c) 2008 Martin Decky
     4 * Copyright (c) 2011 Martin Sucha
    45 * All rights reserved.
    56 *
     
    113114extern int block_get_nblocks(devmap_handle_t, aoff64_t *);
    114115extern int block_read_direct(devmap_handle_t, aoff64_t, size_t, void *);
     116extern int block_read_bytes_direct(devmap_handle_t, aoff64_t, size_t, void *);
    115117extern int block_write_direct(devmap_handle_t, aoff64_t, size_t, const void *);
    116118
Note: See TracChangeset for help on using the changeset viewer.