BarryServer : Git

All the code for all my projects
// BarryServer : Git / Orion / commit / 1628fcfdfdf2978ed9ccac96ee7d13bb3dc43a01 / vfs

// Related

Orion

Barry Keyboard/Mouse drivers + POSIX names for structs 1628fcf (2 years, 4 months ago)
diff --git a/vfs/devfs/file.c b/vfs/devfs/file.c
index d2da4e4..95d8aeb 100644
--- a/vfs/devfs/file.c
+++ b/vfs/devfs/file.c
@@ -53,32 +53,32 @@ devfs_readdir(File *file, DirEnt *dent, off_t index)
 	DirEntry *de;
 
 	if (!index--) {
-		dent->ino = file->inode->ino;
-		dent->type = DT_DIR;
-		dent->namelen = 2;
-		strncpy(dent->name, ".", dent->namelen);
+		dent->d_ino = file->inode->ino;
+		dent->d_type = DT_DIR;
+		dent->d_namelen = 2;
+		strncpy(dent->d_name, ".", dent->d_namelen);
 		return 0;
 	}
 
 	for (de = file->inode->dirEntries; de && index; de = de->next, index--);
 	if (!de)
 		return -ENOENT;
-	dent->ino = de->inode->ino;
+	dent->d_ino = de->inode->ino;
 	if (S_ISBLK(de->inode->mode))
-		dent->type = DT_BLK;
+		dent->d_type = DT_BLK;
 	if (S_ISCHR(de->inode->mode))
-		dent->type = DT_CHR;
+		dent->d_type = DT_CHR;
 	if (S_ISDIR(de->inode->mode))
-		dent->type = DT_DIR;
+		dent->d_type = DT_DIR;
 	if (S_ISFIFO(de->inode->mode))
-		dent->type = DT_FIFO;
+		dent->d_type = DT_FIFO;
 	if (S_ISLNK(de->inode->mode))
-		dent->type = DT_LNK;
+		dent->d_type = DT_LNK;
 	if (S_ISREG(de->inode->mode))
-		dent->type = DT_REG;
+		dent->d_type = DT_REG;
 	if (S_ISSOCK(de->inode->mode))
-		dent->type = DT_SOCK;
-	dent->namelen = strnlen(de->name, NAME_MAX) + 1;
-	strncpy(dent->name, de->name, NAME_MAX);
+		dent->d_type = DT_SOCK;
+	dent->d_namelen = strnlen(de->name, NAME_MAX) + 1;
+	strncpy(dent->d_name, de->name, NAME_MAX);
 	return 0;
 }
diff --git a/vfs/ext2fs/file.c b/vfs/ext2fs/file.c
index d0caa35..9701e37 100644
--- a/vfs/ext2fs/file.c
+++ b/vfs/ext2fs/file.c
@@ -71,10 +71,10 @@ ext2fs_readdir(File *file, DirEnt *dent, off_t index)
 	}
 	if (!de->ino)
 		return -ENOENT;
-	dent->ino = de->ino;
-	dent->type = de->type;
-	dent->namelen = de->nameLen + 1;
-	strncpy(dent->name, de->name, de->size);
+	dent->d_ino = de->ino;
+	dent->d_type = de->type;
+	dent->d_namelen = de->nameLen + 1;
+	strncpy(dent->d_name, de->name, de->size);
 	return 0;
 }
 
diff --git a/vfs/procfs/file.c b/vfs/procfs/file.c
index b292cf4..979c2c9 100644
--- a/vfs/procfs/file.c
+++ b/vfs/procfs/file.c
@@ -88,33 +88,33 @@ procfs_readdir(File *file, DirEnt *dent, off_t index)
 	DirEntry *de;
 
 	if (!index--) {
-		dent->ino = file->inode->ino;
-		dent->type = DT_DIR;
-		dent->namelen = 2;
-		strncpy(dent->name, ".", dent->namelen);
+		dent->d_ino = file->inode->ino;
+		dent->d_type = DT_DIR;
+		dent->d_namelen = 2;
+		strncpy(dent->d_name, ".", dent->d_namelen);
 		return 0;
 	}
 
 	for (de = file->inode->dirEntries; de && index; de = de->next, index--);
 	if (!de)
 		return -ENOENT;
-	dent->ino = de->inode->ino;
+	dent->d_ino = de->inode->ino;
 	if (S_ISBLK(de->inode->mode))
-		dent->type = DT_BLK;
+		dent->d_type = DT_BLK;
 	if (S_ISCHR(de->inode->mode))
-		dent->type = DT_CHR;
+		dent->d_type = DT_CHR;
 	if (S_ISDIR(de->inode->mode))
-		dent->type = DT_DIR;
+		dent->d_type = DT_DIR;
 	if (S_ISFIFO(de->inode->mode))
-		dent->type = DT_FIFO;
+		dent->d_type = DT_FIFO;
 	if (S_ISLNK(de->inode->mode))
-		dent->type = DT_LNK;
+		dent->d_type = DT_LNK;
 	if (S_ISREG(de->inode->mode))
-		dent->type = DT_REG;
+		dent->d_type = DT_REG;
 	if (S_ISSOCK(de->inode->mode))
-		dent->type = DT_SOCK;
-	dent->namelen = strnlen(de->name, NAME_MAX) + 1;
-	strncpy(dent->name, de->name, NAME_MAX);
+		dent->d_type = DT_SOCK;
+	dent->d_namelen = strnlen(de->name, NAME_MAX) + 1;
+	strncpy(dent->d_name, de->name, NAME_MAX);
 	return 0;
 }
 
diff --git a/vfs/tmpfs/file.c b/vfs/tmpfs/file.c
index bc320ed..275e77c 100644
--- a/vfs/tmpfs/file.c
+++ b/vfs/tmpfs/file.c
@@ -90,33 +90,33 @@ tmpfs_readdir(File *file, DirEnt *dent, off_t index)
 	DirEntry *de;
 
 	if (!index--) {
-		dent->ino = file->inode->ino;
-		dent->type = DT_DIR;
-		dent->namelen = 2;
-		strncpy(dent->name, ".", dent->namelen);
+		dent->d_ino = file->inode->ino;
+		dent->d_type = DT_DIR;
+		dent->d_namelen = 2;
+		strncpy(dent->d_name, ".", dent->d_namelen);
 		return 0;
 	}
 
 	for (de = file->inode->dirEntries; de && index; de = de->next, index--);
 	if (!de)
 		return -ENOENT;
-	dent->ino = de->inode->ino;
+	dent->d_ino = de->inode->ino;
 	if (S_ISBLK(de->inode->mode))
-		dent->type = DT_BLK;
+		dent->d_type = DT_BLK;
 	if (S_ISCHR(de->inode->mode))
-		dent->type = DT_CHR;
+		dent->d_type = DT_CHR;
 	if (S_ISDIR(de->inode->mode))
-		dent->type = DT_DIR;
+		dent->d_type = DT_DIR;
 	if (S_ISFIFO(de->inode->mode))
-		dent->type = DT_FIFO;
+		dent->d_type = DT_FIFO;
 	if (S_ISLNK(de->inode->mode))
-		dent->type = DT_LNK;
+		dent->d_type = DT_LNK;
 	if (S_ISREG(de->inode->mode))
-		dent->type = DT_REG;
+		dent->d_type = DT_REG;
 	if (S_ISSOCK(de->inode->mode))
-		dent->type = DT_SOCK;
-	dent->namelen = strnlen(de->name, NAME_MAX) + 1;
-	strncpy(dent->name, de->name, NAME_MAX);
+		dent->d_type = DT_SOCK;
+	dent->d_namelen = strnlen(de->name, NAME_MAX) + 1;
+	strncpy(dent->d_name, de->name, NAME_MAX);
 	return 0;
 }
 
diff --git a/vfs/vfs.c b/vfs/vfs.c
index c4784f2..396fd8f 100644
--- a/vfs/vfs.c
+++ b/vfs/vfs.c
@@ -475,7 +475,7 @@ getdents(int fd, void *buf, size_t count)
 		err = file_readdir(file, dent, i);
 		if (err < 0)
 			goto out;
-		size += sizeof(DirEnt) + dent->namelen;
+		size += sizeof(DirEnt) + dent->d_namelen;
 		*((char *) buf + size - 1) = '\0';
 		dent = (void *) ((char *) buf + size);
 	}