mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
tmpfs: misc fixes
This commit is contained in:
@@ -166,6 +166,7 @@ static int tmpfs_create(vnode_t *parent, char *name, vattr_t *attr, int type, vn
|
|||||||
tmpattr.ctime = time;
|
tmpattr.ctime = time;
|
||||||
tmpattr.mtime = time;
|
tmpattr.mtime = time;
|
||||||
tmpattr.size = 0;
|
tmpattr.size = 0;
|
||||||
|
tmpattr.type = type;
|
||||||
int error = tmpfs_setattr(node, &tmpattr, cred);
|
int error = tmpfs_setattr(node, &tmpattr, cred);
|
||||||
tmpnode->attr.nlinks = 1;
|
tmpnode->attr.nlinks = 1;
|
||||||
|
|
||||||
@@ -335,7 +336,7 @@ static int tmpfs_link(vnode_t *node, vnode_t *dir, char *name, cred_t *cred) {
|
|||||||
tmpfsnode_t *tmpdir = (tmpfsnode_t *)dir;
|
tmpfsnode_t *tmpdir = (tmpfsnode_t *)dir;
|
||||||
size_t namelen = strlen(name);
|
size_t namelen = strlen(name);
|
||||||
void *v;
|
void *v;
|
||||||
VOP_LOCK(node);
|
VOP_LOCK(dir);
|
||||||
if (hashtable_get(&tmpdir->children, &v, name, namelen) == 0) {
|
if (hashtable_get(&tmpdir->children, &v, name, namelen) == 0) {
|
||||||
VOP_UNLOCK(node);
|
VOP_UNLOCK(node);
|
||||||
return EEXIST;
|
return EEXIST;
|
||||||
@@ -364,7 +365,6 @@ static int tmpfs_symlink(vnode_t *node, char *name, vattr_t *attr, char *path, c
|
|||||||
strcpy(pathbuf, path);
|
strcpy(pathbuf, path);
|
||||||
|
|
||||||
vnode_t *linknode = NULL;
|
vnode_t *linknode = NULL;
|
||||||
|
|
||||||
int err = tmpfs_create(node, name, attr, V_TYPE_LINK, &linknode, cred);
|
int err = tmpfs_create(node, name, attr, V_TYPE_LINK, &linknode, cred);
|
||||||
if (err) {
|
if (err) {
|
||||||
free(pathbuf);
|
free(pathbuf);
|
||||||
@@ -463,11 +463,12 @@ static int tmpfs_getdents(vnode_t *node, dent_t *buffer, size_t count, uintmax_t
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
dent_t *ent = &buffer[*readcount];
|
dent_t *ent = &buffer[*readcount];
|
||||||
|
tmpfsnode_t *itmpnode = entry->value;
|
||||||
|
|
||||||
ent->d_ino = tmpnode->attr.inode;
|
ent->d_ino = itmpnode->attr.inode;
|
||||||
ent->d_off = offset;
|
ent->d_off = offset;
|
||||||
ent->d_reclen = sizeof(dent_t);
|
ent->d_reclen = sizeof(dent_t);
|
||||||
ent->d_type = vfs_getposixtype(node->type);
|
ent->d_type = vfs_getposixtype(itmpnode->vnode.type);
|
||||||
strcpy(ent->d_name, entry->key);
|
strcpy(ent->d_name, entry->key);
|
||||||
|
|
||||||
*readcount += 1;
|
*readcount += 1;
|
||||||
|
|||||||
+1
-1
@@ -144,7 +144,7 @@ int vfs_link(vnode_t *destref, char *destpath, vnode_t *linkref, char *linkpath,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (type == V_TYPE_REGULAR) {
|
if (type == V_TYPE_REGULAR) {
|
||||||
vnode_t *targetnode;
|
vnode_t *targetnode = NULL;
|
||||||
err = vfs_lookup(&targetnode, destref, destpath, NULL, 0);
|
err = vfs_lookup(&targetnode, destref, destpath, NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
VOP_RELEASE(parent);
|
VOP_RELEASE(parent);
|
||||||
|
|||||||
Reference in New Issue
Block a user