Nucleus
Barry New list iteration in VFS f97b909 (3 years, 3 months ago)
diff --git a/vfs/inode.c b/vfs/inode.c
index 3f760e7..03c301d 100644
--- a/vfs/inode.c
+++ b/vfs/inode.c
@@ -17,6 +17,7 @@
static void inode_new(Object *);
static void inode_delete(Object *);
+static void inode_copy(Object *, Object *);
/* Inode object type */
ObjectType inodeType = {
@@ -24,6 +25,7 @@ ObjectType inodeType = {
.size = sizeof(Inode),
.new = inode_new,
.delete = inode_delete,
+ .copy = inode_copy,
};
/* Create a new Inode */
@@ -51,6 +53,28 @@ inode_delete(Object *obj)
destroy_list(inode->pages);
}
+/* Copy an Inode */
+static void
+inode_copy(Object *a, Object *b)
+{
+ Inode *parent = (void *) a, *child = (void *) b;
+ child->ino = parent->ino;
+ child->uid = parent->uid;
+ child->gid = parent->gid;
+ child->mode = parent->mode;
+ child->nlink = parent->nlink;
+ child->size = parent->size;
+ child->dev = parent->dev;
+ child->ops = parent->ops;
+ child->fileOps = parent->fileOps;
+ if (parent->super)
+ child->super = get(parent->super);
+ if (parent->dirEntries)
+ child->dirEntries = copy_list(parent->dirEntries);
+ if (parent->pages)
+ child->pages = copy_list(parent->pages);
+}
+
/* Check if a process has permission to access an inode */
int
permission(Inode *inode, int mask)