Lines Matching refs:vnode
87 struct Vnode *vnode = NULL; in GetFromFreeList() local
95 vnode = ENTRY_TO_VNODE(LOS_DL_LIST_FIRST(&g_vnodeFreeList)); in GetFromFreeList()
96 LOS_ListDelete(&vnode->actFreeEntry); in GetFromFreeList()
98 return vnode; in GetFromFreeList()
136 struct Vnode* vnode = NULL; in VnodeAlloc() local
139 vnode = GetFromFreeList(); in VnodeAlloc()
140 if ((vnode == NULL) && g_totalVnodeSize < LOSCFG_MAX_VNODE_SIZE) { in VnodeAlloc()
141 vnode = (struct Vnode *)zalloc(sizeof(struct Vnode)); in VnodeAlloc()
145 if (vnode == NULL) { in VnodeAlloc()
146 vnode = VnodeReclaimLru(); in VnodeAlloc()
149 if (vnode == NULL) { in VnodeAlloc()
155 vnode->type = VNODE_TYPE_UNKNOWN; in VnodeAlloc()
156 LOS_ListInit((&(vnode->parentPathCaches))); in VnodeAlloc()
157 LOS_ListInit((&(vnode->childPathCaches))); in VnodeAlloc()
158 LOS_ListInit((&(vnode->hashEntry))); in VnodeAlloc()
159 LOS_ListInit((&(vnode->actFreeEntry))); in VnodeAlloc()
162 LOS_ListAdd(&g_vnodeVirtualList, &(vnode->actFreeEntry)); in VnodeAlloc()
163 vnode->vop = &g_devfsOps; in VnodeAlloc()
165 LOS_ListTailInsert(&g_vnodeActiveList, &(vnode->actFreeEntry)); in VnodeAlloc()
166 vnode->vop = vop; in VnodeAlloc()
168 LOS_ListInit(&vnode->mapping.page_list); in VnodeAlloc()
169 LOS_SpinInit(&vnode->mapping.list_lock); in VnodeAlloc()
170 (VOID)LOS_MuxInit(&vnode->mapping.mux_lock, NULL); in VnodeAlloc()
171 vnode->mapping.host = vnode; in VnodeAlloc()
175 *newVnode = vnode; in VnodeAlloc()
180 int VnodeFree(struct Vnode *vnode) in VnodeFree() argument
182 if (vnode == NULL) { in VnodeFree()
187 if (vnode->useCount > 0) { in VnodeFree()
192 VnodePathCacheFree(vnode); in VnodeFree()
193 LOS_ListDelete(&(vnode->hashEntry)); in VnodeFree()
194 LOS_ListDelete(&vnode->actFreeEntry); in VnodeFree()
196 if (vnode->vop->Reclaim) { in VnodeFree()
197 vnode->vop->Reclaim(vnode); in VnodeFree()
200 if (vnode->filePath) { in VnodeFree()
201 free(vnode->filePath); in VnodeFree()
203 if (vnode->vop == &g_devfsOps) { in VnodeFree()
205 free(vnode->data); in VnodeFree()
206 free(vnode); in VnodeFree()
210 (void)memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode)); in VnodeFree()
211 LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry); in VnodeFree()
221 struct Vnode *vnode = NULL; in VnodeFreeAll() local
225 …LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(vnode, nextVnode, &g_vnodeActiveList, struct Vnode, actFreeEntry) { in VnodeFreeAll()
226 if ((vnode->originMount == mount) && !(vnode->flag & VNODE_FLAG_MOUNT_NEW)) { in VnodeFreeAll()
227 ret = VnodeFree(vnode); in VnodeFreeAll()
239 struct Vnode *vnode = NULL; in VnodeInUseIter() local
241 LOS_DL_LIST_FOR_EACH_ENTRY(vnode, &g_vnodeActiveList, struct Vnode, actFreeEntry) { in VnodeInUseIter()
242 if (vnode->originMount == mount) { in VnodeInUseIter()
243 if ((vnode->useCount > 0) || (vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) { in VnodeInUseIter()
300 static struct Vnode *ConvertVnodeIfMounted(struct Vnode *vnode) in ConvertVnodeIfMounted() argument
302 if ((vnode == NULL) || !(vnode->flag & VNODE_FLAG_MOUNT_ORIGIN)) { in ConvertVnodeIfMounted()
303 return vnode; in ConvertVnodeIfMounted()
309 if ((mnt != NULL) && (mnt->vnodeBeCovered == vnode)) { in ConvertVnodeIfMounted()
313 if (strcmp(vnode->filePath, "/dev") == 0) { in ConvertVnodeIfMounted()
314 return vnode->newMount->vnodeCovered; in ConvertVnodeIfMounted()
316 return vnode; in ConvertVnodeIfMounted()
318 return vnode->newMount->vnodeCovered; in ConvertVnodeIfMounted()
322 static void RefreshLRU(struct Vnode *vnode) in RefreshLRU() argument
324 if (vnode == NULL || (vnode->type != VNODE_TYPE_REG && vnode->type != VNODE_TYPE_DIR) || in RefreshLRU()
325 vnode->vop == &g_devfsOps || vnode->vop == NULL) { in RefreshLRU()
328 LOS_ListDelete(&(vnode->actFreeEntry)); in RefreshLRU()
329 LOS_ListTailInsert(&g_vnodeActiveList, &(vnode->actFreeEntry)); in RefreshLRU()
332 static int ProcessVirtualVnode(struct Vnode *parent, uint32_t flags, struct Vnode **vnode) in ProcessVirtualVnode() argument
337 ret = VnodeAlloc(NULL, vnode); in ProcessVirtualVnode()
340 (*vnode)->parent = parent; in ProcessVirtualVnode()
473 int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags) in VnodeLookup() argument
475 return VnodeLookupAt(path, vnode, flags, NULL); in VnodeLookup()
478 int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags) in VnodeLookupFullpath() argument
480 return VnodeLookupAt(fullpath, vnode, flags, GetCurrRootVnode()); in VnodeLookupFullpath()
579 int VnodeOpendir(struct Vnode *vnode, struct fs_dirent_s *dir) in VnodeOpendir() argument
581 (void)vnode; in VnodeOpendir()
586 int VnodeClosedir(struct Vnode *vnode, struct fs_dirent_s *dir) in VnodeClosedir() argument
588 (void)vnode; in VnodeClosedir()
593 int VnodeCreate(struct Vnode *parent, const char *name, int mode, struct Vnode **vnode) in VnodeCreate() argument
616 *vnode = newVnode; in VnodeCreate()
643 int VnodeGetattr(struct Vnode *vnode, struct stat *buf) in VnodeGetattr() argument
646 buf->st_mode = vnode->mode; in VnodeGetattr()
647 buf->st_uid = vnode->uid; in VnodeGetattr()
648 buf->st_gid = vnode->gid; in VnodeGetattr()
658 static int VnodeChattr(struct Vnode *vnode, struct IATTR *attr) in VnodeChattr() argument
661 if (vnode == NULL || attr == NULL) { in VnodeChattr()
667 vnode->mode &= S_IFMT; in VnodeChattr()
668 vnode->mode = tmpMode | vnode->mode; in VnodeChattr()
671 vnode->uid = attr->attr_chg_uid; in VnodeChattr()
674 vnode->gid = attr->attr_chg_gid; in VnodeChattr()
679 int VnodeDevLookup(struct Vnode *parentVnode, const char *path, int len, struct Vnode **vnode) in VnodeDevLookup() argument
684 (void)vnode; in VnodeDevLookup()