#include <fcntl.h>
Go to the source code of this file.
◆ fs_changed()
◆ fs_close()
Definition at line 455 of file io.c.
456{
458 int changed;
459
463 else
469 }
471 pdie(
"closing filesystem");
473}
static unsigned __int64 next
void pdie(const char *msg,...)
static void fs_flush(void)
◆ fs_open()
Definition at line 163 of file io.c.
164{
168 }
171}
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
◆ fs_read()
Read data from the partition, accounting for any pending updates that are queued for writing.
- Parameters
-
[in] | pos | Byte offset, relative to the beginning of the partition, at which to read |
[in] | size | Number of bytes to read |
[out] | data | Where to put the data read |
Definition at line 282 of file io.c.
283{
285 int got;
286
287#ifdef __REACTOS__
288 const size_t readsize_aligned = (
size % 512) ? (
size + (512 - (
size % 512))) :
size;
290 const size_t seek_delta = (
size_t)(
pos - seekpos_aligned);
291#if DBG
292 const size_t readsize = (
size_t)(
pos - seekpos_aligned) + readsize_aligned;
293#endif
294 char* tmpBuf =
alloc(readsize_aligned);
295 if (
lseek(
fd, seekpos_aligned, 0) != seekpos_aligned)
pdie(
"Seek to %lld",
pos);
296 if ((got =
read(
fd, tmpBuf, readsize_aligned)) < 0)
pdie(
"Read %d bytes at %lld",
size,
pos);
302#else
304 pdie(
"Seek to %lld", (
long long)
pos);
306 pdie(
"Read %d bytes at %lld",
size, (
long long)
pos);
307#endif
309 die(
"Got %d bytes instead of %d at %lld", got,
size, (
long long)
pos);
315 else
318 }
319 }
320}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define memcpy(s1, s2, n)
Referenced by add_file(), alloc_rootdir_entry(), check_backup_boot(), find_volume_de(), read_boot(), read_fat(), read_fsinfo(), and write_boot_label().
◆ fs_test()
Definition at line 322 of file io.c.
323{
324 void *scratch;
325 int okay;
326
327#ifdef __REACTOS__
328 const size_t readsize_aligned = (
size % 512) ? (
size + (512 - (
size % 512))) :
size;
330 scratch =
alloc(readsize_aligned);
331 if (
lseek(
fd, seekpos_aligned, 0) != seekpos_aligned)
pdie(
"Seek to %lld",
pos);
332 okay =
read(
fd, scratch, readsize_aligned) == (
int)readsize_aligned;
334#else
336 pdie(
"Seek to %lld", (
long long)
pos);
340#endif
341 return okay;
342}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Referenced by fix_bad(), read_boot(), and test_file().
◆ fs_write()
Definition at line 344 of file io.c.
345{
347 int did;
348
349#ifdef __REACTOS__
351
353 void *scratch;
354 const size_t readsize_aligned = (
size % 512) ? (
size + (512 - (
size % 512))) :
size;
356 const size_t seek_delta = (
size_t)(
pos - seekpos_aligned);
357 BOOLEAN use_read = (seek_delta != 0) || ((readsize_aligned-
size) != 0);
358
359
360 if (use_read)
361 scratch =
alloc(readsize_aligned);
362 else
364
366 if (
lseek(
fd, seekpos_aligned, 0) != seekpos_aligned)
pdie(
"Seek to %lld",seekpos_aligned);
367
368 if (use_read)
369 {
370
371 if (
read(
fd, scratch, readsize_aligned) < 0)
pdie(
"Read %d bytes at %lld",
size,
pos);
372
373
375 }
376
377
378 if ((did =
write(
fd, scratch, readsize_aligned)) == (
int)readsize_aligned)
379 {
380 if (use_read)
free(scratch);
381 return;
382 }
383 if (did < 0)
pdie(
"Write %d bytes at %lld",
size,
pos);
384 die(
"Wrote %d bytes instead of %d at %lld", did,
size,
pos);
385 }
386#else
390 pdie(
"Seek to %lld", (
long long)
pos);
392 return;
393 if (did < 0)
394 pdie(
"Write %d bytes at %lld",
size, (
long long)
pos);
395 die(
"Wrote %d bytes instead of %d at %lld", did,
size, (
long long)
pos);
396 }
397#endif
404 else
407}
#define FSCHECK_IMMEDIATE_WRITE
#define new(TYPE, numElems)
Referenced by add_file(), alloc_rootdir_entry(), auto_rename(), check_backup_boot(), check_fat_state_bit(), clear_lfn_slots(), fs_flush(), lfn_add_slot(), lfn_fix_checksum(), lfn_get(), lfn_remove(), read_fat(), read_fsinfo(), reclaim_file(), rename_file(), set_fat(), update_free(), write_boot_label(), and write_volume_label().