1 | /* |
1 | /* |
2 | * libeio API header |
2 | * libeio API header |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libeio@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libeio@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
76 | /* using "typical" values in the hope that the compiler will do something sensible */ |
76 | /* using "typical" values in the hope that the compiler will do something sensible */ |
77 | enum eio_dtype { |
77 | enum eio_dtype { |
78 | EIO_DT_UNKNOWN = 0, |
78 | EIO_DT_UNKNOWN = 0, |
79 | EIO_DT_FIFO = 1, |
79 | EIO_DT_FIFO = 1, |
80 | EIO_DT_CHR = 2, |
80 | EIO_DT_CHR = 2, |
|
|
81 | EIO_DT_MPC = 3, /* multiplexed char device (v7+coherent) */ |
81 | EIO_DT_DIR = 4, |
82 | EIO_DT_DIR = 4, |
|
|
83 | EIO_DT_NAM = 5, /* xenix special named file */ |
82 | EIO_DT_BLK = 6, |
84 | EIO_DT_BLK = 6, |
|
|
85 | EIO_DT_MPB = 7, /* multiplexed block device (v7+coherent) */ |
83 | EIO_DT_REG = 8, |
86 | EIO_DT_REG = 8, |
|
|
87 | EIO_DT_NWK = 9, /* HP-UX network special */ |
|
|
88 | EIO_DT_CMP = 9, /* VxFS compressed */ |
84 | EIO_DT_LNK = 10, |
89 | EIO_DT_LNK = 10, |
|
|
90 | /* DT_SHAD = 11,*/ |
85 | EIO_DT_SOCK = 12, |
91 | EIO_DT_SOCK = 12, |
|
|
92 | EIO_DT_DOOR = 13, /* solaris door */ |
86 | EIO_DT_WHT = 14, |
93 | EIO_DT_WHT = 14, |
87 | EIO_DT_MAX = 15 /* highest DT_VALUE ever, hopefully */ |
94 | EIO_DT_MAX = 15 /* highest DT_VALUE ever, hopefully */ |
88 | }; |
95 | }; |
89 | |
96 | |
90 | struct eio_dirent { |
97 | struct eio_dirent { |
91 | char *name; |
98 | int nameofs; /* offset of null-terminated name string in (char *)req->ptr2 */ |
92 | ino_t inode; |
99 | unsigned short namelen; /* size of filename without trailing 0 */ |
93 | unsigned short namelen; |
100 | unsigned char type; /* one of EIO_DT_* */ |
94 | unsigned char type; |
|
|
95 | unsigned char score; /* internal use */ |
101 | signed char score; /* internal use */ |
96 | /* 0-4 bytes padding */ |
102 | ino_t inode; /* the inode number, if available, otherwise unspecified */ |
|
|
103 | }; |
|
|
104 | |
|
|
105 | /* eio_msync flags */ |
|
|
106 | enum { |
|
|
107 | EIO_MS_ASYNC = 1, |
|
|
108 | EIO_MS_INVALIDATE = 2, |
|
|
109 | EIO_MS_SYNC = 4 |
|
|
110 | }; |
|
|
111 | |
|
|
112 | /* eio_mtouch flags */ |
|
|
113 | |
|
|
114 | enum { |
|
|
115 | EIO_MT_MODIFY = 1 |
97 | }; |
116 | }; |
98 | |
117 | |
99 | /* eio_sync_file_range flags */ |
118 | /* eio_sync_file_range flags */ |
100 | |
119 | |
101 | enum { |
120 | enum { |
… | |
… | |
135 | eio_req volatile *next; /* private ETP */ |
154 | eio_req volatile *next; /* private ETP */ |
136 | |
155 | |
137 | ssize_t result; /* result of syscall, e.g. result = read (... */ |
156 | ssize_t result; /* result of syscall, e.g. result = read (... */ |
138 | off_t offs; /* read, write, truncate, readahead, sync_file_range: file offset */ |
157 | off_t offs; /* read, write, truncate, readahead, sync_file_range: file offset */ |
139 | size_t size; /* read, write, readahead, sendfile, msync, sync_file_range: length */ |
158 | size_t size; /* read, write, readahead, sendfile, msync, sync_file_range: length */ |
140 | void *ptr1; /* all applicable requests: pathname, old name */ |
159 | void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */ |
141 | void *ptr2; /* all applicable requests: new name or memory buffer */ |
160 | void *ptr2; /* all applicable requests: new name or memory buffer; readdir: name strings */ |
142 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
161 | eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */ |
143 | eio_tstamp nv2; /* utime, futime: mtime */ |
162 | eio_tstamp nv2; /* utime, futime: mtime */ |
144 | |
163 | |
145 | int type; /* EIO_xxx constant ETP */ |
164 | int type; /* EIO_xxx constant ETP */ |
146 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, readdir: flags */ |
165 | int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, readdir: flags */ |