aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9660srv/dat.h
blob: bee14db6114889970a4ada7e100eca690c28b9e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
typedef	struct Ioclust	Ioclust;
typedef	struct Iobuf	Iobuf;
typedef	struct Isofile	Isofile;
typedef struct Xdata	Xdata;
typedef struct Xfile	Xfile;
typedef struct Xfs	Xfs;
typedef struct Xfsub	Xfsub;

#pragma incomplete Isofile

enum
{
	Sectorsize = 2048,
	Maxname = 256,
};

struct Iobuf
{
	Ioclust* clust;
	long	addr;
	uchar*	iobuf;
};

struct Ioclust
{
	long	addr;			/* in sectors; good to 8TB */
	Xdata*	dev;
	Ioclust* next;
	Ioclust* prev;
	int	busy;
	int	nbuf;
	Iobuf*	buf;
	uchar*	iobuf;
};

struct Xdata
{
	Xdata*	next;
	char*	name;		/* of underlying file */
	Qid	qid;
	short	type;
	short	fdev;
	int	ref;		/* attach count */
	int	dev;		/* for read/write */
};

struct Xfsub
{
	void	(*reset)(void);
	int	(*attach)(Xfile*);
	void	(*clone)(Xfile*, Xfile*);
	void	(*walkup)(Xfile*);
	void	(*walk)(Xfile*, char*);
	void	(*open)(Xfile*, int);
	void	(*create)(Xfile*, char*, long, int);
	long	(*readdir)(Xfile*, uchar*, long, long);
	long	(*read)(Xfile*, char*, vlong, long);
	long	(*write)(Xfile*, char*, vlong, long);
	void	(*clunk)(Xfile*);
	void	(*remove)(Xfile*);
	void	(*stat)(Xfile*, Dir*);
	void	(*wstat)(Xfile*, Dir*);
};

struct Xfs
{
	Xdata*	d;		/* how to get the bits */
	Xfsub*	s;		/* how to use them */
	int	ref;
	int	issusp;	/* follows system use sharing protocol */
	long	suspoff;	/* if so, offset at which SUSP area begins */
	int	isrock;	/* Rock Ridge format */
	int	isplan9;	/* has Plan 9-specific directory info */
	Qid	rootqid;
	Isofile*	ptr;		/* private data */
};

struct Xfile
{
	Xfile*	next;		/* in fid hash bucket */
	Xfs*	xf;
	long	fid;
	ulong	flags;
	Qid	qid;
	int	len;		/* of private data */
	Isofile*	ptr;
};

enum
{
	Asis,
	Clean,
	Clunk
};

enum
{
	Oread = 1,
	Owrite = 2,
	Orclose = 4,
	Omodes = 3,
};

extern char	Enonexist[];	/* file does not exist */
extern char	Eperm[];	/* permission denied */
extern char	Enofile[];	/* no file system specified */
extern char	Eauth[];	/* authentication failed */

extern char	*srvname;
extern char	*deffile;
extern int	chatty;
extern jmp_buf	err_lab[];
extern int	nerr_lab;
extern char	err_msg[];

extern int nojoliet;
extern int noplan9;
extern int norock;