Mailinglist Archive: zypp-commit (223 mails)

< Previous Next >
[zypp-commit] r10557 - /trunk/libzypp/zypp/media/MediaDISK.cc
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Sat, 12 Jul 2008 09:19:52 -0000
  • Message-id: <20080712091952.842CF3012E@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Sat Jul 12 11:19:51 2008
New Revision: 10557

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10557&view=rev
Log:
- reuse existing disk mounts (applied Marius' patch) (bnc #208222)

Modified:
trunk/libzypp/zypp/media/MediaDISK.cc

Modified: trunk/libzypp/zypp/media/MediaDISK.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaDISK.cc?rev=10557&r1=10556&r2=10557&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/MediaDISK.cc (original)
+++ trunk/libzypp/zypp/media/MediaDISK.cc Sat Jul 12 11:19:51 2008
@@ -25,9 +25,21 @@
#include <errno.h>
#include <dirent.h>

-#define DELAYED_VERIFY 1
-
-#define VOL_ID_TOOL_PATHS { "/sbin/vol_id", "/lib/udev/vol_id", NULL}
+/*
+** verify devices names as late as possible (while attach)
+*/
+#define DELAYED_VERIFY 1
+
+/*
+** Reuse foreign (user/automounter) mount points.
+** 0 = don't use, 1 = automounted only, 2 = all
+*/
+#define REUSE_FOREIGN_MOUNTS 2
+
+/*
+** Path to the vol_id tool (normal system, instsys)
+*/
+#define VOL_ID_TOOL_PATHS { "/sbin/vol_id", "/lib/udev/vol_id", NULL}

using namespace std;

@@ -297,13 +309,31 @@
if( is_device && media->maj_nr == dev_info.major() &&
media->min_nr == dev_info.minor())
{
- /*
- if( _filesystem != "auto" && _filesystem != e->type)
+#if REUSE_FOREIGN_MOUNTS > 0
+ AttachPointRef ap( new AttachPoint(e->dir, false));
+ AttachedMedia am( media, ap);
+ //
+ // 1 = automounted only, 2 == all
+ //
+#if REUSE_FOREIGN_MOUNTS == 1
+ if( isAutoMountedMedia(am))
+#endif
{
- ZYPP_THROW();
+ DBG << "Using a system mounted media "
+ << media->name
+ << " attached on "
+ << ap->path
+ << endl;
+
+ media->iown = false; // mark attachment as foreign
+
+ setMediaSource(media);
+ setAttachPoint(ap);
+ return;
}
- */
+#else
media->bdir = e->dir;
+#endif
}
}

@@ -385,8 +415,12 @@
//
void MediaDISK::releaseFrom( const std::string & ejectDev )
{
- Mount mount;
- mount.umount(attachPoint().asString());
+ AttachedMedia am( attachedMedia());
+ if(am.mediaSource && am.mediaSource->iown)
+ {
+ Mount mount;
+ mount.umount(attachPoint().asString());
+ }
}

///////////////////////////////////////////////////////////////////

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages