Re: [PATCH 7/8] Get size of existing NTFS filesystems.

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

 



Aside from maybe moving this into a function it looks good.

On Tue, 2009-03-10 at 14:35 -1000, David Cantrell wrote:
> ---
>  storage/formats/fs.py |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
> 
> diff --git a/storage/formats/fs.py b/storage/formats/fs.py
> index 7579122..2e595af 100644
> --- a/storage/formats/fs.py
> +++ b/storage/formats/fs.py
> @@ -963,6 +963,38 @@ class NTFS(FS):
>      _defaultCheckOptions = ["-c"]
>      _packages = ["ntfsprogs"]
>  
> +    def __init__(self, *args, **kwargs):
> +        FS.__init__(self, *args, **kwargs)
> +
> +        # get size of existing filesystem
> +        if self.exists:
> +            clusterSize = 0
> +            volumeSize = 0
> +
> +            buf = iutil.execWithCapture('ntfsinfo', ['-m', self.device],
> +                                        stderr="/dev/tty5")
> +
> +            for line in buf.splitlines():
> +                if line.startswith('\t'):
> +                    tmp = line.split('\t')
> +                    line = tmp[len(tmp) - 1]
> +
> +                tmp = line.split(' ')
> +
> +                if line.startswith('Cluster Size:'):
> +                    clusterSize = long(tmp[len(tmp) - 1])
> +                elif line.startswith('Volume Size in Clusters:'):
> +                    volumeSize = long(tmp[len(tmp) - 1])
> +
> +                if clusterSize and volumeSize:
> +                    break
> +
> +            # report current size as megabytes
> +            self._size = (clusterSize * volumeSize) / 1024.0 / 1024.0
> +
> +            # set target size to equal current size
> +            self.targetSize = self._size
> +
>      @property
>      def minSize(self):
>          """ The minimum filesystem size in megabytes. """

_______________________________________________
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