mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Uses O_SEQUENTIAL in Windows.
This commit is contained in:
parent
48473537bf
commit
eb26b6aa1f
4 changed files with 13 additions and 6 deletions
2
HISTORY
2
HISTORY
|
|
@ -9,6 +9,8 @@ SnapRAID HISTORY
|
|||
MD5 is still supported for backward compatibility.
|
||||
* The check command returns with an error code if any kind of error is present.
|
||||
Previously it was only if unrecoverable errors were present.
|
||||
* Opening the files in sequential mode in Windows. This should give
|
||||
a light speedup in Windows.
|
||||
|
||||
1.0 2011/4
|
||||
==========
|
||||
|
|
|
|||
6
handle.c
6
handle.c
|
|
@ -110,7 +110,8 @@ int handle_create(struct snapraid_handle* handle, struct snapraid_file* file)
|
|||
return -1;
|
||||
}
|
||||
|
||||
handle->f = open(handle->path, O_RDWR | O_CREAT | O_BINARY, 0600);
|
||||
/* opening in sequential mode in Windows */
|
||||
handle->f = open(handle->path, O_RDWR | O_CREAT | O_BINARY | O_SEQUENTIAL, 0600);
|
||||
if (handle->f == -1) {
|
||||
/* invalidate for error */
|
||||
handle->file = 0;
|
||||
|
|
@ -175,8 +176,9 @@ int handle_open(struct snapraid_handle* handle, struct snapraid_file* file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* opening in sequential mode in Windows */
|
||||
pathprint(handle->path, sizeof(handle->path), "%s%s", handle->disk->dir, file->sub);
|
||||
handle->f = open(handle->path, O_RDONLY | O_BINARY);
|
||||
handle->f = open(handle->path, O_RDONLY | O_BINARY | O_SEQUENTIAL);
|
||||
|
||||
if (handle->f == -1) {
|
||||
/* invalidate for error */
|
||||
|
|
|
|||
6
parity.c
6
parity.c
|
|
@ -55,7 +55,8 @@ int parity_create(const char* path, data_off_t size)
|
|||
int ret;
|
||||
int f;
|
||||
|
||||
f = open(path, O_RDWR | O_CREAT | O_BINARY, 0600);
|
||||
/* opening in sequential mode in Windows */
|
||||
f = open(path, O_RDWR | O_CREAT | O_BINARY | O_SEQUENTIAL, 0600);
|
||||
if (f == -1) {
|
||||
fprintf(stderr, "Error opening parity file '%s'. %s.\n", path, strerror(errno));
|
||||
return -1;
|
||||
|
|
@ -114,7 +115,8 @@ int parity_open(const char* path)
|
|||
#endif
|
||||
int f;
|
||||
|
||||
f = open(path, O_RDONLY | O_BINARY);
|
||||
/* opening in sequential mode in Windows */
|
||||
f = open(path, O_RDONLY | O_BINARY | O_SEQUENTIAL);
|
||||
if (f == -1) {
|
||||
fprintf(stderr, "Error opening parity file '%s'. %s.\n", path, strerror(errno));
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -106,11 +106,12 @@
|
|||
#define SWITCH_GETOPT_LONG(a,b) b
|
||||
#endif
|
||||
|
||||
#ifndef O_BINARY
|
||||
#ifndef __MINGW32__ /* Specific for Unix */
|
||||
#define O_BINARY 0
|
||||
#define O_SEQUENTIAL 0
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__ /* Specific for MINGW */
|
||||
#ifdef __MINGW32__ /* Specific for Windows MINGW */
|
||||
|
||||
/* Remap functions and types for 64 bit support */
|
||||
#define stat windows_stat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue