Changeset 15f3c3f in mainline for uspace/app
- Timestamp:
- 2011-06-22T22:00:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86ffa27f
- Parents:
- ef09a7a
- Location:
- uspace/app
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/bdd/bdd.c
ref09a7a r15f3c3f 39 39 40 40 #include <libblock.h> 41 #include < devmap.h>41 #include <loc.h> 42 42 #include <errno.h> 43 43 #include <assert.h> … … 69 69 unsigned int argc; 70 70 unsigned int i, j; 71 devmap_handle_t handle;71 service_id_t service_id; 72 72 aoff64_t offset; 73 73 uint8_t *blk; … … 96 96 size = 256; 97 97 98 rc = devmap_device_get_handle(argv[1], &handle, 0);98 rc = loc_service_get_id(argv[1], &service_id, 0); 99 99 if (rc != EOK) { 100 100 printf("%s: Error resolving device `%s'.\n", cmdname, argv[1]); … … 102 102 } 103 103 104 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);104 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 105 105 if (rc != EOK) { 106 106 printf("%s: Error initializing libblock.\n", cmdname); … … 108 108 } 109 109 110 rc = block_get_bsize( handle, &block_size);110 rc = block_get_bsize(service_id, &block_size); 111 111 if (rc != EOK) { 112 112 printf("%s: Error determining device block size.\n", cmdname); … … 117 117 if (blk == NULL) { 118 118 printf("%s: Error allocating memory.\n", cmdname); 119 block_fini( handle);119 block_fini(service_id); 120 120 return CMD_FAILURE; 121 121 } … … 124 124 125 125 while (size > 0) { 126 rc = block_read_direct( handle, ba, 1, blk);126 rc = block_read_direct(service_id, ba, 1, blk); 127 127 if (rc != EOK) { 128 128 printf("%s: Error reading block %" PRIuOFF64 "\n", cmdname, ba); 129 129 free(blk); 130 block_fini( handle);130 block_fini(service_id); 131 131 return CMD_FAILURE; 132 132 } … … 170 170 171 171 free(blk); 172 block_fini( handle);172 block_fini(service_id); 173 173 174 174 return CMD_SUCCESS; -
uspace/app/blkdump/blkdump.c
ref09a7a r15f3c3f 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 59 59 int rc; 60 60 char *dev_path; 61 devmap_handle_t handle;61 service_id_t service_id; 62 62 size_t block_size; 63 63 char *endptr; … … 128 128 dev_path = *argv; 129 129 130 rc = devmap_device_get_handle(dev_path, &handle, 0);130 rc = loc_service_get_id(dev_path, &service_id, 0); 131 131 if (rc != EOK) { 132 132 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 134 134 } 135 135 136 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);136 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 137 137 if (rc != EOK) { 138 138 printf(NAME ": Error initializing libblock.\n"); … … 140 140 } 141 141 142 rc = block_get_bsize( handle, &block_size);142 rc = block_get_bsize(service_id, &block_size); 143 143 if (rc != EOK) { 144 144 printf(NAME ": Error determining device block size.\n"); … … 146 146 } 147 147 148 rc = block_get_nblocks( handle, &dev_nblocks);148 rc = block_get_nblocks(service_id, &dev_nblocks); 149 149 if (rc != EOK) { 150 150 printf(NAME ": Warning, failed to obtain block device size.\n"); … … 156 156 if (data == NULL) { 157 157 printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size); 158 block_fini( handle);158 block_fini(service_id); 159 159 return 3; 160 160 } … … 162 162 limit = block_offset + block_count; 163 163 for (current = block_offset; current < limit; current++) { 164 rc = block_read_direct( handle, current, 1, data);164 rc = block_read_direct(service_id, current, 1, data); 165 165 if (rc != EOK) { 166 166 printf(NAME ": Error reading block at %" PRIuOFF64 " \n", current); … … 186 186 free(data); 187 187 188 block_fini( handle);188 block_fini(service_id); 189 189 190 190 return 0; -
uspace/app/bnchmark/bnchmark.c
ref09a7a r15f3c3f 41 41 #include <stdlib.h> 42 42 #include <mem.h> 43 #include < devmap.h>43 #include <loc.h> 44 44 #include <byteorder.h> 45 45 #include <sys/types.h> -
uspace/app/ext2info/ext2info.c
ref09a7a r15f3c3f 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 81 81 char *endptr; 82 82 char *dev_path; 83 devmap_handle_t handle;83 service_id_t service_id; 84 84 ext2_filesystem_t filesystem; 85 85 int arg_flags; … … 178 178 dev_path = *argv; 179 179 180 rc = devmap_device_get_handle(dev_path, &handle, 0);180 rc = loc_service_get_id(dev_path, &service_id, 0); 181 181 if (rc != EOK) { 182 182 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 184 184 } 185 185 186 rc = ext2_filesystem_init(&filesystem, handle);186 rc = ext2_filesystem_init(&filesystem, service_id); 187 187 if (rc != EOK) { 188 188 printf(NAME ": Error initializing libext2.\n"); -
uspace/app/init/init.c
ref09a7a r15f3c3f 46 46 #include <macros.h> 47 47 #include <str.h> 48 #include < devmap.h>48 #include <loc.h> 49 49 #include <str_error.h> 50 50 #include "init.h" … … 53 53 #define ROOT_MOUNT_POINT "/" 54 54 55 #define DEVFS_FS_TYPE "devfs"56 #define DEVFS_MOUNT_POINT "/dev"55 #define LOCFS_FS_TYPE "locfs" 56 #define LOCFS_MOUNT_POINT "/loc" 57 57 58 58 #define TMPFS_FS_TYPE "tmpfs" … … 113 113 } 114 114 115 static bool mount_ devfs(void)116 { 117 int rc = mount( DEVFS_FS_TYPE, DEVFS_MOUNT_POINT, "", "",115 static bool mount_locfs(void) 116 { 117 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 118 118 IPC_FLAG_BLOCKING); 119 return mount_report(" Device filesystem", DEVFS_MOUNT_POINT, DEVFS_FS_TYPE,120 NULL, rc);119 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, 120 LOCFS_FS_TYPE, NULL, rc); 121 121 } 122 122 … … 174 174 } 175 175 176 static void console(const char * dev)177 { 178 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, dev);179 180 /* Wait for the input device to be ready */181 devmap_handle_t handle;182 int rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);183 if (rc != EOK) { 184 printf("%s: Error waiting on %s (%s)\n", NAME, dev,185 str_error(rc)); 186 return; 187 } 188 189 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, dev, NULL);176 static void console(const char *svc) 177 { 178 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, svc); 179 180 /* Wait for the input service to be ready */ 181 service_id_t service_id; 182 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 183 if (rc != EOK) { 184 printf("%s: Error waiting on %s (%s)\n", NAME, svc, 185 str_error(rc)); 186 return; 187 } 188 189 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, svc, NULL); 190 190 if (rc != EOK) { 191 191 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 192 dev, str_error(rc));193 } 194 } 195 196 static void getterm(const char * dev, const char *app, bool wmsg)197 { 198 char term[ DEVMAP_NAME_MAXLEN];192 svc, str_error(rc)); 193 } 194 } 195 196 static void getterm(const char *svc, const char *app, bool wmsg) 197 { 198 char term[LOC_NAME_MAXLEN]; 199 199 int rc; 200 200 201 snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);201 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 202 202 203 203 printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app); 204 204 205 /* Wait for the terminal device to be ready */206 devmap_handle_t handle;207 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);205 /* Wait for the terminal service to be ready */ 206 service_id_t service_id; 207 rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 208 208 if (rc != EOK) { 209 209 printf("%s: Error waiting on %s (%s)\n", NAME, term, … … 257 257 } 258 258 259 spawn("/srv/ devfs");259 spawn("/srv/locfs"); 260 260 spawn("/srv/taskmon"); 261 261 262 if (!mount_ devfs()) {262 if (!mount_locfs()) { 263 263 printf("%s: Exiting\n", NAME); 264 264 return -2; -
uspace/app/lsusb/main.c
ref09a7a r15f3c3f 43 43 #include <getopt.h> 44 44 #include <devman.h> 45 #include < devmap.h>45 #include <loc.h> 46 46 #include <usb/dev/hub.h> 47 47 #include <usb/hc.h> -
uspace/app/mkbd/main.c
ref09a7a r15f3c3f 43 43 #include <getopt.h> 44 44 #include <devman.h> 45 #include < devmap.h>45 #include <loc.h> 46 46 #include <usb/dev/hub.h> 47 47 #include <usb/hid/iface.h> -
uspace/app/mkfat/mkfat.c
ref09a7a r15f3c3f 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 85 85 struct fat_params *par); 86 86 static int fat_blocks_write(struct fat_params const *par, 87 devmap_handle_t handle);87 service_id_t service_id); 88 88 static void fat_bootsec_create(struct fat_params const *par, struct fat_bs *bs); 89 89 … … 95 95 int rc; 96 96 char *dev_path; 97 devmap_handle_t handle;97 service_id_t service_id; 98 98 size_t block_size; 99 99 char *endptr; … … 138 138 dev_path = *argv; 139 139 140 rc = devmap_device_get_handle(dev_path, &handle, 0);140 rc = loc_service_get_id(dev_path, &service_id, 0); 141 141 if (rc != EOK) { 142 142 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 144 144 } 145 145 146 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);146 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 147 147 if (rc != EOK) { 148 148 printf(NAME ": Error initializing libblock.\n"); … … 150 150 } 151 151 152 rc = block_get_bsize( handle, &block_size);152 rc = block_get_bsize(service_id, &block_size); 153 153 if (rc != EOK) { 154 154 printf(NAME ": Error determining device block size.\n"); … … 156 156 } 157 157 158 rc = block_get_nblocks( handle, &dev_nblocks);158 rc = block_get_nblocks(service_id, &dev_nblocks); 159 159 if (rc != EOK) { 160 160 printf(NAME ": Warning, failed to obtain block device size.\n"); … … 183 183 } 184 184 185 rc = fat_blocks_write(&par, handle);185 rc = fat_blocks_write(&par, service_id); 186 186 if (rc != EOK) { 187 187 printf(NAME ": Error writing device.\n"); … … 189 189 } 190 190 191 block_fini( handle);191 block_fini(service_id); 192 192 printf("Success.\n"); 193 193 … … 234 234 235 235 /** Create file system with the given parameters. */ 236 static int fat_blocks_write(struct fat_params const *par, devmap_handle_t handle)236 static int fat_blocks_write(struct fat_params const *par, service_id_t service_id) 237 237 { 238 238 aoff64_t addr; … … 245 245 fat_bootsec_create(par, &bs); 246 246 247 rc = block_write_direct( handle, BS_BLOCK, 1, &bs);247 rc = block_write_direct(service_id, BS_BLOCK, 1, &bs); 248 248 if (rc != EOK) 249 249 return EIO; … … 257 257 /* Reserved sectors */ 258 258 for (i = 0; i < par->reserved_sectors - 1; ++i) { 259 rc = block_write_direct( handle, addr, 1, buffer);259 rc = block_write_direct(service_id, addr, 1, buffer); 260 260 if (rc != EOK) 261 261 return EIO; … … 277 277 } 278 278 279 rc = block_write_direct( handle, addr, 1, buffer);279 rc = block_write_direct(service_id, addr, 1, buffer); 280 280 if (rc != EOK) 281 281 return EIO; … … 291 291 /* Root directory */ 292 292 for (i = 0; i < par->rootdir_sectors; ++i) { 293 rc = block_write_direct( handle, addr, 1, buffer);293 rc = block_write_direct(service_id, addr, 1, buffer); 294 294 if (rc != EOK) 295 295 return EIO; -
uspace/app/tester/devs/devman2.c
ref09a7a r15f3c3f 58 58 char *path = NULL; 59 59 while (rc == EOK) { 60 rc = asprintf(&path, "/ dev/class/%s\\%zu", DEVICE_CLASS, idx);60 rc = asprintf(&path, "/loc/class/%s\\%zu", DEVICE_CLASS, idx); 61 61 if (rc < 0) { 62 62 continue; -
uspace/app/tester/hw/misc/virtchar1.c
ref09a7a r15f3c3f 48 48 #include "../../tester.h" 49 49 50 #define DEVICE_PATH_NORMAL "/ dev/devices/\\virt\\null\\a"51 #define DEVICE_PATH_CLASSES "/ dev/class/virt-null\\1"50 #define DEVICE_PATH_NORMAL "/loc/devices/\\virt\\null\\a" 51 #define DEVICE_PATH_CLASSES "/loc/class/virt-null\\1" 52 52 #define BUFFER_SIZE 64 53 53 -
uspace/app/tester/vfs/vfs1.c
ref09a7a r15f3c3f 35 35 #include <fcntl.h> 36 36 #include <dirent.h> 37 #include < devmap.h>37 #include <loc.h> 38 38 #include <sys/types.h> 39 39 #include <sys/stat.h> -
uspace/app/testread/testread.c
ref09a7a r15f3c3f 50 50 #include <stdlib.h> 51 51 #include <mem.h> 52 #include < devmap.h>52 #include <loc.h> 53 53 #include <byteorder.h> 54 54 #include <sys/types.h> -
uspace/app/usbinfo/main.c
ref09a7a r15f3c3f 42 42 #include <getopt.h> 43 43 #include <devman.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <usb/hc.h> 46 46 #include <usb/dev/pipes.h>
Note:
See TracChangeset
for help on using the changeset viewer.