| 230 | } |
| 231 | |
| 232 | void |
| 233 | kobj_class_free(kobj_class_t cls) |
| 234 | { |
| 235 | void* ops = NULL; |
| 236 | |
| 237 | KOBJ_ASSERT(MA_NOTOWNED); |
| 238 | KOBJ_LOCK(); |
| 239 | |
| 240 | /* |
| 241 | * Protect against a race between kobj_create and |
| 242 | * kobj_delete. |
| 243 | */ |
| 244 | if (cls->refs == 0) { |
| 245 | /* |
| 246 | * For now we don't do anything to unregister any methods |
| 247 | * which are no longer used. |
| 248 | */ |
| 249 | |
| 250 | /* |
| 251 | * Free memory and clean up. |
| 252 | */ |
| 253 | ops = cls->ops; |
| 254 | cls->ops = NULL; |
| 255 | } |
| 256 | |
| 257 | KOBJ_UNLOCK(); |
| 258 | |
| 259 | if (ops) |
| 260 | free(ops, M_KOBJ); |
| 261 | } |
| 262 | |
| 263 | static void |
| 264 | kobj_init_common(kobj_t obj, kobj_class_t cls) |
no test coverage detected