[vlc-devel] commit: Read-ahead only makes sense for seekable file descriptors ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jan 16 10:44:05 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 16 11:38:17 2010 +0200| [6bd7922ece04cd6180a2cf1820f36d556c9075f6] | committer: Rémi Denis-Courmont
Read-ahead only makes sense for seekable file descriptors
(You can't read ahead a pipe)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6bd7922ece04cd6180a2cf1820f36d556c9075f6
---
modules/access/file.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/modules/access/file.c b/modules/access/file.c
index 61f4f89..640b479 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -249,6 +249,16 @@ static int Open( vlc_object_t *p_this )
posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED);
/* In most cases, we only read the file once. */
posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE);
+#if defined(HAVE_FCNTL)
+ /* We'd rather use any available memory for reading ahead
+ * than for caching what we've already seen/heard */
+# if defined(F_RDAHEAD)
+ fcntl (fd, F_RDAHEAD, 1);
+# endif
+# if defined(F_NOCACHE)
+ fcntl (fd, F_NOCACHE, 1);
+# endif
+#endif
}
return VLC_SUCCESS;
@@ -416,16 +426,5 @@ static int open_file (access_t *p_access, const char *path)
return -1;
}
-#if defined(HAVE_FCNTL)
- /* We'd rather use any available memory for reading ahead
- * than for caching what we've already seen/heard */
-# if defined(F_RDAHEAD)
- fcntl (fd, F_RDAHEAD, 1);
-# endif
-# if defined(F_NOCACHE)
- fcntl (fd, F_NOCACHE, 1);
-# endif
-#endif
-
return fd;
}
More information about the vlc-devel
mailing list