Add logging of mount formats in Linux.
authorCarl Hetherington <cth@carlh.net>
Mon, 24 Jun 2013 15:02:52 +0000 (16:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 24 Jun 2013 15:02:52 +0000 (16:02 +0100)
src/lib/cross.cc
src/lib/cross.h
src/lib/film.cc

index a642915f4f6021289f9dbaa3c4361c161c99954f..895fb0ac2d85cd8a2e889de6ff8f00db6a505ab7 100644 (file)
@@ -24,6 +24,7 @@
 #include "log.h"
 #ifdef DVDOMATIC_POSIX
 #include <unistd.h>
+#include <mntent.h>
 #endif
 #ifdef DVDOMATIC_WINDOWS
 #include <windows.h>
 #endif
 
 using std::pair;
+using std::list;
 using std::ifstream;
 using std::string;
+using std::make_pair;
 using boost::shared_ptr;
 
 void
@@ -156,3 +159,29 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share
        system (ffprobe.c_str ());
 #endif 
 }
+
+list<pair<string, string> >
+mount_info ()
+{
+       list<pair<string, string> > m;
+       
+#ifdef DVDOMATIC_POSIX 
+       FILE* f = setmntent ("/etc/mtab", "r");
+       if (!f) {
+               return m;
+       }
+       
+       while (1) {
+               struct mntent* mnt = getmntent (f);
+               if (!mnt) {
+                       break;
+               }
+
+               m.push_back (make_pair (mnt->mnt_dir, mnt->mnt_type));
+       }
+
+       endmntent (f);
+#endif
+
+       return m;
+}
index 1a7a8cb4d699908a0d9e0b91e1aaec7b666a15c3..d9cc2d12f4b2981b48378515fcbfae8d3d15dacd 100644 (file)
@@ -26,6 +26,7 @@ class Log;
 #define WEXITSTATUS(w) (w)
 #endif
 
-void dvdomatic_sleep (int);
+extern void dvdomatic_sleep (int);
 extern std::pair<std::string, int> cpu_info ();
 extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path, boost::shared_ptr<Log>);
+extern std::list<std::pair<std::string, std::string> > mount_info ();
index 3d9b3eeb4e4f8fafff480bc8bdf78fa180b1ee81..c4dc9d830d0823b0701be08a760637425f0cf41e 100644 (file)
@@ -68,6 +68,7 @@ using std::setfill;
 using std::min;
 using std::make_pair;
 using std::endl;
+using std::list;
 using boost::shared_ptr;
 using boost::lexical_cast;
 using boost::to_upper_copy;
@@ -329,6 +330,10 @@ Film::make_dcp ()
 #endif
        pair<string, int> const c = cpu_info ();
        log()->log (String::compose ("CPU: %1, %2 processors", c.first, c.second));
+       list<pair<string, string> > const m = mount_info ();
+       for (list<pair<string, string> >::const_iterator i = m.begin(); i != m.end(); ++i) {
+               log()->log (String::compose ("Mount: %1 %2", i->first, i->second));
+       }
        
        if (format() == 0) {
                throw MissingSettingError (_("format"));