Overview
Comment: | Watch proc and more tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7d74392642b02a6355701012a5021962 |
User & Date: | rkeene on 2019-09-13 21:46:07 |
Other Links: | manifest | tags |
Context
2019-09-14
| ||
00:54 | Updated to keep track of whether or not there were events queued before closing and freeing a structure check-in: aa08a4a749 user: rkeene tags: trunk | |
2019-09-13
| ||
21:46 | Watch proc and more tests check-in: 7d74392642 user: rkeene tags: trunk | |
21:44 | Whitespace cleanup check-in: 48adf54b98 user: rkeene tags: trunk | |
Changes
Modified example/main.tcl from [ff243d60b5] to [c2846bcc7a].
|
Modified xvfs-core.c from [748a396e19] to [ccad9f7f2c].
︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | + + + + + + + + + + + + + + + - - + + - + + | */ struct xvfs_tclfs_channel_id { Tcl_Channel channel; struct xvfs_tclfs_instance_info *fsInstanceInfo; Tcl_Obj *path; Tcl_WideInt currentOffset; Tcl_WideInt fileSize; int eofMarked; }; struct xvfs_tclfs_channel_event { Tcl_Event tcl; struct xvfs_tclfs_channel_id *channelInstanceData; }; static Tcl_ChannelType xvfs_tclfs_channelType; static Tcl_Channel xvfs_tclfs_openChannel(Tcl_Obj *path, struct xvfs_tclfs_instance_info *instanceInfo) { struct xvfs_tclfs_channel_id *channelInstanceData; Tcl_Channel channel; Tcl_StatBuf fileInfo; Tcl_Obj *channelName; int statRet; statRet = instanceInfo->fsInfo->getStatProc(Tcl_GetString(path), &fileInfo); if (statRet < 0) { return(NULL); } channelInstanceData = (struct xvfs_tclfs_channel_id *) Tcl_Alloc(sizeof(*channelInstanceData)); channelInstanceData->currentOffset = 0; channelInstanceData->eofMarked = 0; channelInstanceData->channel = NULL; channelName = Tcl_ObjPrintf("xvfs0x%llx", (unsigned long long) channelInstanceData); if (!channelName) { Tcl_Free((char *) channelInstanceData); return(NULL); } Tcl_IncrRefCount(channelName); channelInstanceData->fsInstanceInfo = instanceInfo; |
︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + | static int xvfs_tclfs_readChannel(ClientData channelInstanceData_p, char *buf, int bufSize, int *errorCodePtr) { struct xvfs_tclfs_channel_id *channelInstanceData; const unsigned char *data; Tcl_WideInt offset, length; char *path; channelInstanceData = (struct xvfs_tclfs_channel_id *) channelInstanceData_p; /* * If we are already at the end of the file we can skip * attempting to read it */ if (channelInstanceData->eofMarked) { return(0); } path = Tcl_GetString(channelInstanceData->path); offset = channelInstanceData->currentOffset; length = bufSize; data = channelInstanceData->fsInstanceInfo->fsInfo->getDataProc(path, offset, &length); if (length < 0) { *errorCodePtr = xvfs_errorToErrno(length); return(-1); } if (length == 0) { channelInstanceData->eofMarked = 1; } else { |
︙ | |||
224 225 226 227 228 229 230 | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | + + - + + | */ if (newOffset < 0 || newOffset > fileSize) { *errorCodePtr = xvfs_errorToErrno(XVFS_RV_ERR_EINVAL); return(-1); } if (newOffset != channelInstanceData->currentOffset) { channelInstanceData->eofMarked = 0; |
︙ |