vfs: add robust split_parent_and_name and refactor path parsing/creation#6
Draft
AMDRIP wants to merge 6 commits intoPOSIX-Implementationfrom
Draft
vfs: add robust split_parent_and_name and refactor path parsing/creation#6AMDRIP wants to merge 6 commits intoPOSIX-Implementationfrom
AMDRIP wants to merge 6 commits intoPOSIX-Implementationfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
O_CREAThandling invfs_opento create files in the resolved parent directory rather than trying to create with the full path on the root vnode.Description
split_parent_and_namehelper that returnsbooland properly trims trailing slashes, preserves root semantics, and splits a path intodir_outandname_out.vfs_opento resolve the parent directory viavfs_resolve_pathand callparent->ops->create(parent, filename, ...)whenO_CREATis set, and to release the parent vnode on all paths; also release the opened vnode ifopenfails.vfs_stat,vfs_unlink,vfs_write_file,vfs_mkdir, andvfs_renamewith calls to the newsplit_parent_and_nameand added validation for its return value.split_parent_and_nameimplementation and updated callers to handle failure cases consistently.Testing
maketo validate compilation, which completed successfully.make test-vfs, which passed.make test-fs) to exercisecreate,write,stat,readdir,unlink,mkdir, andrenameflows, which also passed.Codex Task