| 517 | }; |
| 518 | |
| 519 | const struct region_device *incoherent_rdev_init(struct incoherent_rdev *irdev, |
| 520 | const struct region *r, |
| 521 | const struct region_device *read, |
| 522 | const struct region_device *write) |
| 523 | { |
| 524 | const size_t size = region_sz(r); |
| 525 | |
| 526 | if (size != region_device_sz(read) || size != region_device_sz(write)) |
| 527 | return NULL; |
| 528 | |
| 529 | /* The region is represented as offset 0 to size. That way, the generic |
| 530 | * rdev operations can be called on the read or write implementation |
| 531 | * without any unnecessary translation because the offsets all start |
| 532 | * at 0. */ |
| 533 | region_device_init(&irdev->rdev, &incoherent_rdev_ops, 0, size); |
| 534 | irdev->read = read; |
| 535 | irdev->write = write; |
| 536 | |
| 537 | return &irdev->rdev; |
| 538 | } |
no test coverage detected