aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-07-13 03:48:35 +0000
committerrsc <devnull@localhost>2005-07-13 03:48:35 +0000
commit0c98da8bf8ea51d0288222f6c6ba3c125cf20f46 (patch)
treed249da5fdda43c001a6a99f7354084a5cbfbacef /include
parentbe7cbb4ef2cb02aa9ac48c02dc1ee585a8e49043 (diff)
downloadplan9port-0c98da8bf8ea51d0288222f6c6ba3c125cf20f46.tar.gz
plan9port-0c98da8bf8ea51d0288222f6c6ba3c125cf20f46.tar.bz2
plan9port-0c98da8bf8ea51d0288222f6c6ba3c125cf20f46.zip
File system access library.
Diffstat (limited to 'include')
-rw-r--r--include/diskfs.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/include/diskfs.h b/include/diskfs.h
new file mode 100644
index 00000000..9d69bfff
--- /dev/null
+++ b/include/diskfs.h
@@ -0,0 +1,94 @@
+/* Copyright (c) Russ Cox, MIT; see src/libdiskfs/COPYRIGHT */
+
+AUTOLIB(diskfs)
+
+typedef struct Block Block;
+typedef struct Disk Disk;
+typedef struct Fsys Fsys;
+
+#ifndef _NFS3H_ /* in case sunrpc.h, nfs3.h are not included */
+typedef struct SunAuthUnix SunAuthUnix;
+typedef struct Nfs3Attr Nfs3Attr;
+typedef struct Nfs3Entry Nfs3Entry;
+typedef struct Nfs3Handle Nfs3Handle;
+typedef int Nfs3Status;
+#endif
+struct VtCache;
+
+struct Disk
+{
+ Block *(*_read)(Disk *disk, u32int count, u64int offset);
+ int (*_sync)(Disk*);
+ void (*_close)(Disk*);
+ void *priv;
+};
+
+struct Block
+{
+ Disk *disk;
+ u32int len;
+ uchar *data;
+ void (*_close)(Block*);
+ void *priv;
+};
+
+struct Fsys
+{
+ u32int blocksize;
+ u32int nblock;
+ char *type;
+
+ Disk *disk;
+ Block *(*_readblock)(Fsys *fsys, u64int blockno);
+ int (*_sync)(Fsys *fsys);
+ void (*_close)(Fsys *fsys);
+
+ Nfs3Status (*_root)(Fsys*, Nfs3Handle*);
+ Nfs3Status (*_access)(Fsys*, SunAuthUnix*, Nfs3Handle*, u32int, u32int*, Nfs3Attr*);
+ Nfs3Status (*_lookup)(Fsys*, SunAuthUnix*, Nfs3Handle*, char*, Nfs3Handle*);
+ Nfs3Status (*_getattr)(Fsys*, SunAuthUnix*, Nfs3Handle*, Nfs3Attr*);
+ Nfs3Status (*_readdir)(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, u32int count, u64int cookie, uchar**, u32int*, uchar*);
+ Nfs3Status (*_readfile)(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, u32int count, u64int offset, uchar**, u32int*, uchar*);
+ Nfs3Status (*_readlink)(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, char **link);
+
+ void *priv;
+};
+
+struct Handle
+{
+ uchar h[64];
+ int len;
+};
+
+void blockdump(Block *b, char *desc);
+void blockput(Block *b);
+
+Disk* diskcache(Disk*, uint, uint);
+Disk* diskopenventi(struct VtCache*, uchar*);
+Disk* diskopenfile(char *file);
+
+Disk* diskopen(char *file);
+void diskclose(Disk *disk);
+Block* diskread(Disk *disk, u32int, u64int offset);
+int disksync(Disk *disk);
+
+Fsys* fsysopenffs(Disk*);
+Fsys* fsysopenkfs(Disk*);
+Fsys* fsysopenext2(Disk*);
+Fsys* fsysopenfat(Disk*);
+
+Fsys* fsysopen(Disk *disk);
+Block* fsysreadblock(Fsys *fsys, u64int blockno);
+int fsyssync(Fsys *fsys);
+void fsysclose(Fsys *fsys);
+
+Nfs3Status fsysroot(Fsys *fsys, Nfs3Handle *h);
+Nfs3Status fsyslookup(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, char *name, Nfs3Handle *nh);
+Nfs3Status fsysgetattr(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, Nfs3Attr *attr);
+Nfs3Status fsysreaddir(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, u32int count, u64int cookie, uchar **e, u32int *ne, uchar*);
+Nfs3Status fsysreadfile(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, u32int, u64int, uchar**, u32int*, uchar*);
+Nfs3Status fsysreadlink(Fsys *fsys, SunAuthUnix*, Nfs3Handle *h, char **plink);
+Nfs3Status fsysaccess(Fsys *fsys, SunAuthUnix*, Nfs3Handle*, u32int, u32int*, Nfs3Attr*);
+void* emalloc(ulong size); /* provided by caller */
+
+extern int allowall;