Changes in / [234e39e:40d4c1d] in mainline
- Files:
-
- 9 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r234e39e r40d4c1d 60 60 $(USPACEDIR)/app/getterm/getterm \ 61 61 $(USPACEDIR)/app/klog/klog \ 62 $(USPACEDIR)/app/mkfat/mkfat \63 62 $(USPACEDIR)/app/redir/redir \ 64 63 $(USPACEDIR)/app/tester/tester \ -
tools/mkfat.py
r234e39e r40d4c1d 354 354 return 355 355 356 fat16_clusters = 8192356 fat16_clusters = 4096 357 357 358 358 sector_size = 512 -
uspace/Makefile
r234e39e r40d4c1d 38 38 app/init \ 39 39 app/klog \ 40 app/mkfat \41 40 app/redir \ 42 41 app/tester \ -
uspace/app/bdsh/Makefile.build
r234e39e r40d4c1d 42 42 cmds/modules/help/help.c \ 43 43 cmds/modules/mkdir/mkdir.c \ 44 cmds/modules/mkfile/mkfile.c \45 44 cmds/modules/rm/rm.c \ 46 45 cmds/modules/bdd/bdd.c \ -
uspace/app/bdsh/cmds/modules/modules.h
r234e39e r40d4c1d 20 20 #include "help/entry.h" 21 21 #include "mkdir/entry.h" 22 #include "mkfile/entry.h"23 22 #include "rm/entry.h" 24 23 #include "bdd/entry.h" … … 40 39 #include "help/help_def.h" 41 40 #include "mkdir/mkdir_def.h" 42 #include "mkfile/mkfile_def.h"43 41 #include "rm/rm_def.h" 44 42 #include "bdd/bdd_def.h" -
uspace/lib/libblock/libblock.c
r234e39e r40d4c1d 87 87 static int write_blocks(devcon_t *devcon, bn_t ba, size_t cnt); 88 88 static int get_block_size(int dev_phone, size_t *bsize); 89 static int get_num_blocks(int dev_phone, bn_t *nblocks);90 89 91 90 static devcon_t *devcon_search(dev_handle_t dev_handle) … … 715 714 716 715 memcpy(devcon->comm_area, data, devcon->pblock_size * cnt); 717 rc = write_blocks(devcon, ba, cnt);716 rc = read_blocks(devcon, ba, cnt); 718 717 719 718 fibril_mutex_unlock(&devcon->comm_area_lock); … … 737 736 738 737 return get_block_size(devcon->dev_phone, bsize); 739 }740 741 /** Get number of blocks on device.742 *743 * @param dev_handle Device handle of the block device.744 * @param nblocks Output number of blocks.745 *746 * @return EOK on success or negative error code on failure.747 */748 int block_get_nblocks(dev_handle_t dev_handle, bn_t *nblocks)749 {750 devcon_t *devcon;751 752 devcon = devcon_search(dev_handle);753 assert(devcon);754 755 return get_num_blocks(devcon->dev_phone, nblocks);756 738 } 757 739 … … 807 789 } 808 790 809 /** Get total number of blocks on block device. */810 static int get_num_blocks(int dev_phone, bn_t *nblocks)811 {812 ipcarg_t nb_l, nb_h;813 int rc;814 815 rc = async_req_0_2(dev_phone, BD_GET_NUM_BLOCKS, &nb_l, &nb_h);816 if (rc == EOK) {817 *nblocks = (bn_t) MERGE_LOUP32(nb_l, nb_h);818 }819 820 return rc;821 }822 823 791 /** @} 824 792 */ -
uspace/lib/libblock/libblock.h
r234e39e r40d4c1d 60 60 #define BLOCK_FLAGS_NOREAD 1 61 61 62 typedef uint64_t bn_t; /**< Block number type. */ 63 62 64 typedef struct block { 63 65 /** Mutex protecting the reference count. */ … … 108 110 109 111 extern int block_get_bsize(dev_handle_t, size_t *); 110 extern int block_get_nblocks(dev_handle_t, bn_t *);111 112 extern int block_read_direct(dev_handle_t, bn_t, size_t, void *); 112 113 extern int block_write_direct(dev_handle_t, bn_t, size_t, const void *); -
uspace/lib/libc/generic/io/io.c
r234e39e r40d4c1d 554 554 } 555 555 556 int ftell(FILE *stream)557 {558 off_t rc = lseek(stream->fd, 0, SEEK_CUR);559 if (rc == (off_t) (-1)) {560 /* errno has been set by lseek. */561 return -1;562 }563 564 return rc;565 }566 567 556 void rewind(FILE *stream) 568 557 { -
uspace/lib/libc/include/ipc/bd.h
r234e39e r40d4c1d 40 40 typedef enum { 41 41 BD_GET_BLOCK_SIZE = IPC_FIRST_USER_METHOD, 42 BD_GET_NUM_BLOCKS,43 42 BD_READ_BLOCKS, 44 43 BD_WRITE_BLOCKS -
uspace/lib/libc/include/sys/types.h
r234e39e r40d4c1d 40 40 typedef long off_t; 41 41 typedef int mode_t; 42 typedef uint64_t bn_t; /**< Block number type. */43 42 44 43 typedef int32_t wchar_t; -
uspace/srv/bd/ata_bd/ata_bd.c
r234e39e r40d4c1d 296 296 ipc_answer_1(callid, EOK, block_size); 297 297 continue; 298 case BD_GET_NUM_BLOCKS:299 ipc_answer_2(callid, EOK, LOWER32(disk[disk_id].blocks),300 UPPER32(disk[disk_id].blocks));301 continue;302 298 default: 303 299 retval = EINVAL; -
uspace/srv/bd/file_bd/file_bd.c
r234e39e r40d4c1d 56 56 57 57 static const size_t block_size = 512; 58 static bn_t num_blocks;59 58 static FILE *img; 60 59 … … 100 99 { 101 100 int rc; 102 long img_size;103 101 104 102 rc = devmap_driver_register(NAME, file_bd_connection); … … 111 109 if (img == NULL) 112 110 return EINVAL; 113 114 if (fseek(img, 0, SEEK_END) != 0) {115 fclose(img);116 return EIO;117 }118 119 img_size = ftell(img);120 if (img_size < 0) {121 fclose(img);122 return EIO;123 }124 125 num_blocks = img_size / block_size;126 111 127 112 fibril_mutex_initialize(&dev_lock); … … 189 174 ipc_answer_1(callid, EOK, block_size); 190 175 continue; 191 case BD_GET_NUM_BLOCKS:192 ipc_answer_2(callid, EOK, LOWER32(num_blocks),193 UPPER32(num_blocks));194 continue;195 176 default: 196 177 retval = EINVAL; … … 232 213 233 214 fseek(img, ba * block_size, SEEK_SET); 234 n_wr = f write(buf, block_size, cnt, img);215 n_wr = fread(buf, block_size, cnt, img); 235 216 236 217 if (ferror(img) || n_wr < cnt) { -
uspace/srv/bd/gxe_bd/gxe_bd.c
r234e39e r40d4c1d 234 234 ipc_answer_1(callid, EOK, block_size); 235 235 continue; 236 case BD_GET_NUM_BLOCKS:237 retval = ENOTSUP;238 break;239 236 default: 240 237 retval = EINVAL; -
uspace/srv/bd/part/mbr_part/mbr_part.c
r234e39e r40d4c1d 463 463 ipc_answer_1(callid, EOK, block_size); 464 464 continue; 465 case BD_GET_NUM_BLOCKS: 466 ipc_answer_2(callid, EOK, LOWER32(part->length), 467 UPPER32(part->length)); 468 continue; 465 469 466 default: 470 467 retval = EINVAL; -
uspace/srv/bd/rd/rd.c
r234e39e r40d4c1d 153 153 ipc_answer_1(callid, EOK, block_size); 154 154 continue; 155 case BD_GET_NUM_BLOCKS:156 ipc_answer_2(callid, EOK, LOWER32(rd_size / block_size),157 UPPER32(rd_size / block_size));158 continue;159 155 default: 160 156 /* -
uspace/srv/vfs/vfs_ops.c
r234e39e r40d4c1d 900 900 } 901 901 newpos = size + off; 902 file->pos = newpos;903 902 fibril_mutex_unlock(&file->lock); 904 903 ipc_answer_1(rid, EOK, newpos);
Note:
See TracChangeset
for help on using the changeset viewer.