| 238 | } |
| 239 | |
| 240 | rt_err_t disk_remove_blk_dev(struct rt_blk_device *blk, rt_bool_t lockless) |
| 241 | { |
| 242 | struct rt_blk_disk *disk; |
| 243 | |
| 244 | if (!blk) |
| 245 | { |
| 246 | return -RT_EINVAL; |
| 247 | } |
| 248 | |
| 249 | disk = blk->disk; |
| 250 | |
| 251 | if (!disk) |
| 252 | { |
| 253 | return -RT_EINVAL; |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | #ifdef RT_USING_DFS |
| 258 | const char *mountpath; |
| 259 | |
| 260 | if ((mountpath = dfs_filesystem_get_mounted_path(&blk->parent))) |
| 261 | { |
| 262 | dfs_unmount(mountpath); |
| 263 | LOG_D("%s: Unmount file system on %s", |
| 264 | to_blk_name(blk), mountpath); |
| 265 | } |
| 266 | #endif |
| 267 | } |
| 268 | |
| 269 | #ifdef RT_USING_DM |
| 270 | rt_dm_ida_free(disk->ida, blk->parent.device_id); |
| 271 | #endif |
| 272 | |
| 273 | rt_device_unregister(&blk->parent); |
| 274 | |
| 275 | if (!lockless) |
| 276 | { |
| 277 | spin_lock(&disk->lock); |
| 278 | } |
| 279 | |
| 280 | rt_list_remove(&blk->list); |
| 281 | |
| 282 | if (!lockless) |
| 283 | { |
| 284 | spin_unlock(&disk->lock); |
| 285 | } |
| 286 | |
| 287 | --disk->partitions; |
| 288 | |
| 289 | return RT_EOK; |
| 290 | } |
| 291 | |
| 292 | rt_uint32_t blk_request_ioprio(void) |
| 293 | { |
no test coverage detected