Newer
Older
ubixos-tools / include / inode.h
#ifndef INODE_H
#define INODE_H

#include "superblock.h"

#define INODE_IN_USE      0x00000001
#define ATTR_INODE        0x00000004
#define INODE_LOGGED      0x00000008
#define INODE_DELETED     0x00000010
#define PERMANENT_FLAGS   0x0000ffff
#define INODE_NO_CACHE    0x00010000
#define INODE_WAS_WRITTEN 0x00020000
#define NO_TRANSACTION    0x00040000

#define NUM_DIRECT_BLOCKS 64
#define MAX_FILENAME_LENGTH 256

typedef struct dataStream {
  struct blockRun direct[NUM_DIRECT_BLOCKS];
  off_t    maxDirectRange;
  struct blockRun indirect;
  off_t    maxIndirectRange;
  struct blockRun double_indirect;
  off_t    maxDoubleIndirectRange;
  off_t    size;
} dataStream;

typedef struct ubixfsInode {
  int32       magic1        __attribute__ ((packed));
  inodeAddr   inodeNum      __attribute__ ((packed));
  char        name[MAX_FILENAME_LENGTH]  __attribute__ ((packed));
  int32       uid           __attribute__ ((packed));
  int32       gid           __attribute__ ((packed));
  int32       mode          __attribute__ ((packed));
  int32       flags         __attribute__ ((packed));
 // uInt64      createTime    __attribute_ ((packed));
 // uInt64      lastModifiedTime __attribute__ (packed));
//  inodeAddr   attributes    __attribute__ ((packed));
  uInt32      type          __attribute__ ((packed));
  int32       inodeSize     __attribute__ ((packed));
  struct ubixfsInode * parentBigPtr __attribute__ ((packed));
  struct ubixfsInode * parent      __attribute__ ((packed));
  struct ubixfsInode * nextBigPtr  __attribute__ ((packed));
  struct ubixfsInode * next        __attribute__ ((packed));
  struct ubixfsInode * prevBigPtr  __attribute__ ((packed));
  struct ubixfsInode * prev        __attribute__ ((packed));
// binodeEtc *etc ??
  dataStream  data          __attribute__ ((packed));
  char       smallData[3220]  __attribute__ ((packed));
} ubixfsInode;
#endif