Changeset 3abf70c7 in mainline
- Timestamp:
- 2014-08-16T22:33:41Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- da79df42
- Parents:
- 35b8bfe
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/blkdump/Makefile
r35b8bfe r3abf70c7 30 30 USPACE_PREFIX = ../.. 31 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBSCSI_PREFIX)/include 33 33 BINARY = blkdump 34 34 -
uspace/app/blkdump/blkdump.c
r35b8bfe r3abf70c7 44 44 #include <loc.h> 45 45 #include <byteorder.h> 46 #include <scsi/mmc.h> 46 47 #include <sys/types.h> 47 48 #include <sys/typefmt.h> … … 214 215 static int print_toc(void) 215 216 { 216 toc_block_t *toc; 217 218 toc = block_get_toc(service_id, 0); 219 if (toc == NULL) 217 scsi_toc_multisess_data_t toc; 218 int rc; 219 220 rc = block_read_toc(service_id, 0, &toc, sizeof(toc)); 221 if (rc != EOK) 220 222 return 1; 221 223 222 printf("TOC size: %" PRIu16 " bytes\n", toc ->size);223 printf("First session: %" PRIu8 "\n", toc ->first_session);224 printf("Last_session: %" PRIu8 "\n", toc ->last_session);224 printf("TOC size: %" PRIu16 " bytes\n", toc.toc_len); 225 printf("First session: %" PRIu8 "\n", toc.first_sess); 226 printf("Last_session: %" PRIu8 "\n", toc.last_sess); 225 227 226 228 return 0; -
uspace/lib/block/block.c
r35b8bfe r3abf70c7 877 877 * 878 878 * @return Allocated TOC structure. 879 * @return NULL on failure. 880 * 881 */ 882 toc_block_t *block_get_toc(service_id_t service_id, uint8_t session) 879 * @return EOK on success or negative error code. 880 * 881 */ 882 int block_read_toc(service_id_t service_id, uint8_t session, void *buf, 883 size_t bufsize) 883 884 { 884 885 devcon_t *devcon = devcon_search(service_id); 885 toc_block_t *toc = NULL; 886 int rc; 887 888 assert(devcon); 889 890 toc = (toc_block_t *) malloc(sizeof(toc_block_t)); 891 if (toc == NULL) 892 return NULL; 893 894 rc = bd_read_toc(devcon->bd, session, toc, sizeof(toc_block_t)); 895 if (rc != EOK) { 896 free(toc); 897 return NULL; 898 } 899 900 return toc; 886 887 assert(devcon); 888 return bd_read_toc(devcon->bd, session, buf, bufsize); 901 889 } 902 890 -
uspace/lib/block/block.h
r35b8bfe r3abf70c7 99 99 }; 100 100 101 typedef struct {102 uint16_t size;103 uint8_t first_session;104 uint8_t last_session;105 106 uint8_t res0;107 uint8_t adr_ctrl;108 uint8_t first_track;109 uint8_t res1;110 111 uint32_t first_lba;112 } __attribute__((packed)) toc_block_t;113 114 101 extern int block_init(exch_mgmt_t, service_id_t, size_t); 115 102 extern void block_fini(service_id_t); … … 129 116 extern int block_get_bsize(service_id_t, size_t *); 130 117 extern int block_get_nblocks(service_id_t, aoff64_t *); 131 extern toc_block_t *block_get_toc(service_id_t, uint8_t);118 extern int block_read_toc(service_id_t, uint8_t, void *, size_t); 132 119 extern int block_read_direct(service_id_t, aoff64_t, size_t, void *); 133 120 extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *); -
uspace/lib/scsi/include/scsi/mmc.h
r35b8bfe r3abf70c7 69 69 } __attribute__((packed)) scsi_cdb_read_toc_t; 70 70 71 /** TOC Track Descriptor */ 72 typedef struct { 73 /** Reserved */ 74 uint8_t reserved0; 75 /** ADR, Control */ 76 uint8_t adr_control; 77 /** Track Number */ 78 uint8_t track_no; 79 /** Reserved */ 80 uint8_t reserved3; 81 /** Track Start Address */ 82 uint32_t start_addr; 83 } __attribute__((packed)) scsi_toc_track_desc_t; 84 85 /** Read TOC response format 00001b: Multi-session Information 86 * 87 * Returned for Read TOC command with Format 0001b 88 */ 89 typedef struct { 90 /** TOC Data Length */ 91 uint16_t toc_len; 92 /** First Complete Session Number */ 93 uint8_t first_sess; 94 /** Last Complete Session Number */ 95 uint8_t last_sess; 96 /** TOC Track Descriptor for first track in last complete session */ 97 scsi_toc_track_desc_t ftrack_lsess; 98 } __attribute__((packed)) scsi_toc_multisess_data_t; 99 71 100 #endif 72 101 -
uspace/srv/fs/cdfs/Makefile
r35b8bfe r3abf70c7 29 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a 31 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX) 31 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX) \ 32 -I$(LIBSCSI_PREFIX)/include 32 33 BINARY = cdfs 33 34 -
uspace/srv/fs/cdfs/cdfs_ops.c
r35b8bfe r3abf70c7 48 48 #include <errno.h> 49 49 #include <block.h> 50 #include <scsi/mmc.h> 50 51 #include <str.h> 51 52 #include <byteorder.h> … … 1035 1036 altroot = 0; 1036 1037 } else { 1037 /* Read TOC and find the last session */ 1038 toc_block_t *toc = block_get_toc(service_id, 1); 1039 if ((toc != NULL) && (uint16_t_be2host(toc->size) == 10)) { 1040 altroot = uint32_t_be2host(toc->first_lba); 1041 free(toc); 1042 } 1038 /* 1039 * Read TOC multisession information and get the start address 1040 * of the first track in the last session 1041 */ 1042 scsi_toc_multisess_data_t toc; 1043 1044 rc = block_read_toc(service_id, 1, &toc, sizeof(toc)); 1045 if (rc == EOK && (uint16_t_be2host(toc.toc_len) == 10)) 1046 altroot = uint32_t_be2host(toc.ftrack_lsess.start_addr); 1043 1047 } 1044 1048
Note:
See TracChangeset
for help on using the changeset viewer.