Lines Matching defs:nvfd
754 e_fwrite_nvlist(nvfd_t *nvfd, nvlist_t *nvl)
758 if ((err = fwrite_nvlist(nvfd->nvf_cache_path, nvl)) == 0)
762 NVF_MARK_READONLY(nvfd);
782 fread_nvp_list(nvfd_t *nvfd)
791 ASSERT(RW_WRITE_HELD(&(nvfd->nvf_lock)));
793 rval = fread_nvlist(nvfd->nvf_cache_path, &nvl);
817 ASSERT(RW_WRITE_HELD(&(nvfd->nvf_lock)));
818 rv = (nvfd->nvf_unpack_nvlist)
819 ((nvf_handle_t)nvfd, sublist, name);
820 ASSERT(RW_WRITE_HELD(&(nvfd->nvf_lock)));
824 nvfd->nvf_cache_path, name);
832 nvfd->nvf_cache_path, name, nvpair_type(nvp));
844 nvp_list_free(nvfd);
852 nvfd_t *nvfd = (nvfd_t *)nvf_handle;
855 ASSERT(RW_WRITE_HELD(&nvfd->nvf_lock));
860 KFDEBUG((CE_CONT, "reading %s\n", nvfd->nvf_cache_path));
862 rval = fread_nvp_list(nvfd);
866 nvfd->nvf_flags |= NVF_F_REBUILD_MSG;
868 nvfd->nvf_cache_path);
871 nvfd->nvf_flags |= NVF_F_CREATE_MSG;
873 nvfd->nvf_cache_path);
877 nvfd->nvf_flags |= NVF_F_REBUILD_MSG;
879 nvfd->nvf_cache_path);
955 nvpflush_one(nvfd_t *nvfd)
960 rw_enter(&nvfd->nvf_lock, RW_READER);
962 ASSERT((nvfd->nvf_flags & NVF_F_FLUSHING) == 0);
964 if (!NVF_IS_DIRTY(nvfd) ||
965 NVF_IS_READONLY(nvfd) || kfio_disable_write || sys_shutdown) {
966 NVF_CLEAR_DIRTY(nvfd);
967 rw_exit(&nvfd->nvf_lock);
971 if (rw_tryupgrade(&nvfd->nvf_lock) == 0) {
973 "%s rw upgrade failed\n", nvfd->nvf_cache_path);
974 rw_exit(&nvfd->nvf_lock);
977 if (((nvfd->nvf_pack_list)
978 ((nvf_handle_t)nvfd, &nvl)) != DDI_SUCCESS) {
980 "%s nvlist construction failed\n", nvfd->nvf_cache_path);
981 ASSERT(RW_WRITE_HELD(&nvfd->nvf_lock));
982 rw_exit(&nvfd->nvf_lock);
985 ASSERT(RW_WRITE_HELD(&nvfd->nvf_lock));
987 NVF_CLEAR_DIRTY(nvfd);
988 nvfd->nvf_flags |= NVF_F_FLUSHING;
989 rw_exit(&nvfd->nvf_lock);
991 rval = e_fwrite_nvlist(nvfd, nvl);
994 rw_enter(&nvfd->nvf_lock, RW_WRITER);
995 nvfd->nvf_flags &= ~NVF_F_FLUSHING;
997 if (NVF_IS_READONLY(nvfd)) {
999 nvfd->nvf_flags &= ~(NVF_F_ERROR | NVF_F_DIRTY);
1000 } else if ((nvfd->nvf_flags & NVF_F_ERROR) == 0) {
1002 "%s: update failed\n", nvfd->nvf_cache_path);
1003 nvfd->nvf_flags |= NVF_F_ERROR | NVF_F_DIRTY;
1006 if (nvfd->nvf_flags & NVF_F_CREATE_MSG) {
1008 "!Creating %s\n", nvfd->nvf_cache_path);
1009 nvfd->nvf_flags &= ~NVF_F_CREATE_MSG;
1011 if (nvfd->nvf_flags & NVF_F_REBUILD_MSG) {
1013 "!Rebuilding %s\n", nvfd->nvf_cache_path);
1014 nvfd->nvf_flags &= ~NVF_F_REBUILD_MSG;
1016 if (nvfd->nvf_flags & NVF_F_ERROR) {
1018 "%s: update now ok\n", nvfd->nvf_cache_path);
1019 nvfd->nvf_flags &= ~NVF_F_ERROR;
1025 if (NVF_IS_DIRTY(nvfd))
1029 rw_exit(&nvfd->nvf_lock);