Changeset 761

Show
Ignore:
Timestamp:
07/09/08 15:27:44 (5 months ago)
Author:
mwhitworth
Message:

Misc fixes and tidy up in headers.

Location:
Whitix/branches/fs/include
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/fs/include/fs/bcache.h

    r750 r761  
    2525#define VFS_BCACHE_H 
    2626 
     27#include <sdevice.h> 
     28#include <wait.h> 
     29 
    2730/* Buffer flags. Bit index into buffer->flags. */ 
    2831#define BUFFER_DIRTY    0x0 
    2932#define BUFFER_LOCKED   0x1 
     33#define BUFFER_JOURNAL  0x2 
    3034 
    3135/* Defines for dealing with flags. */ 
    3236#define BufferLocked(buffer) ((buffer)->flags & (1 << BUFFER_LOCKED)) 
    3337#define BufferDirty(buffer) ((buffer)->flags & (1 << BUFFER_DIRTY)) 
     38#define BufferJournal(buffer) ((buffer)->flags & (1 << BUFFER_JOURNAL)) 
    3439 
    3540/* Reference counting. Blocks are only freed if there are no references 
  • Whitix/branches/fs/include/fs/journal.h

    r755 r761  
    2727#include <preempt.h> 
    2828#include <task.h> 
     29#include <sched.h> 
    2930#include <timer.h> 
    3031#include <typedefs.h> 
     32#include <wait.h> 
    3133 
    3234/* In-memory structures. */ 
    3335 
    34 #define JTRANS_RUNNING  1 
     36/* Types of list the head can be added to. */ 
     37#define JOURN_RESERVED  1 
     38#define JOURN_METADATA  2 
    3539 
    3640struct JournalHead 
    3741{ 
    3842        struct Buffer* buffer; 
     43        struct JournalTrans* transaction; 
     44        int list; 
     45        struct ListHead next; 
    3946}; 
     47 
     48#define JTRANS_RUNNING  1 
    4049 
    4150struct JournalTrans 
     
    4352        struct Journal* journal; 
    4453        int state, transId, outstandingBlocks; 
    45         struct Timer* expireTimer; 
     54        DWORD expires; 
    4655        int updates, handleCount; 
     56 
     57        /* Lists */ 
     58        struct ListHead reservedList; 
     59        struct ListHead metaDataList; 
    4760}; 
    4861 
     
    5063struct JournalHandle 
    5164{ 
    52         int refs, numBlocks; 
     65        int refs, numBlocks, sync; 
    5366        struct JournalTrans* transaction; 
    5467}; 
     68 
     69#define JOURN_COMMIT_INTERVAL   2 /* seconds */ 
    5570 
    5671struct Journal 
     
    5974        int version; 
    6075        DWORD maxLength, sectorSize, maxTransactionBuffers; 
    61         DWORD transSequence; 
    62         struct JournalTrans* currTransaction; 
     76 
     77        /* Sequence numbers. */ 
     78        DWORD transSequence, commitSequence, commitRequest; 
     79 
     80        /* Block management. */ 
     81        DWORD head, free; 
     82 
     83        struct JournalTrans* currTransaction, *committingTrans; 
     84        struct Thread* commitThread; 
     85        WaitQueue commitWait, commitWaitDone; 
     86        int commitInterval; 
    6387}; 
    6488 
     
    7094        DWORD blockType; 
    7195        DWORD sequence; 
    72 }; 
     96}PACKED; 
    7397 
     98/* Block types. */ 
     99#define JFS_DESC_BLOCK          1 
    74100#define JFS_SUPERBLOCK_V1       3 
    75101#define JFS_SUPERBLOCK_V2       4 
     
    84110        DWORD first; 
    85111 
    86         /* TODO: Complete. */ 
     112        DWORD sequence; 
     113        DWORD start; 
     114 
     115        DWORD errNo; 
    87116}; 
    88117 
     
    92121struct Journal* JournalCreate(struct VNode* vNode); 
    93122struct JournalHandle* JournalStart(struct Journal* journal, int numBlocks); 
     123int JournalStop(struct JournalHandle* handle); 
    94124struct JournalHead* JournalAddHeader(struct Buffer* buffer); 
     125struct JournalHead* JournalGetDescriptorBuffer(struct Journal* journal); 
    95126 
    96127/* transaction.c */ 
    97128int JournalGetWriteAccess(struct JournalHandle* handle, struct Buffer* buffer); 
     129int JournalDirtyMetadata(struct JournalHandle* handle, struct Buffer* buffer); 
     130int JournalForceCommit(struct Journal* journal); 
     131 
     132/* commit.c */ 
     133int JournalStartCommit(struct Journal* journal, struct JournalTrans* trans); 
     134int JournalWaitCommit(struct Journal* journal, int id); 
     135int JournalCommitTransaction(struct Journal* journal); 
     136 
     137/* recovery.c */ 
     138int JournalRecover(struct Journal* journal, struct JournalSuperBlock* jSb); 
    98139 
    99140/* Defines */ 
     
    111152        PreemptEnable() 
    112153 
     154#define JournHeadToBuffer(head) \ 
     155        (head)->buffer 
     156 
     157#define BufferToJournHead(buffer) \ 
     158        (buffer)->privData 
     159 
    113160#endif 
  • Whitix/branches/fs/include/i386/pit.h

    r608 r761  
    3333 
    3434#define HZ 100 
    35 #define CLOCK_TICK_RATE 1193182 /* The PIT's underlying HZ */ 
     35#define CLOCK_TICK_RATE 1193180 /* The PIT's underlying HZ */ 
    3636#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) 
    3737 
  • Whitix/branches/fs/include/sched.h

    r608 r761  
    4141/* stackP is not applicable to kernel threads. */ 
    4242#define ThrCreateKernelThread(address) (ThrCreateThread(NULL,(DWORD)(address),false,0, NULL)) 
     43#define ThrCreateKernelThreadArg(address, arg) (ThrCreateThread(NULL, (DWORD)(address), false, 0, (arg))) 
    4344 
    4445struct Thread* ThrCreateThread(struct Process* parent,DWORD entry,int user,DWORD stackP, void* argument); 
  • Whitix/branches/fs/include/task.h

    r750 r761  
    2020#define TASK_H 
    2121 
    22 #include <fs/journal.h> 
    2322#include <llist.h> 
    2423#include <typedefs.h> 
     
    2827 
    2928struct Process; 
     29struct JournalHandle; 
    3030 
    3131#define THR_USED_MATH 1