Statistics
| Branch: | Revision:

scoutos / prex-0.9.0 / include / ipc / fs.h @ 03e9c04a

History | View | Annotate | Download (4.65 KB)

1
/*
2
 * Copyright (c) 2005-2008, 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 _IPC_FS_H
31
#define _IPC_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 <ipc/ipc.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
#define FS_ISATTY        0x00000223
81
#define FS_TRUNCATE        0x00000224
82
#define FS_FTRUNCATE        0x00000225
83
#define FS_FCHDIR        0x00000226
84

    
85
/*
86
 * Mount message
87
 */
88
struct mount_msg {
89
        struct msg_header hdr;                /* message header */
90
        char        dev[PATH_MAX];                /* mount device */
91
        char        dir[PATH_MAX];                /* mount directory */
92
        char        fs[16];                        /* file system name */
93
        int        flags;                        /* mount flags */
94
        char        data[64];                /* file system specific data */
95
};
96

    
97
/*
98
 * File open message
99
 */
100
struct open_msg {
101
        struct msg_header hdr;                /* message header */
102
        int        flags;                        /* open flag */
103
        mode_t        mode;                        /* open mode */
104
        char        path[PATH_MAX];                /* open file */
105
        int        fd;                        /* file descriptor */
106
};
107

    
108
/*
109
 * I/O request message
110
 */
111
struct io_msg {
112
        struct msg_header hdr;                /* message header */
113
        int        fd;                        /* file descriptor */
114
        char        *buf;                        /* i/o buffer */
115
        size_t        size;                        /* read/write size */
116
};
117

    
118
/*
119
 * File stat message
120
 */
121
struct stat_msg {
122
        struct msg_header hdr;                /* message header */
123
        int        fd;                        /* file descriptor */
124
        char        path[PATH_MAX];                /* open file */
125
        struct stat st;
126
};
127

    
128
/*
129
 * Path management message
130
 */
131
struct path_msg {
132
        struct msg_header hdr;                /* message header */
133
        int        fd;                        /* file descriptor */
134
        char        path[PATH_MAX];
135
        char        path2[PATH_MAX];
136
        int        data[4];
137
};
138

    
139
/*
140
 * Directory management message
141
 */
142
struct dir_msg {
143
        struct msg_header hdr;                /* message header */
144
        int        fd;                        /* file descriptor */
145
        struct dirent dirent;                /* directory entry */
146
};
147

    
148
/*
149
 * IO cotrol message
150
 */
151
struct ioctl_msg {
152
        struct msg_header hdr;                /* message header */
153
        int        fd;                        /* file descriptor */
154
        u_long        request;                /* io control command */
155
        char        buf[IOCPARM_MAX];        /* parameter buffer */
156
};
157

    
158
/*
159
 * File control message
160
 */
161
struct fcntl_msg {
162
        struct msg_header hdr;                /* message header */
163
        int        fd;                        /* file descriptor */
164
        int        cmd;                        /* command */
165
        int        arg;                        /* argument */
166
        struct flock lock;                /* file lock data */
167
};
168

    
169

    
170
/* Max size of fs message */
171
#define MAX_FSMSG        sizeof(struct mount_msg)
172

    
173
#endif /* !_IPC_FS_H */