[vlc-commits] contrib: dvdread: resolve OSX mount points properly

Rafaël Carré git at videolan.org
Thu Mar 15 15:02:45 CET 2012


vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Thu Mar 15 09:39:38 2012 -0400| [a72808787e4d5f6c5f6dc819e1c3d8a5c1626345] | committer: Rafaël Carré

contrib: dvdread: resolve OSX mount points properly

getstatfs seems to work better than getfsent
(cherry picked from commit 701763cdbc92e08818ceb2eb44726c98b20f0d18)

Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=a72808787e4d5f6c5f6dc819e1c3d8a5c1626345
---

 contrib/src/dvdread/osx.patch |   43 +++++++++++++++++++++++++++++++++++++++++
 contrib/src/dvdread/rules.mak |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/contrib/src/dvdread/osx.patch b/contrib/src/dvdread/osx.patch
new file mode 100644
index 0000000..e80412e
--- /dev/null
+++ b/contrib/src/dvdread/osx.patch
@@ -0,0 +1,43 @@
+--- dvdread.orig/src/dvd_reader.c	2012-03-15 09:29:40.000000000 -0400
++++ dvdread/src/dvd_reader.c	2012-03-15 09:32:29.000000000 -0400
+@@ -58,6 +58,10 @@
+ 
+ #if defined(__sun)
+ #include <sys/mnttab.h>
++#elif defined(__APPLE__)
++#include <sys/param.h>
++#include <sys/ucred.h>
++#include <sys/mount.h>
+ #elif defined(SYS_BSD)
+ #include <fstab.h>
+ #elif defined(__linux__)
+@@ -474,7 +478,28 @@
+       path_copy[1] = '\0';
+     }
+ 
+-#if defined(SYS_BSD)
++#if defined(__APPLE__)
++    struct statfs s[128];
++    int r = getfsstat(NULL, 0, MNT_NOWAIT);
++    if (r > 0) {
++        if (r > 128)
++            r = 128;
++        r = getfsstat(s, r * sizeof(s[0]), MNT_NOWAIT);
++        int i;
++        for (i=0; i<r; i++) {
++            if (!strcmp(path_copy, s[i].f_mntonname)) {
++                dev_name = bsd_block2char(s[i].f_mntfromname);
++                fprintf( stderr,
++                        "libdvdread: Attempting to use device %s"
++                        " mounted on %s for CSS authentication\n",
++                        dev_name,
++                        s[i].f_mntonname);
++                auth_drive = DVDOpenImageFile( dev_name, have_css );
++                break;
++            }
++        }
++    }
++#elif defined(SYS_BSD)
+     if( ( fe = getfsfile( path_copy ) ) ) {
+       dev_name = bsd_block2char( fe->fs_spec );
+       fprintf( stderr,
diff --git a/contrib/src/dvdread/rules.mak b/contrib/src/dvdread/rules.mak
index 1c077fe..9c6d57d 100644
--- a/contrib/src/dvdread/rules.mak
+++ b/contrib/src/dvdread/rules.mak
@@ -18,6 +18,7 @@ $(TARBALLS)/libdvdread-$(LIBDVDREAD_VERSION).tar.bz2:
 dvdread: libdvdread-$(LIBDVDREAD_VERSION).tar.bz2 .sum-dvdread
 	$(UNPACK)
 	$(APPLY) $(SRC)/dvdread/dvdread-css-static.patch
+	$(APPLY) $(SRC)/dvdread/osx.patch
 ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/dvdread/dvdread-win32.patch
 endif



More information about the vlc-commits mailing list