File system stuff.
This commit is contained in:
parent
e97ceade5e
commit
d3df308747
29 changed files with 3316 additions and 0 deletions
41
include/fs.h
Normal file
41
include/fs.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _FS_H_
|
||||
#define _FS_H_ 1
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple user-level 9P client.
|
||||
*/
|
||||
|
||||
typedef struct Fsys Fsys;
|
||||
typedef struct Fid Fid;
|
||||
|
||||
Fsys *fsinit(int);
|
||||
Fsys *fsmount(int);
|
||||
|
||||
int fsversion(Fsys*, int, char*, int);
|
||||
Fid *fsauth(Fsys*, char*);
|
||||
Fid *fsattach(Fsys*, Fid*, char*, char*);
|
||||
Fid *fsopen(Fsys*, char*, int);
|
||||
int fsopenfd(Fsys*, char*, int);
|
||||
long fsread(Fid*, void*, long);
|
||||
long fsreadn(Fid*, void*, long);
|
||||
long fswrite(Fid*, void*, long);
|
||||
void fsclose(Fid*);
|
||||
void fsunmount(Fsys*);
|
||||
int fsrpc(Fsys*, Fcall*, Fcall*, void**);
|
||||
Fid *fswalk(Fid*, char*);
|
||||
struct Dir; /* in case there's no lib9.h */
|
||||
long fsdirread(Fid*, struct Dir**);
|
||||
long fsdirreadall(Fid*, struct Dir**);
|
||||
struct Dir *fsdirstat(Fsys*, char*);
|
||||
struct Dir *fsdirfstat(Fid*);
|
||||
int fsdirwstat(Fsys*, char*, struct Dir*);
|
||||
int fsdirfwstat(Fid*, struct Dir*);
|
||||
Fid *fsroot(Fsys*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
54
include/mux.h
Normal file
54
include/mux.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
typedef struct Mux Mux;
|
||||
typedef struct Muxrpc Muxrpc;
|
||||
typedef struct Muxqueue Muxqueue;
|
||||
|
||||
struct Muxrpc
|
||||
{
|
||||
Muxrpc *next;
|
||||
Muxrpc *prev;
|
||||
Rendez r;
|
||||
uint tag;
|
||||
void *p;
|
||||
};
|
||||
|
||||
struct Mux
|
||||
{
|
||||
uint mintag; /* to be filled by client */
|
||||
uint maxtag;
|
||||
int (*send)(Mux*, void*);
|
||||
void *(*recv)(Mux*);
|
||||
int (*gettag)(Mux*, void*);
|
||||
int (*settag)(Mux*, void*, uint);
|
||||
void *aux; /* for private use by client */
|
||||
|
||||
/* private */
|
||||
QLock lk;
|
||||
QLock inlk;
|
||||
QLock outlk;
|
||||
Rendez tagrend;
|
||||
Rendez rpcfork;
|
||||
Muxqueue *readq;
|
||||
Muxqueue *writeq;
|
||||
uint nwait;
|
||||
uint mwait;
|
||||
uint freetag;
|
||||
Muxrpc **wait;
|
||||
uint muxer;
|
||||
Muxrpc sleep;
|
||||
};
|
||||
|
||||
void muxinit(Mux*);
|
||||
void* muxrpc(Mux*, void*);
|
||||
void muxthreads(Mux*);
|
||||
|
||||
/* private */
|
||||
int _muxsend(Mux*, void*);
|
||||
void* _muxrecv(Mux*);
|
||||
void _muxsendproc(void*);
|
||||
void _muxrecvproc(void*);
|
||||
Muxqueue *_muxqalloc(void);
|
||||
int _muxqsend(Muxqueue*, void*);
|
||||
void *_muxqrecv(Muxqueue*);
|
||||
void _muxqhangup(Muxqueue*);
|
||||
void *_muxnbqrecv(Muxqueue*);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue