* Allocate libext2fs structures associated with I/O manager */
| 110 | * Allocate libext2fs structures associated with I/O manager |
| 111 | */ |
| 112 | static io_channel alloc_io_channel(const disk_t *disk_car,my_data_t *my_data) |
| 113 | { |
| 114 | io_channel ioch; |
| 115 | #ifdef DEBUG_EXT2 |
| 116 | log_info("alloc_io_channel start\n"); |
| 117 | #endif |
| 118 | ioch = (io_channel)MALLOC(sizeof(struct struct_io_channel)); |
| 119 | if (ioch==NULL) |
| 120 | return NULL; |
| 121 | memset(ioch, 0, sizeof(struct struct_io_channel)); |
| 122 | ioch->magic = EXT2_ET_MAGIC_IO_CHANNEL; |
| 123 | ioch->manager = &my_struct_manager; |
| 124 | ioch->name=strdup(my_data->partition->fsname); |
| 125 | if (ioch->name==NULL) { |
| 126 | free(ioch); |
| 127 | return NULL; |
| 128 | } |
| 129 | ioch->private_data = my_data; |
| 130 | ioch->block_size = 1024; /* The smallest ext2fs block size */ |
| 131 | ioch->read_error = 0; |
| 132 | ioch->write_error = 0; |
| 133 | #ifdef DEBUG_EXT2 |
| 134 | log_info("alloc_io_channel end\n"); |
| 135 | #endif |
| 136 | return ioch; |
| 137 | } |
| 138 | |
| 139 | static errcode_t my_open(const char *dev, int flags, io_channel *channel) |
| 140 | { |
no test coverage detected