Re: [PATCH 2/2] Some fs types cannot be passed to programs (#495061, #493075).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This looks fine to me. Let's try to have more things with 'mount' and 'type' in the name. Like _typeMount in a future patch.


On 04/09/2009 09:58 AM, Chris Lumens wrote:
For fake filesystems types like EFI that are really vfat underneath, we
want to pass "vfat" to all the commands that expect a type.
---
  storage/formats/fs.py |   22 ++++++++++++++++------
  1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 19f488c..444f3ca 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -118,6 +118,7 @@ def fsConfigFromFile(config_file):
  class FS(DeviceFormat):
      """ Filesystem class. """
      _type = "Abstract Filesystem Class"  # fs type name
+    _mountType = None                    # like _type but for passing to mount
      _name = None
      _mkfs = ""                           # mkfs utility
      _modules = []                        # kernel modules required for support
@@ -249,7 +250,7 @@ class FS(DeviceFormat):
                  options -- list of options to pass to mkfs

          """
-        log_method_call(self, type=self.type, device=self.device,
+        log_method_call(self, type=self.mountType, device=self.device,
                          mountpoint=self.mountpoint)

          intf = kwargs.get("intf")
@@ -437,7 +438,7 @@ class FS(DeviceFormat):
          """Load whatever kernel module is required to support this filesystem."""
          global kernel_filesystems

-        if not self._modules or self.type in kernel_filesystems:
+        if not self._modules or self.mountType in kernel_filesystems:
              return

          for module in self._modules:
@@ -509,7 +510,7 @@ class FS(DeviceFormat):

          try:
              rc = isys.mount(self.device, mountpoint,
-                            fstype=self.type,
+                            fstype=self.mountType,
                              options=options,
                              bindMount=isinstance(self, BindFS))
          except Exception as e:
@@ -628,8 +629,8 @@ class FS(DeviceFormat):

      @property
      def mountable(self):
-        return (self.type in kernel_filesystems) or \
-               (os.access("/sbin/mount.%s" % (self.type,), os.X_OK))
+        return (self.mountType in kernel_filesystems) or \
+               (os.access("/sbin/mount.%s" % (self.mountType,), os.X_OK))

      @property
      def defaultFormatOptions(self):
@@ -697,6 +698,13 @@ class FS(DeviceFormat):

          return _type

+    @property
+    def mountType(self):
+        if not self._mountType:
+            self._mountType = self._type
+
+        return self._mountType
+
      # These methods just wrap filesystem-specific methods in more
      # generically named methods so filesystems and formatted devices
      # like swap and LVM physical volumes can have a common API.
@@ -772,7 +780,7 @@ class Ext2FS(FS):

              if size is None:
                  log.warning("failed to get minimum size for %s filesystem "
-                            "on %s" % (self.type, self.device))
+                            "on %s" % (self.mountType, self.device))
                  size = self._minSize

          return size
@@ -834,6 +842,7 @@ register_device_format(FATFS)

  class EFIFS(FATFS):
      _type = "efi"
+    _mountType = "vfat"
      _modules = ["vfat"]
      _name = "EFI System Partition"
      _minSize = 50
@@ -978,6 +987,7 @@ register_device_format(HFS)

  class AppleBootstrapFS(HFS):
      _type = "appleboot"
+    _mountType = "hfs"
      _name = "Apple Bootstrap"
      _bootable = True
      _minSize = 800.00 / 1024.00


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux