venti.h: import indentation from plan 9

R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/4571065
This commit is contained in:
David du Colombier 2011-06-13 14:40:51 -04:00 committed by Russ Cox
parent 8aeb3ea1c0
commit 79793adc21

View file

@ -17,27 +17,28 @@ enum
}; };
typedef struct Packet Packet; typedef struct Packet Packet;
Packet *packetalloc(void);
void packetfree(Packet*); Packet* packetalloc(void);
Packet *packetforeign(uchar *buf, int n, void (*free)(void *a), void *a);
Packet *packetdup(Packet*, int offset, int n);
Packet *packetsplit(Packet*, int n);
int packetconsume(Packet*, uchar *buf, int n);
int packettrim(Packet*, int offset, int n);
uchar *packetheader(Packet*, int n);
uchar *packettrailer(Packet*, int n);
void packetprefix(Packet*, uchar *buf, int n);
void packetappend(Packet*, uchar *buf, int n); void packetappend(Packet*, uchar *buf, int n);
void packetconcat(Packet*, Packet*);
uchar *packetpeek(Packet*, uchar *buf, int offset, int n);
int packetcopy(Packet*, uchar *buf, int offset, int n);
int packetfragments(Packet*, IOchunk*, int nio, int offset);
uint packetsize(Packet*);
uint packetasize(Packet*); uint packetasize(Packet*);
int packetcompact(Packet*);
int packetcmp(Packet*, Packet*); int packetcmp(Packet*, Packet*);
void packetstats(void); int packetcompact(Packet*);
void packetconcat(Packet*, Packet*);
int packetconsume(Packet*, uchar *buf, int n);
int packetcopy(Packet*, uchar *buf, int offset, int n);
Packet* packetdup(Packet*, int offset, int n);
Packet* packetforeign(uchar *buf, int n, void (*free)(void *a), void *a);
int packetfragments(Packet*, IOchunk*, int nio, int offset);
void packetfree(Packet*);
uchar* packetheader(Packet*, int n);
uchar* packetpeek(Packet*, uchar *buf, int offset, int n);
void packetprefix(Packet*, uchar *buf, int n);
void packetsha1(Packet*, uchar sha1[20]); void packetsha1(Packet*, uchar sha1[20]);
uint packetsize(Packet*);
Packet* packetsplit(Packet*, int n);
void packetstats(void);
uchar* packettrailer(Packet*, int n);
int packettrim(Packet*, int offset, int n);
/* XXX should be own library? */ /* XXX should be own library? */
/* /*
@ -64,12 +65,12 @@ struct VtLogChunk
char *wp; char *wp;
}; };
VtLog *vtlogopen(char *name, uint size); VtLog* vtlogopen(char *name, uint size);
void vtlogprint(VtLog *log, char *fmt, ...); void vtlogprint(VtLog *log, char *fmt, ...);
void vtlog(char *name, char *fmt, ...); void vtlog(char *name, char *fmt, ...);
void vtlogclose(VtLog*); void vtlogclose(VtLog*);
void vtlogremove(char *name); void vtlogremove(char *name);
char **vtlognames(int*); char** vtlognames(int*);
void vtlogdump(int fd, VtLog*); void vtlogdump(int fd, VtLog*);
/* XXX begin actual venti.h */ /* XXX begin actual venti.h */
@ -206,11 +207,11 @@ int vtscorefmt(Fmt*);
* error-checking malloc et al. * error-checking malloc et al.
*/ */
void vtfree(void *); void vtfree(void *);
void *vtmalloc(int); void* vtmalloc(int);
void *vtmallocz(int); void* vtmallocz(int);
void *vtrealloc(void *p, int); void* vtrealloc(void *p, int);
void *vtbrk(int n); void* vtbrk(int n);
char *vtstrdup(char *); char* vtstrdup(char *);
/* /*
* Venti protocol * Venti protocol
@ -297,7 +298,7 @@ struct VtFcall
Packet *data; /* Rread, Twrite */ Packet *data; /* Rread, Twrite */
}; };
Packet *vtfcallpack(VtFcall*); Packet* vtfcallpack(VtFcall*);
int vtfcallunpack(VtFcall*, Packet*); int vtfcallunpack(VtFcall*, Packet*);
void vtfcallclear(VtFcall*); void vtfcallclear(VtFcall*);
int vtfcallfmt(Fmt*); int vtfcallfmt(Fmt*);
@ -333,15 +334,15 @@ struct VtConn
char addr[256]; /* address of other side */ char addr[256]; /* address of other side */
}; };
VtConn *vtconn(int infd, int outfd); VtConn* vtconn(int infd, int outfd);
VtConn *vtdial(char*); VtConn* vtdial(char*);
void vtfreeconn(VtConn*); void vtfreeconn(VtConn*);
int vtsend(VtConn*, Packet*); int vtsend(VtConn*, Packet*);
Packet *vtrecv(VtConn*); Packet* vtrecv(VtConn*);
int vtversion(VtConn *z); int vtversion(VtConn* z);
void vtdebug(VtConn *z, char*, ...); void vtdebug(VtConn* z, char*, ...);
void vthangup(VtConn *z); void vthangup(VtConn* z);
int vtgoodbye(VtConn *z); int vtgoodbye(VtConn* z);
/* #pragma varargck argpos vtdebug 2 */ /* #pragma varargck argpos vtdebug 2 */
@ -358,21 +359,21 @@ struct VtReq
}; };
int vtsrvhello(VtConn*); int vtsrvhello(VtConn*);
VtSrv *vtlisten(char *addr); VtSrv* vtlisten(char *addr);
VtReq *vtgetreq(VtSrv*); VtReq* vtgetreq(VtSrv*);
void vtrespond(VtReq*); void vtrespond(VtReq*);
/* client */ /* client */
Packet *vtrpc(VtConn*, Packet*); Packet* vtrpc(VtConn*, Packet*);
Packet *_vtrpc(VtConn*, Packet*, VtFcall*); Packet* _vtrpc(VtConn*, Packet*, VtFcall*);
void vtrecvproc(void*); /* VtConn* */ void vtrecvproc(void*); /* VtConn */
void vtsendproc(void*); /* VtConn* */ void vtsendproc(void*); /* VtConn */
int vtconnect(VtConn*); int vtconnect(VtConn*);
int vthello(VtConn*); int vthello(VtConn*);
int vtread(VtConn*, uchar score[VtScoreSize], uint type, uchar *buf, int n); int vtread(VtConn*, uchar score[VtScoreSize], uint type, uchar *buf, int n);
int vtwrite(VtConn*, uchar score[VtScoreSize], uint type, uchar *buf, int n); int vtwrite(VtConn*, uchar score[VtScoreSize], uint type, uchar *buf, int n);
Packet *vtreadpacket(VtConn*, uchar score[VtScoreSize], uint type, int n); Packet* vtreadpacket(VtConn*, uchar score[VtScoreSize], uint type, int n);
int vtwritepacket(VtConn*, uchar score[VtScoreSize], uint type, Packet *p); int vtwritepacket(VtConn*, uchar score[VtScoreSize], uint type, Packet *p);
int vtsync(VtConn*); int vtsync(VtConn*);
int vtping(VtConn*); int vtping(VtConn*);
@ -414,15 +415,16 @@ struct VtBlock
u32int vtglobaltolocal(uchar[VtScoreSize]); u32int vtglobaltolocal(uchar[VtScoreSize]);
void vtlocaltoglobal(u32int, uchar[VtScoreSize]); void vtlocaltoglobal(u32int, uchar[VtScoreSize]);
VtCache *vtcachealloc(VtConn*, ulong maxmem); VtCache*vtcachealloc(VtConn*, ulong maxmem);
void vtcachefree(VtCache*); void vtcachefree(VtCache*);
VtBlock *vtcachelocal(VtCache*, u32int addr, int type); VtBlock*vtcachelocal(VtCache*, u32int addr, int type);
VtBlock *vtcacheglobal(VtCache*, uchar[VtScoreSize], int type, ulong size); VtBlock*vtcacheglobal(VtCache*, uchar[VtScoreSize], int type, ulong size);
VtBlock *vtcacheallocblock(VtCache*, int type, ulong size); VtBlock*vtcacheallocblock(VtCache*, int type, ulong size);
void vtcachesetwrite(VtCache*, int(*)(VtConn*,uchar[VtScoreSize],uint,uchar*,int)); void vtcachesetwrite(VtCache*,
int(*)(VtConn*, uchar[VtScoreSize], uint, uchar*, int));
void vtblockput(VtBlock*); void vtblockput(VtBlock*);
int vtblockwrite(VtBlock*); int vtblockwrite(VtBlock*);
VtBlock *vtblockcopy(VtBlock*); VtBlock*vtblockcopy(VtBlock*);
void vtblockduplock(VtBlock*); void vtblockduplock(VtBlock*);
extern int vtcachencopy, vtcachenread, vtcachenwrite; extern int vtcachencopy, vtcachenread, vtcachenwrite;
@ -460,32 +462,32 @@ enum
VtORDWR VtORDWR
}; };
VtFile *vtfileopenroot(VtCache*, VtEntry*); VtBlock*vtfileblock(VtFile*, u32int, int mode);
VtFile *vtfilecreateroot(VtCache*, int psize, int dsize, int type);
VtFile *vtfileopen(VtFile*, u32int, int);
VtFile *vtfilecreate(VtFile*, int psize, int dsize, int dir);
VtFile *_vtfilecreate(VtFile*, int offset, int psize, int dsize, int dir);
VtBlock *vtfileblock(VtFile*, u32int, int mode);
long vtfileread(VtFile*, void*, long, vlong);
long vtfilewrite(VtFile*, void*, long, vlong);
int vtfileflush(VtFile*);
void vtfileincref(VtFile*);
void vtfileclose(VtFile*);
int vtfilegetentry(VtFile*, VtEntry*);
int vtfilesetentry(VtFile*, VtEntry*);
int vtfileblockscore(VtFile*, u32int, uchar[VtScoreSize]); int vtfileblockscore(VtFile*, u32int, uchar[VtScoreSize]);
u32int vtfilegetdirsize(VtFile*); void vtfileclose(VtFile*);
int vtfilesetdirsize(VtFile*, u32int); VtFile* _vtfilecreate(VtFile*, int offset, int psize, int dsize, int dir);
void vtfileunlock(VtFile*); VtFile* vtfilecreate(VtFile*, int psize, int dsize, int dir);
int vtfilelock(VtFile*, int); VtFile* vtfilecreateroot(VtCache*, int psize, int dsize, int type);
int vtfilelock2(VtFile*, VtFile*, int); int vtfileflush(VtFile*);
int vtfileflushbefore(VtFile*, u64int); int vtfileflushbefore(VtFile*, u64int);
int vtfiletruncate(VtFile*); u32int vtfilegetdirsize(VtFile*);
int vtfilegetentry(VtFile*, VtEntry*);
uvlong vtfilegetsize(VtFile*); uvlong vtfilegetsize(VtFile*);
int vtfilesetsize(VtFile*, u64int); void vtfileincref(VtFile*);
int vtfilelock2(VtFile*, VtFile*, int);
int vtfilelock(VtFile*, int);
VtFile* vtfileopen(VtFile*, u32int, int);
VtFile* vtfileopenroot(VtCache*, VtEntry*);
long vtfileread(VtFile*, void*, long, vlong);
int vtfileremove(VtFile*); int vtfileremove(VtFile*);
int vtfilesetdirsize(VtFile*, u32int);
int vtfilesetentry(VtFile*, VtEntry*);
int vtfilesetsize(VtFile*, u64int);
int vtfiletruncate(VtFile*);
void vtfileunlock(VtFile*);
long vtfilewrite(VtFile*, void*, long, vlong);
extern int vttimefmt(Fmt*); int vttimefmt(Fmt*);
extern int chattyventi; extern int chattyventi;
extern int ventidoublechecksha1; extern int ventidoublechecksha1;