mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
vfs: change how the vfs_create return argument works and split the rdev vattr member
This commit is contained in:
@@ -159,11 +159,7 @@ void initrd_unpack() {
|
||||
VOP_RELEASE(node);
|
||||
break;
|
||||
case TAR_DIR:
|
||||
err = vfs_create(vfsroot, entry.name, &entryattr, V_TYPE_DIR, &node);
|
||||
if (err)
|
||||
break;
|
||||
|
||||
VOP_RELEASE(node);
|
||||
err = vfs_create(vfsroot, entry.name, &entryattr, V_TYPE_DIR, NULL);
|
||||
break;
|
||||
case TAR_SYMLINK:
|
||||
err = vfs_link(NULL, entry.link, vfsroot, entry.name, V_TYPE_LINK, &entryattr);
|
||||
|
||||
+10
-1
@@ -93,6 +93,7 @@ int vfs_open(vnode_t *ref, char *path, int flags, vnode_t **res) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// if node is not NULL, then a reference is kept and the newnode is returned in node
|
||||
int vfs_create(vnode_t *ref, char *path, vattr_t *attr, int type, vnode_t **node) {
|
||||
vnode_t *parent;
|
||||
char *component = alloc(strlen(path) + 1);
|
||||
@@ -100,10 +101,18 @@ int vfs_create(vnode_t *ref, char *path, vattr_t *attr, int type, vnode_t **node
|
||||
if (err)
|
||||
goto cleanup;
|
||||
|
||||
vnode_t *ret;
|
||||
VOP_LOCK(parent);
|
||||
err = VOP_CREATE(parent, component, attr, type, node, getcred());
|
||||
err = VOP_CREATE(parent, component, attr, type, &ret, getcred());
|
||||
VOP_UNLOCK(parent);
|
||||
VOP_RELEASE(parent);
|
||||
if (err)
|
||||
goto cleanup;
|
||||
|
||||
if (node)
|
||||
*node = ret;
|
||||
else
|
||||
VOP_RELEASE(ret);
|
||||
|
||||
cleanup:
|
||||
free(component);
|
||||
|
||||
@@ -25,7 +25,8 @@ typedef struct {
|
||||
timespec_t atime;
|
||||
timespec_t mtime;
|
||||
timespec_t ctime;
|
||||
int rdev;
|
||||
int rdevmajor;
|
||||
int rdevminor;
|
||||
size_t blocksused;
|
||||
} vattr_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user