Lines Matching refs:sf

158 	swap_file_t	*sf;  in swap_unregister()  local
161 while ((sf = cache) != NULL) { in swap_unregister()
163 (void) rcm_unregister_interest(hdl, sf->path, 0); in swap_unregister()
164 swap_file_free(sf); in swap_unregister()
201 swap_file_t *sf; in swap_suspend() local
210 if ((sf = cache_lookup(rsrcname)) == NULL) { in swap_suspend()
215 rv = swap_delete(sf, errstr); in swap_suspend()
226 swap_file_t *sf; in swap_resume() local
232 if ((sf = cache_lookup(rsrcname)) == NULL) { in swap_resume()
237 rv = swap_add(sf, errstr); in swap_resume()
252 swap_file_t *sf; in swap_offline() local
261 if ((sf = cache_lookup(rsrcname)) == NULL) { in swap_offline()
267 rv = swap_delete(sf, errstr); in swap_offline()
283 swap_file_t *sf; in swap_online() local
289 if ((sf = cache_lookup(rsrcname)) == NULL) { in swap_online()
294 rv = swap_add(sf, errstr); in swap_online()
305 swap_file_t *sf; in swap_remove() local
310 if ((sf = cache_lookup(rsrcname)) == NULL) { in swap_remove()
315 cache_remove(sf); in swap_remove()
316 swap_file_free(sf); in swap_remove()
332 swap_delete(swap_file_t *sf, char **errstr) in swap_delete() argument
345 for (sa = sf->areas; sa != NULL; sa = sa->next) { in swap_delete()
351 (void) snprintf(cmd, sizeof (cmd), SWAP_DELETE, sf->path, in swap_delete()
379 sf->path, sa->start, sa->len); in swap_delete()
394 sf->cache_flags |= SWAP_CACHE_OFFLINED; in swap_delete()
405 swap_add(swap_file_t *sf, char **errstr) in swap_add() argument
413 for (sa = sf->areas; sa != NULL; sa = sa->next) { in swap_add()
420 SWAP_ADD, sf->path, sa->start, sa->len); in swap_add()
429 sf->cache_flags &= ~SWAP_CACHE_OFFLINED; in swap_add()
440 swap_file_t *sf, *stale_sf; in update_cache() local
456 for (sf = cache; sf != NULL; sf = sf->next) { in update_cache()
457 sf->cache_flags |= SWAP_CACHE_STALE; in update_cache()
458 for (sa = sf->areas; sa != NULL; sa = sa->next) { in update_cache()
474 if ((sf = cache_lookup(swt->swt_ent[i].ste_path)) == NULL) { in update_cache()
475 if ((sf = swap_file_alloc(swt->swt_ent[i].ste_path)) == in update_cache()
480 sf->cache_flags |= SWAP_CACHE_NEW; in update_cache()
481 cache_insert(sf); in update_cache()
483 sf->cache_flags &= ~SWAP_CACHE_STALE; in update_cache()
489 if ((sa = swap_area_lookup(sf, &swt->swt_ent[i])) == NULL) { in update_cache()
494 swap_area_add(sf, sa); in update_cache()
508 sf = cache; in update_cache()
509 while (sf != NULL) { in update_cache()
510 sa = sf->areas; in update_cache()
520 swap_area_remove(sf, stale_sa); in update_cache()
527 if (sf->cache_flags & SWAP_CACHE_OFFLINED) { in update_cache()
528 sf->cache_flags &= ~SWAP_CACHE_STALE; in update_cache()
529 sf = sf->next; in update_cache()
533 if (sf->cache_flags & SWAP_CACHE_STALE) { in update_cache()
534 if (rcm_unregister_interest(hdl, sf->path, 0) != in update_cache()
537 "%s\n", sf->path); in update_cache()
539 stale_sf = sf; in update_cache()
540 sf = sf->next; in update_cache()
546 if (!(sf->cache_flags & SWAP_CACHE_NEW)) { in update_cache()
547 sf = sf->next; in update_cache()
551 if (rcm_register_interest(hdl, sf->path, 0, NULL) != in update_cache()
554 sf->path); in update_cache()
558 sf->path); in update_cache()
559 sf->cache_flags &= ~SWAP_CACHE_NEW; in update_cache()
561 sf = sf->next; in update_cache()
636 swap_file_t *sf; in free_cache() local
639 while ((sf = cache) != NULL) { in free_cache()
641 swap_file_free(sf); in free_cache()
651 swap_file_free(swap_file_t *sf) in swap_file_free() argument
655 assert(sf != NULL); in swap_file_free()
657 while ((sa = sf->areas) != NULL) { in swap_file_free()
658 sf->areas = sf->areas->next; in swap_file_free()
661 free(sf); in swap_file_free()
683 swap_file_t *sf; in cache_lookup() local
685 for (sf = cache; sf != NULL; sf = sf->next) { in cache_lookup()
686 if (strcmp(rsrc, sf->path) == 0) { in cache_lookup()
687 return (sf); in cache_lookup()
717 swap_area_add(swap_file_t *sf, swap_area_t *sa) in swap_area_add() argument
719 sa->next = sf->areas; in swap_area_add()
723 sf->areas = sa; in swap_area_add()
730 swap_area_remove(swap_file_t *sf, swap_area_t *ent) in swap_area_remove() argument
732 assert(sf != NULL && ent != NULL); in swap_area_remove()
740 sf->areas = ent->next; in swap_area_remove()
749 swap_file_t *sf; in swap_file_alloc() local
751 if ((sf = calloc(1, sizeof (*sf))) == NULL) { in swap_file_alloc()
755 (void) strlcpy(sf->path, rsrc, sizeof (sf->path)); in swap_file_alloc()
757 return (sf); in swap_file_alloc()
779 swap_area_lookup(swap_file_t *sf, swapent_t *swt_ent) in swap_area_lookup() argument
783 assert(sf != NULL && swt_ent != NULL); in swap_area_lookup()
784 assert(strcmp(sf->path, swt_ent->ste_path) == 0); in swap_area_lookup()
786 for (sa = sf->areas; sa != NULL; sa = sa->next) { in swap_area_lookup()