| 115 | } |
| 116 | |
| 117 | static rt_ubase_t _get_unit_shift(rt_device_t device) |
| 118 | { |
| 119 | rt_ubase_t shift = 0; |
| 120 | |
| 121 | /** |
| 122 | * transfer unit size from POSIX RW(in bytes) to rt_device_R/W |
| 123 | * (block size for blk device, otherwise in bytes). |
| 124 | */ |
| 125 | if (device->type == RT_Device_Class_Block) |
| 126 | { |
| 127 | struct rt_device_blk_geometry geometry = {0}; |
| 128 | |
| 129 | /* default to 512 */ |
| 130 | shift = 9; |
| 131 | if (!rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry)) |
| 132 | { |
| 133 | shift = __rt_ffs(geometry.block_size) - 1; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | return shift; |
| 138 | } |
| 139 | |
| 140 | static ssize_t dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) |
| 141 | { |
no test coverage detected