Lines 311-333
Link Here
|
311 |
static int |
311 |
static int |
312 |
vtnet_modevent(module_t mod, int type, void *unused) |
312 |
vtnet_modevent(module_t mod, int type, void *unused) |
313 |
{ |
313 |
{ |
314 |
int error; |
314 |
int error = 0; |
|
|
315 |
static int loaded = 0; |
315 |
|
316 |
|
316 |
error = 0; |
|
|
317 |
|
318 |
switch (type) { |
317 |
switch (type) { |
319 |
case MOD_LOAD: |
318 |
case MOD_LOAD: |
320 |
vtnet_tx_header_zone = uma_zcreate("vtnet_tx_hdr", |
319 |
if (loaded++ == 0) |
321 |
sizeof(struct vtnet_tx_header), |
320 |
vtnet_tx_header_zone = uma_zcreate("vtnet_tx_hdr", |
322 |
NULL, NULL, NULL, NULL, 0, 0); |
321 |
sizeof(struct vtnet_tx_header), |
|
|
322 |
NULL, NULL, NULL, NULL, 0, 0); |
323 |
break; |
323 |
break; |
324 |
case MOD_QUIESCE: |
324 |
case MOD_QUIESCE: |
325 |
case MOD_UNLOAD: |
325 |
case MOD_UNLOAD: |
326 |
if (uma_zone_get_cur(vtnet_tx_header_zone) > 0) |
326 |
if (--loaded == 0) { |
327 |
error = EBUSY; |
327 |
if (uma_zone_get_cur(vtnet_tx_header_zone) > 0) |
328 |
else if (type == MOD_UNLOAD) { |
328 |
error = EBUSY; |
329 |
uma_zdestroy(vtnet_tx_header_zone); |
329 |
else if (type == MOD_UNLOAD) { |
330 |
vtnet_tx_header_zone = NULL; |
330 |
uma_zdestroy(vtnet_tx_header_zone); |
|
|
331 |
vtnet_tx_header_zone = NULL; |
332 |
} |
331 |
} |
333 |
} |
332 |
break; |
334 |
break; |
333 |
case MOD_SHUTDOWN: |
335 |
case MOD_SHUTDOWN: |