Lines Matching refs:ncl

357 	sdev_nc_list_t	*ncl = sdev_ncache;
374 if (ncl->ncl_nentries < sdev_nc_max_entries) {
383 sdev_nc_insertnode(ncl, lp);
400 sdev_nc_list_t *ncl = sdev_ncache;
404 mutex_enter(&ncl->ncl_mutex);
406 ASSERT(ncl->ncl_flags & NCL_LIST_WRITING);
408 if (ncl->ncl_flags & NCL_LIST_DIRTY) {
410 ncl->ncl_flags &= ~NCL_LIST_DIRTY;
411 mutex_exit(&ncl->ncl_mutex);
415 ncl->ncl_flags &= ~NCL_LIST_WRITING;
416 mutex_exit(&ncl->ncl_mutex);
429 sdev_nc_list_t *ncl = sdev_ncache;
435 mutex_enter(&ncl->ncl_mutex);
436 ncl->ncl_flags &= ~NCL_LIST_WRITING;
437 mutex_exit(&ncl->ncl_mutex);
445 rw_enter(&ncl->ncl_lock, RW_READER);
446 n = ncl->ncl_nentries;
455 for (lp = list_head(&ncl->ncl_list); lp;
456 lp = list_next(&ncl->ncl_list, lp)) {
464 rw_exit(&ncl->ncl_lock);
476 sdev_nc_list_t *ncl = sdev_ncache;
481 mutex_enter(&ncl->ncl_mutex);
482 if (((ncl->ncl_flags &
485 ncl->ncl_flags &= ~NCL_LIST_DIRTY;
486 ncl->ncl_flags |= NCL_LIST_WRITING;
487 mutex_exit(&ncl->ncl_mutex);
490 mutex_exit(&ncl->ncl_mutex);
497 sdev_nc_list_t *ncl = sdev_ncache;
503 mutex_enter(&ncl->ncl_mutex);
504 if (ncl->ncl_flags & NCL_LIST_WENABLE) {
505 mutex_exit(&ncl->ncl_mutex);
508 mutex_exit(&ncl->ncl_mutex);
516 sdev_nc_list_t *ncl = sdev_ncache;
525 rw_enter(&ncl->ncl_lock, RW_WRITER);
526 mutex_enter(&ncl->ncl_mutex);
528 for (lp = list_head(&ncl->ncl_list); lp; lp = next) {
529 next = list_next(&ncl->ncl_list, lp);
534 ncl->ncl_flags |= NCL_LIST_DIRTY;
538 list_remove(&ncl->ncl_list, lp);
540 ncl->ncl_nentries--;
542 ncl->ncl_flags |= NCL_LIST_DIRTY;
547 mutex_exit(&ncl->ncl_mutex);
548 rw_exit(&ncl->ncl_lock);
570 sdev_nc_list_t *ncl = sdev_ncache;
574 mutex_enter(&ncl->ncl_mutex);
575 ncl->ncl_flags |= NCL_LIST_WENABLE;
576 mutex_exit(&ncl->ncl_mutex);
658 sdev_nc_list_t *ncl = sdev_ncache;
674 rw_enter(&ncl->ncl_lock, RW_READER);
675 if ((lp = sdev_nc_findpath(ncl, path)) != NULL) {
683 mutex_enter(&ncl->ncl_mutex);
688 ncl->ncl_flags |= NCL_LIST_DIRTY;
691 mutex_exit(&ncl->ncl_mutex);
694 rw_exit(&ncl->ncl_lock);
729 sdev_nc_list_t *ncl;
731 ncl = kmem_zalloc(sizeof (sdev_nc_list_t), KM_SLEEP);
733 rw_init(&ncl->ncl_lock, NULL, RW_DEFAULT, NULL);
734 mutex_init(&ncl->ncl_mutex, NULL, MUTEX_DEFAULT, NULL);
735 list_create(&ncl->ncl_list, sizeof (sdev_nc_node_t),
738 return (ncl);
749 sdev_nc_findpath(sdev_nc_list_t *ncl, char *path)
753 ASSERT(RW_LOCK_HELD(&ncl->ncl_lock));
755 for (lp = list_head(&ncl->ncl_list); lp;
756 lp = list_next(&ncl->ncl_list, lp)) {
765 sdev_nc_insertnode(sdev_nc_list_t *ncl, sdev_nc_node_t *new)
769 rw_enter(&ncl->ncl_lock, RW_WRITER);
771 lp = sdev_nc_findpath(ncl, new->ncn_name);
773 if (ncl->ncl_nentries == sdev_nc_max_entries) {
777 ncl->ncl_nentries));
782 ncl->ncl_nentries);
784 rw_exit(&ncl->ncl_lock);
788 list_insert_tail(&ncl->ncl_list, new);
789 ncl->ncl_nentries++;
792 mutex_enter(&ncl->ncl_mutex);
802 ncl->ncl_flags |= NCL_LIST_DIRTY;
804 mutex_exit(&ncl->ncl_mutex);
805 rw_exit(&ncl->ncl_lock);
810 mutex_enter(&ncl->ncl_mutex);
812 mutex_exit(&ncl->ncl_mutex);
813 rw_exit(&ncl->ncl_lock);
819 sdev_nc_addname(sdev_nc_list_t *ncl, sdev_node_t *dv, char *nm, int flags)
834 sdev_nc_insertnode(ncl, lp);
848 sdev_nc_path_exists(sdev_nc_list_t *ncl, char *path)
855 rw_enter(&ncl->ncl_lock, RW_READER);
856 if ((lp = sdev_nc_findpath(ncl, path)) == NULL) {
857 rw_exit(&ncl->ncl_lock);
860 if (rw_tryupgrade(&ncl->ncl_lock) == 0) {
861 rw_exit(&ncl->ncl_lock);
862 rw_enter(&ncl->ncl_lock, RW_WRITER);
863 lp = sdev_nc_findpath(ncl, path);
866 list_remove(&ncl->ncl_list, lp);
867 ncl->ncl_nentries--;
868 mutex_enter(&ncl->ncl_mutex);
869 ncl->ncl_flags |= NCL_LIST_DIRTY;
870 if (ncl->ncl_flags & NCL_LIST_WENABLE) {
871 mutex_exit(&ncl->ncl_mutex);
872 rw_exit(&ncl->ncl_lock);
875 mutex_exit(&ncl->ncl_mutex);
876 rw_exit(&ncl->ncl_lock);
886 rw_exit(&ncl->ncl_lock);
892 sdev_nc_list_t *ncl = sdev_ncache;
896 rw_enter(&ncl->ncl_lock, RW_WRITER);
898 for (lp = list_head(&ncl->ncl_list); lp; lp = next) {
899 next = list_next(&ncl->ncl_list, lp);
902 mutex_enter(&ncl->ncl_mutex);
903 ncl->ncl_flags |= NCL_LIST_DIRTY;
904 mutex_exit(&ncl->ncl_mutex);
905 list_remove(&ncl->ncl_list, lp);
907 ncl->ncl_nentries--;
911 rw_exit(&ncl->ncl_lock);