Beispiel #1
0
    def setUp(self):
        self._fileSystemType = {}
        type = _ped.file_system_type_get_next()
        self._fileSystemType[type.name] = type

        while True:
            try:
                type = _ped.file_system_type_get_next(type)
                self._fileSystemType[type.name] = type
            except:
                break

        (
            fd,
            self.path,
        ) = tempfile.mkstemp(prefix="temp-device-")
        f = os.fdopen(fd)
        f.seek(140000)
        os.write(fd, b"0")
        f.close()

        os.system("/sbin/mke2fs -F -q %s" % (self.path, ))

        self._device = _ped.device_get(self.path)
        self._geometry = _ped.Geometry(self._device, 0,
                                       self._device.length - 1)
Beispiel #2
0
    def setUp(self):
        self.addCleanup(self.removeTempDevice)

        self._fileSystemType = {}
        ty = _ped.file_system_type_get_next()
        self._fileSystemType[ty.name] = ty

        while True:
            try:
                ty = _ped.file_system_type_get_next(ty)
                self._fileSystemType[ty.name] = ty
            except (IndexError, TypeError, _ped.UnknownTypeException):
                break

        self.temp_prefix = "temp-device-"
        (
            self.fd,
            self.path,
        ) = tempfile.mkstemp(prefix=self.temp_prefix)
        self.f = os.fdopen(self.fd)
        self.f.seek(140000)
        os.write(self.fd, b"0")
        self.f.close()

        os.system("mke2fs -F -q %s" % (self.path, ))

        self._device = _ped.device_get(self.path)
        self._geometry = _ped.Geometry(self._device, 0,
                                       self._device.length - 1)
Beispiel #3
0
    def setUp(self):
        self.addCleanup(self.removeTempDevice)

        self._fileSystemType = {}
        ty = _ped.file_system_type_get_next()
        self._fileSystemType[ty.name] = ty

        while True:
            try:
                ty = _ped.file_system_type_get_next(ty)
                self._fileSystemType[ty.name] = ty
            except (IndexError, TypeError, _ped.UnknownTypeException):
                break

        self.temp_prefix = "temp-device-"
        (self.fd, self.path,) = tempfile.mkstemp(prefix=self.temp_prefix)
        self.f = os.fdopen(self.fd)
        self.f.seek(140000)
        os.write(self.fd, b"0")
        self.f.close()

        os.system("mke2fs -F -q %s" % (self.path,))

        self._device = _ped.device_get(self.path)
        self._geometry = _ped.Geometry(self._device, 0, self._device.length - 1)
Beispiel #4
0
    def setUp(self):
        self._fileSystemType = {}
        type = _ped.file_system_type_get_next()
        self._fileSystemType[type.name] = type

        while True:
            try:
                type = _ped.file_system_type_get_next(type)
                self._fileSystemType[type.name] = type
            except:
                break

        (fd, self.path,) = tempfile.mkstemp(prefix="temp-device-")
        f = os.fdopen(fd)
        f.seek(140000)
        os.write(fd, b"0")
        f.close()

        os.system("/sbin/mke2fs -F -q %s" % (self.path,))

        self._device = _ped.device_get(self.path)
        self._geometry = _ped.Geometry(self._device, 0, self._device.length - 1)
    def type(self):
        """The type of this filesystem, e.g. ext3."""
        return self._type

    @property
    def geometry(self):
        """The Geometry object describing this filesystem."""
        return self._geometry

    @property
    def checked(self):
        """True if this filesystem has been checked, False otherwise."""
        return bool(self._checked)

    def getPedFileSystem(self):
        """Return the _ped.FileSystem object contained in this FileSystem.
           For internal module use only."""
        return self.__fileSystem

# collect all filesystem types and store them in a hash
fileSystemType = {}
__type = _ped.file_system_type_get_next()
fileSystemType[__type.name] = __type

while True:
    try:
        __type = _ped.file_system_type_get_next(__type)
        fileSystemType[__type.name] = __type
    except (IndexError, TypeError, _ped.UnknownTypeException):
        break
Beispiel #6
0
    def type(self):
        """The type of this filesystem, e.g. ext3."""
        return self._type

    @property
    def geometry(self):
        """The Geometry object describing this filesystem."""
        return self._geometry

    @property
    def checked(self):
        """True if this filesystem has been checked, False otherwise."""
        return bool(self._checked)

    def getPedFileSystem(self):
        """Return the _ped.FileSystem object contained in this FileSystem.
           For internal module use only."""
        return self.__fileSystem

# collect all filesystem types and store them in a hash
fileSystemType = {}
__type = _ped.file_system_type_get_next()
fileSystemType[__type.name] = __type

while True:
    try:
        __type = _ped.file_system_type_get_next(__type)
        fileSystemType[__type.name] = __type
    except:
        break