perf: Treat the kernel like [kernel.kallsyms]
[akaros.git] / kern / include / ext2fs.h
index 0b56757..7d101c0 100644 (file)
@@ -8,8 +8,7 @@
  *
  * Note all of ext2's disk structures are little-endian. */
 
-#ifndef ROS_KERN_EXT2FS_H
-#define ROS_KERN_EXT2FS_H
+#pragma once
 
 #include <ros/common.h>
 #include <vfs.h>
@@ -221,7 +220,7 @@ struct ext2_inode {
        uint32_t                                        i_mtime;
        uint32_t                                        i_dtime;                        /* delete time */
        uint16_t                                        i_gid;
-       uint16_t                                        i_links_cnt;            /* fs_ino->i_nlinks */
+       uint16_t                                        i_links_cnt;            /* fs_ino->i_nlink */
        uint32_t                                        i_blocks;                       /* num blocks reserved */
        uint32_t                                        i_flags;                        /* how to access data */
        uint32_t                                        i_osd1;                         /* OS dependent */
@@ -238,9 +237,27 @@ struct ext2_inode {
 struct ext2_dirent {
        uint32_t                                        dir_inode;                      /* inode */
        uint16_t                                        dir_reclen;                     /* len, including padding */
-       uint8_t                                         dir_namelen;            /* len of dir_name */
+       uint8_t                                         dir_namelen;            /* len of dir_name w/o \0 */
        uint8_t                                         dir_filetype;
        uint8_t                                         dir_name[256];          /* might be < 255 on disc */
 };
 
-#endif /* ROS_KERN_EXT2FS_H */
+/* Every FS must extern it's type, and be included in vfs_init() */
+extern struct fs_type ext2_fs_type;
+
+/* This hangs off the VFS's SB, and tracks in-memory copies of the disc SB and
+ * the block group descriptor table.  For now, s_dirty (VFS) will track the
+ * dirtiness of all things hanging off the sb.  Both of the objects contained
+ * are kmalloc()d, as is this struct. */
+struct ext2_sb_info {
+       struct ext2_sb                          *e2sb;
+       struct ext2_block_group         *e2bg;
+       unsigned int                            nr_bgs;
+};
+
+/* Inode in-memory data.  This stuff is in cpu-native endianness.  If we start
+ * using the data in the actual inode and in the buffer cache, change
+ * ext2_my_bh() and its two callers.  Assume this data is dirty. */
+struct ext2_i_info {
+       uint32_t                                        i_block[15];            /* list of blocks reserved*/
+};