mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Ignore fadvise if it return ENOSYS
This happens in ARM platform because fadvise is differently implemented by the kernel and glibc may not support it yet.
This commit is contained in:
parent
72c558b104
commit
20e9f7de41
2 changed files with 22 additions and 0 deletions
|
|
@ -47,11 +47,16 @@ STREAM* sopen_read(const char* file)
|
|||
#if HAVE_POSIX_FADVISE
|
||||
/* advise sequential access */
|
||||
ret = posix_fadvise(s->handle[0].f, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
if (ret == ENOSYS) {
|
||||
/* call is not supported, like in armhf, see posix_fadvise manpage */
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
close(s->handle[0].f);
|
||||
free(s->handle);
|
||||
free(s);
|
||||
errno = ret; /* posix_fadvise return the error code */
|
||||
return 0;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -116,9 +121,14 @@ int sopen_multi_file(STREAM* s, unsigned i, const char* file)
|
|||
#if HAVE_POSIX_FADVISE
|
||||
/* advise sequential access */
|
||||
ret = posix_fadvise(f, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
if (ret == ENOSYS) {
|
||||
/* call is not supported, like in armhf, see posix_fadvise manpage */
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
close(f);
|
||||
errno = ret; /* posix_fadvise return the error code */
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -940,6 +940,10 @@ int advise_open(struct advise_struct* advise, int f)
|
|||
|
||||
/* advise sequential access */
|
||||
ret = posix_fadvise(f, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
if (ret == ENOSYS) {
|
||||
/* call is not supported, like in armhf, see posix_fadvise manpage */
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ret; /* posix_fadvise return the error code */
|
||||
|
|
@ -1116,6 +1120,10 @@ int advise_write(struct advise_struct* advise, int f, data_off_t offset, data_of
|
|||
|
||||
/* flush the data from the cache */
|
||||
ret = posix_fadvise(f, discard_offset, discard_size, POSIX_FADV_DONTNEED);
|
||||
if (ret == ENOSYS) {
|
||||
/* call is not supported, like in armhf, see posix_fadvise manpage */
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ret; /* posix_fadvise return the error code */
|
||||
|
|
@ -1143,6 +1151,10 @@ int advise_read(struct advise_struct* advise, int f, data_off_t offset, data_off
|
|||
|
||||
/* flush the data from the cache */
|
||||
ret = posix_fadvise(f, offset, size, POSIX_FADV_DONTNEED);
|
||||
if (ret == ENOSYS) {
|
||||
/* call is not supported, like in armhf, see posix_fadvise manpage */
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
errno = ret; /* posix_fadvise return the error code */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue