| 135 | } |
| 136 | |
| 137 | int rdev_chain(struct region_device *child, const struct region_device *parent, |
| 138 | size_t offset, size_t size) |
| 139 | { |
| 140 | struct region req = { |
| 141 | .offset = offset, |
| 142 | .size = size, |
| 143 | }; |
| 144 | |
| 145 | if (!normalize_and_ok(&parent->region, &req)) |
| 146 | return -1; |
| 147 | |
| 148 | /* Keep track of root region device. Note the offsets are relative |
| 149 | * to the root device. */ |
| 150 | child->root = rdev_root(parent); |
| 151 | child->ops = NULL; |
| 152 | child->region.offset = req.offset; |
| 153 | child->region.size = req.size; |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | static void mem_region_device_init(struct mem_region_device *mdev, |
| 159 | const struct region_device_ops *ops, void *base, size_t size) |