|
|
1.1 root 1: #ifndef __KERNEL_FHSYS_H__
2: #define __KERNEL_FHSYS_H__
3:
4: /*
5: * This header defines data structures and prototypes for objects that
6: * represent open files in an abstract manner.
7: */
8: /*
9: *-IMPORTS:
10: * <common/ccompat.h>
11: * __EXTERN_C_BEGIN__
12: * __EXTERN_C_END__
13: * __VOID__
14: * __PROTO ()
15: * <sys/types.h>
16: * off_t
17: * <common/_time.h>
18: * time_t
19: * <common/_cred.h>
20: * cred_t
21: * <sys/uio.h>
22: * uio_t
23: */
24:
25: #include <common/ccompat.h>
26: #include <common/_time.h>
27: #include <common/_size.h>
28: #include <common/_cred.h>
29: #include <sys/types.h>
30: #include <sys/uio.h>
31:
32:
33: /*
34: * Begin by setting up all the typedefs we need.
35: */
36:
37: typedef struct sftab sftab_t;
38: typedef struct fhandle fhandle_t;
39: typedef struct fprocs fprocs_t;
40: typedef struct fstat fstat_t;
41:
42:
43: /*
44: * Structure definitions imported by the function prototypes below need to be
45: * declared with file scope.
46: */
47:
48: struct pollhead;
49: struct strbuf;
50: struct statvfs;
51:
52:
53: /*
54: * We declare typedefs for the function pointers that the file handle system
55: * use use for documentation purposes.
56: */
57:
58: typedef int (* fh_open_t) __PROTO ((fhandle_t * _handlep,
59: __VOID__ * _name, size_t _namelen,
60: int _oflag, cred_t * _credp));
61: typedef int (* fh_close_t) __PROTO ((fhandle_t * _handlep, int _oflag,
62: int _otyp, cred_t * _credp));
63: typedef int (* fh_read_t) __PROTO ((fhandle_t * _handlep, uio_t * _uiop,
64: cred_t * _credp));
65: typedef int (* fh_write_t) __PROTO ((fhandle_t * _handlep, uio_t * _uiop,
66: cred_t * _credp));
67: typedef int (* fh_ioctl_t) __PROTO ((fhandle_t * _handlep, int _cmd,
68: __VOID__ * _arg, int _mode,
69: cred_t * _credp, int * _rvalp));
70: typedef int (* fh_poll_t) __PROTO ((fhandle_t * _handlep, short _events,
71: int _anyyet, short * _reventsp,
72: struct pollhead ** _phpp));
73: typedef int (* fh_lseek_t) __PROTO ((fhandle_t * _handlep, off_t _pos,
74: int _whence, off_t * _rpos));
75: typedef int (* fh_sync_t) __PROTO ((fhandle_t * _handlep, int _flag));
76: typedef int (* fh_getpmsg_t) __PROTO ((fhandle_t * _handlep,
77: struct strbuf * _ctlbufp,
78: struct strbuf * _databufp,
79: int * _bandp, int * _flagsp));
80: typedef int (* fh_putpmsg_t) __PROTO ((fhandle_t * _handlep,
81: struct strbuf * _ctlbufp,
82: struct strbuf * _databufp,
83: int band, int flags));
84: typedef int (* fh_fstat_t) __PROTO ((fhandle_t * _handlep,
85: fstat_t * _statp));
86: typedef int (* fh_statvfs_t) __PROTO ((fhandle_t * _handlep,
87: struct statvfs * _bufp));
88: typedef int (* fh_mmap_t) __PROTO ((fhandle_t * _handlep, off_t _off,
89: off_t len, int _prot));
90: typedef int (* fh_attach_t) __PROTO ((fhandle_t * _handlep,
91: __VOID__ * _detach));
92: typedef int (* fh_detach_t) __PROTO ((fhandle_t * _handlep));
93:
94:
95: __EXTERN_C_BEGIN__
96:
97: /*
98: * For dealing with file descriptors and system file table entries.
99: */
100:
101: fhandle_t * fd_get_handle __PROTO ((int _fd));
102: sftab_t * fd_get_sftab __PROTO ((int _fd));
103: int fd_add_sftab __PROTO ((sftab_t * _sftabp, int * _fdp));
104: int fd_can_add __PROTO ((void));
105:
106: /*
107: * For dealing with file handles.
108: */
109:
110: fhandle_t * fh_opening __PROTO ((void));
111: fprocs_t * fh_procs __PROTO ((fhandle_t * _handle));
112: __VOID__ * fh_get_cookie __PROTO ((fhandle_t * _handle));
113: int fh_set_cookie __PROTO ((fhandle_t * _handle,
114: __VOID__ * _cookie, size_t _size));
115:
116: __EXTERN_C_END__
117:
118:
119: /*
120: * Status information pertaining to an open file object. We define this rather
121: * than passing around full "stat" structures because many of the fields have
122: * no relevance to this subsystem, and that introduces unnecessary
123: * complications about who fills in what field when.
124: */
125:
126: struct fstat {
127: time_t fh_atime;
128: time_t fh_mtime;
129: time_t fh_ctime;
130:
131: off_t fh_size;
132: };
133:
134:
135: /*
136: * The system described in part by this header file is not yet fully
137: * operational. In particular, the configuration mechanisms are not yet
138: * specified, so the following feature-test can be used to dike out code that
139: * cannot yet be properly tested.
140: */
141:
142: #define _NO_INSTALLABLE_FILESYSTEMS 1
143:
144:
145: #endif /* ! defined (__KERNEL_FHSYS_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.