xref: /titanic_50/usr/src/lib/libast/common/include/fs3d.h (revision 694c35faa87b858ecdadfe4fc592615f4eefbb07)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
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_pad4
44 #define iview(p)	((p)->st_pad4[0])
45 #define IVIEW(p,v)	((p)->st_pad4[0]=(v))
46 #else
47 #if _mem_st_rdev_stat
48 #define iview(p)	((S_ISBLK((p)->st_mode)||S_ISCHR((p)->st_mode))?0:(p)->st_rdev)
49 #define IVIEW(p,v)	do{if(!S_ISBLK((p)->st_mode)&&!S_ISCHR((p)->st_mode))(p)->st_rdev=(v);}while(0)
50 #else
51 #define iview(p)	0
52 #define IVIEW(p,v)
53 #endif
54 #endif
55 #endif
56 #endif
57 
58 /*
59  * special options
60  */
61 
62 #define FS3D_init	"/#option/init"
63 #define FS3D_on		"/#option/3d"
64 #define FS3D_off	"/#option/2d"
65 
66 /*
67  * fs3d(3) ops
68  */
69 
70 #define FS3D_OP(o,a)	(((a)<<3)|(o))
71 
72 #define FS3D_INIT	FS3D_OP_INIT	/* re-initialize tables		*/
73 #define FS3D_OFF	FS3D_OP_OFF
74 #define FS3D_ON		FS3D_OP_ON
75 #define FS3D_TEST	FS3D_OP_TEST
76 #define FS3D_LIMIT(n)	FS3D_OP(FS3D_OP_LIMIT,n)
77 
78 #define FS3D_op(x)	((x)&07)
79 #define FS3D_arg(x)	(((x)>>3)&07777)
80 
81 #define FS3D_OP_OFF	0
82 #define FS3D_OP_ON	1
83 #define FS3D_OP_TEST	2
84 #define FS3D_OP_LIMIT	3
85 #define FS3D_OP_INIT	7
86 
87 /*
88  * mount(2) ops
89  */
90 
91 #define FS3D_ALL	(FS3D_VIEW|FS3D_VERSION)
92 #define FS3D_VIEW	002
93 #define FS3D_VERSION	004
94 #define FS3D_GET	010
95 #define FS3D_SIZE(n)	((n)<<4)
96 #define FS3D_SIZEOF(n)	((n)>>4)
97 
98 #if !_BLD_3d
99 #define mount(s,t,f,d)	fs3d_mount(s,t,f,d)
100 #endif
101 
102 #if _BLD_ast && defined(__EXPORT__)
103 #define extern		__EXPORT__
104 #endif
105 
106 extern int		fs3d(int);
107 extern int		fs3d_mount(const char*, char*, int, void*);
108 extern char*		pathnext(char*, char*, long*);
109 
110 #undef	extern
111 
112 #endif
113