Annotation of prex-old/include/server/fs.h, Revision 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:
! 80: /*
! 81: * Mount message
! 82: */
! 83: struct mount_msg {
! 84: struct msg_header hdr; /* message header */
! 85: char dev[PATH_MAX]; /* mount device */
! 86: char dir[PATH_MAX]; /* mount directory */
! 87: char fs[16]; /* file system name */
! 88: int flags; /* mount flags */
! 89: char data[64]; /* file system specific data */
! 90: };
! 91:
! 92: /*
! 93: * File open message
! 94: */
! 95: struct open_msg {
! 96: struct msg_header hdr; /* message header */
! 97: int flags; /* open flag */
! 98: mode_t mode; /* open mode */
! 99: char path[PATH_MAX]; /* open file */
! 100: int fd; /* file descriptor */
! 101: };
! 102:
! 103: /*
! 104: * I/O request message
! 105: */
! 106: struct io_msg {
! 107: struct msg_header hdr; /* message header */
! 108: int fd; /* file descriptor */
! 109: char *buf; /* i/o buffer */
! 110: size_t size; /* read/write size */
! 111: };
! 112:
! 113: /*
! 114: * File stat message
! 115: */
! 116: struct stat_msg {
! 117: struct msg_header hdr; /* message header */
! 118: int fd; /* file descriptor */
! 119: char path[PATH_MAX]; /* open file */
! 120: struct stat st;
! 121: };
! 122:
! 123: /*
! 124: * Path management message
! 125: */
! 126: struct path_msg {
! 127: struct msg_header hdr; /* message header */
! 128: int fd; /* file descriptor */
! 129: char path[PATH_MAX];
! 130: char path2[PATH_MAX];
! 131: int data[4];
! 132: };
! 133:
! 134: /*
! 135: * Directory management message
! 136: */
! 137: struct dir_msg {
! 138: struct msg_header hdr; /* message header */
! 139: int fd; /* file descriptor */
! 140: struct dirent dirent; /* directory entry */
! 141: };
! 142:
! 143: /*
! 144: * IO cotrol message
! 145: */
! 146: struct ioctl_msg {
! 147: struct msg_header hdr; /* message header */
! 148: int fd; /* file descriptor */
! 149: int request; /* io control command */
! 150: char buf[IOCPARM_MAX]; /* parameter buffer */
! 151: };
! 152:
! 153: /*
! 154: * File control message
! 155: */
! 156: struct fcntl_msg {
! 157: struct msg_header hdr; /* message header */
! 158: int fd; /* file descriptor */
! 159: int cmd; /* command */
! 160: int arg; /* argument */
! 161: struct flock lock; /* file lock data */
! 162: };
! 163:
! 164:
! 165: #define MAX_FSMSG sizeof(struct mount_msg)
! 166:
! 167: #endif /* !_SRV_FS_H */
CVSweb