mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +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);
|
VOP_RELEASE(node);
|
||||||
break;
|
break;
|
||||||
case TAR_DIR:
|
case TAR_DIR:
|
||||||
err = vfs_create(vfsroot, entry.name, &entryattr, V_TYPE_DIR, &node);
|
err = vfs_create(vfsroot, entry.name, &entryattr, V_TYPE_DIR, NULL);
|
||||||
if (err)
|
|
||||||
break;
|
|
||||||
|
|
||||||
VOP_RELEASE(node);
|
|
||||||
break;
|
break;
|
||||||
case TAR_SYMLINK:
|
case TAR_SYMLINK:
|
||||||
err = vfs_link(NULL, entry.link, vfsroot, entry.name, V_TYPE_LINK, &entryattr);
|
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;
|
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) {
|
int vfs_create(vnode_t *ref, char *path, vattr_t *attr, int type, vnode_t **node) {
|
||||||
vnode_t *parent;
|
vnode_t *parent;
|
||||||
char *component = alloc(strlen(path) + 1);
|
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)
|
if (err)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
vnode_t *ret;
|
||||||
VOP_LOCK(parent);
|
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_UNLOCK(parent);
|
||||||
VOP_RELEASE(parent);
|
VOP_RELEASE(parent);
|
||||||
|
if (err)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (node)
|
||||||
|
*node = ret;
|
||||||
|
else
|
||||||
|
VOP_RELEASE(ret);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
free(component);
|
free(component);
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ typedef struct {
|
|||||||
timespec_t atime;
|
timespec_t atime;
|
||||||
timespec_t mtime;
|
timespec_t mtime;
|
||||||
timespec_t ctime;
|
timespec_t ctime;
|
||||||
int rdev;
|
int rdevmajor;
|
||||||
|
int rdevminor;
|
||||||
size_t blocksused;
|
size_t blocksused;
|
||||||
} vattr_t;
|
} vattr_t;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user