Annotation of prex/include/server/fs.h, Revision 1.1.1.1
1.1 nbrk 1: /*
2: * Copyright (c) 2005-2006, Kohsuke Ohtani
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. Neither the name of the author nor the names of any co-contributors
14: * may be used to endorse or promote products derived from this software
15: * without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: */
29:
30: #ifndef _SRV_FS_H
31: #define _SRV_FS_H
32:
33: #include <sys/types.h>
34: #include <sys/dirent.h>
35: #include <sys/stat.h>
36: #include <sys/fcntl.h>
37: #include <sys/ioctl.h>
38: #include <prex/message.h>
39:
40: #include <limits.h>
41:
42: /*
43: * Messages for file system object
44: */
45: #define FS_MOUNT 0x00000200
46: #define FS_UMOUNT 0x00000201
47: #define FS_SYNC 0x00000202
48: #define FS_OPEN 0x00000203
49: #define FS_CLOSE 0x00000204
50: #define FS_MKNOD 0x00000205
51: #define FS_LSEEK 0x00000206
52: #define FS_READ 0x00000207
53: #define FS_WRITE 0x00000208
54: #define FS_IOCTL 0x00000209
55: #define FS_FSYNC 0x0000020A
56: #define FS_FSTAT 0x0000020B
57: #define FS_OPENDIR 0x0000020C
58: #define FS_CLOSEDIR 0x0000020D
59: #define FS_READDIR 0x0000020E
60: #define FS_REWINDDIR 0x0000020F
61: #define FS_SEEKDIR 0x00000210
62: #define FS_TELLDIR 0x00000211
63: #define FS_MKDIR 0x00000212
64: #define FS_RMDIR 0x00000213
65: #define FS_RENAME 0x00000214
66: #define FS_CHDIR 0x00000215
67: #define FS_LINK 0x00000216
68: #define FS_UNLINK 0x00000217
69: #define FS_STAT 0x00000218
70: #define FS_GETCWD 0x00000219
71: #define FS_DUP 0x0000021A
72: #define FS_DUP2 0x0000021B
73: #define FS_FCNTL 0x0000021C
74: #define FS_ACCESS 0x0000021D
75: #define FS_FORK 0x0000021E
76: #define FS_EXEC 0x0000021F
77: #define FS_EXIT 0x00000220
78: #define FS_REGISTER 0x00000221
79: #define FS_PIPE 0x00000222
80:
81: /*
82: * Mount message
83: */
84: struct mount_msg {
85: struct msg_header hdr; /* message header */
86: char dev[PATH_MAX]; /* mount device */
87: char dir[PATH_MAX]; /* mount directory */
88: char fs[16]; /* file system name */
89: int flags; /* mount flags */
90: char data[64]; /* file system specific data */
91: };
92:
93: /*
94: * File open message
95: */
96: struct open_msg {
97: struct msg_header hdr; /* message header */
98: int flags; /* open flag */
99: mode_t mode; /* open mode */
100: char path[PATH_MAX]; /* open file */
101: int fd; /* file descriptor */
102: };
103:
104: /*
105: * I/O request message
106: */
107: struct io_msg {
108: struct msg_header hdr; /* message header */
109: int fd; /* file descriptor */
110: char *buf; /* i/o buffer */
111: size_t size; /* read/write size */
112: };
113:
114: /*
115: * File stat message
116: */
117: struct stat_msg {
118: struct msg_header hdr; /* message header */
119: int fd; /* file descriptor */
120: char path[PATH_MAX]; /* open file */
121: struct stat st;
122: };
123:
124: /*
125: * Path management message
126: */
127: struct path_msg {
128: struct msg_header hdr; /* message header */
129: int fd; /* file descriptor */
130: char path[PATH_MAX];
131: char path2[PATH_MAX];
132: int data[4];
133: };
134:
135: /*
136: * Directory management message
137: */
138: struct dir_msg {
139: struct msg_header hdr; /* message header */
140: int fd; /* file descriptor */
141: struct dirent dirent; /* directory entry */
142: };
143:
144: /*
145: * IO cotrol message
146: */
147: struct ioctl_msg {
148: struct msg_header hdr; /* message header */
149: int fd; /* file descriptor */
150: u_long request; /* io control command */
151: char buf[IOCPARM_MAX]; /* parameter buffer */
152: };
153:
154: /*
155: * File control message
156: */
157: struct fcntl_msg {
158: struct msg_header hdr; /* message header */
159: int fd; /* file descriptor */
160: int cmd; /* command */
161: int arg; /* argument */
162: struct flock lock; /* file lock data */
163: };
164:
165:
166: #define MAX_FSMSG sizeof(struct mount_msg)
167:
168: #endif /* !_SRV_FS_H */
CVSweb