1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2011 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 /*
24  * Glenn Fowler
25  * AT&T Research
26  *
27  * 3d fs interface definitions
28  */
29 
30 #ifndef _FS3D_H
31 #define _FS3D_H
32 
33 #include <ast_fs.h>
34 
35 #if _int_st_spare1
36 #define iview(p)	((p)->st_spare1)
37 #define IVIEW(p,v)	((p)->st_spare1=(v))
38 #else
39 #if _ary_st_spare4
40 #define iview(p)	((p)->st_spare4[0])
41 #define IVIEW(p,v)	((p)->st_spare4[0]=(v))
42 #else
43 #if _ary_st_extra
44 #define iview(p)	((p)->st_extra[0])
45 #define IVIEW(p,v)	((p)->st_extra[0]=(v))
46 #else
47 #if _ary_st_pad4
48 #define iview(p)	((p)->st_pad4[0])
49 #define IVIEW(p,v)	((p)->st_pad4[0]=(v))
50 #else
51 #if _mem_st_rdev_stat
52 #define iview(p)	((S_ISBLK((p)->st_mode)||S_ISCHR((p)->st_mode))?0:(p)->st_rdev)
53 #define IVIEW(p,v)	do{if(!S_ISBLK((p)->st_mode)&&!S_ISCHR((p)->st_mode))(p)->st_rdev=(v);}while(0)
54 #else
55 #define iview(p)	0
56 #define IVIEW(p,v)
57 #endif
58 #endif
59 #endif
60 #endif
61 #endif
62 
63 /*
64  * special options
65  */
66 
67 #define FS3D_init	"/#option/init"
68 #define FS3D_on		"/#option/3d"
69 #define FS3D_off	"/#option/2d"
70 
71 /*
72  * fs3d(3) ops
73  */
74 
75 #define FS3D_OP(o,a)	(((a)<<3)|(o))
76 
77 #define FS3D_INIT	FS3D_OP_INIT	/* re-initialize tables		*/
78 #define FS3D_OFF	FS3D_OP_OFF
79 #define FS3D_ON		FS3D_OP_ON
80 #define FS3D_TEST	FS3D_OP_TEST
81 #define FS3D_LIMIT(n)	FS3D_OP(FS3D_OP_LIMIT,n)
82 
83 #define FS3D_op(x)	((x)&07)
84 #define FS3D_arg(x)	(((x)>>3)&07777)
85 
86 #define FS3D_OP_OFF	0
87 #define FS3D_OP_ON	1
88 #define FS3D_OP_TEST	2
89 #define FS3D_OP_LIMIT	3
90 #define FS3D_OP_INIT	7
91 
92 /*
93  * mount(2) ops
94  */
95 
96 #define FS3D_ALL	(FS3D_VIEW|FS3D_VERSION)
97 #define FS3D_VIEW	002
98 #define FS3D_VERSION	004
99 #define FS3D_GET	010
100 #define FS3D_SIZE(n)	((n)<<4)
101 #define FS3D_SIZEOF(n)	((n)>>4)
102 
103 #if !_BLD_3d
104 #define mount(s,t,f,d)	fs3d_mount(s,t,f,d)
105 #endif
106 
107 #if _BLD_ast && defined(__EXPORT__)
108 #define extern		__EXPORT__
109 #endif
110 
111 extern int		fs3d(int);
112 extern int		fs3d_mount(const char*, char*, int, void*);
113 extern char*		pathnext(char*, char*, long*);
114 
115 #undef	extern
116 
117 #endif
118