| 125 | } |
| 126 | |
| 127 | int |
| 128 | rman_init(struct rman *rm) |
| 129 | { |
| 130 | static int once = 0; |
| 131 | |
| 132 | if (once == 0) { |
| 133 | once = 1; |
| 134 | TAILQ_INIT(&rman_head); |
| 135 | mtx_init(&rman_mtx, "rman head", NULL, MTX_DEF); |
| 136 | } |
| 137 | |
| 138 | if (rm->rm_start == 0 && rm->rm_end == 0) |
| 139 | rm->rm_end = ~0; |
| 140 | if (rm->rm_type == RMAN_UNINIT) |
| 141 | panic("rman_init"); |
| 142 | if (rm->rm_type == RMAN_GAUGE) |
| 143 | panic("implement RMAN_GAUGE"); |
| 144 | |
| 145 | TAILQ_INIT(&rm->rm_list); |
| 146 | rm->rm_mtx = malloc(sizeof *rm->rm_mtx, M_RMAN, M_NOWAIT | M_ZERO); |
| 147 | if (rm->rm_mtx == NULL) |
| 148 | return ENOMEM; |
| 149 | mtx_init(rm->rm_mtx, "rman", NULL, MTX_DEF); |
| 150 | |
| 151 | mtx_lock(&rman_mtx); |
| 152 | TAILQ_INSERT_TAIL(&rman_head, rm, rm_link); |
| 153 | mtx_unlock(&rman_mtx); |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | int |
| 158 | rman_manage_region(struct rman *rm, rman_res_t start, rman_res_t end) |
no test coverage detected