~ubuntu-branches/ubuntu/karmic/partitionmanager/karmic

« back to all changes in this revision

Viewing changes to src/fs/ntfs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold, Christian Mangold, Jonathan Thomas
  • Date: 2009-06-04 20:19:38 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090604201938-lqvh7rjvoixc9w1u
Tags: 1.0.0~beta3-0ubuntu1
[ Christian Mangold ]
* New upstream beta release (LP: #383702)
* debian/rules:
  - Remove /usr/share/pkg-kde-tools/qt-kde-team/1/debian-qt-kde.mk
  - Use /usr/share/cdbs/1/rules/debhelper.mk
  - Use /usr/share/pkg-kde-tools/makefiles/1/cdbs/kde.mk

[ Jonathan Thomas ]
* Bump debhelper build-depend version to 7 since we use pkg-kde-tools (bumped
  compat too)
* partitionmanager depends on ${misc:Depends}, to satisfy lintain

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2008 by Volker Lanz <vl@fidra.de>                       *
 
2
 *   Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de>                  *
3
3
 *                                                                         *
4
4
 *   This program is free software; you can redistribute it and/or modify  *
5
5
 *   it under the terms of the GNU General Public License as published by  *
41
41
        FileSystem::SupportType ntfs::m_Backup = FileSystem::SupportNone;
42
42
        FileSystem::SupportType ntfs::m_SetLabel = FileSystem::SupportNone;
43
43
        FileSystem::SupportType ntfs::m_UpdateUUID = FileSystem::SupportNone;
 
44
        FileSystem::SupportType ntfs::m_GetUUID = FileSystem::SupportNone;
44
45
 
45
46
        ntfs::ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
46
47
                FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Ntfs)
56
57
                m_Backup = SupportInternal;
57
58
                m_UpdateUUID = findExternal("dd") ? SupportExternal : SupportNone;
58
59
                m_Move = (m_Check != SupportNone) ? SupportInternal : SupportNone;
 
60
                m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
59
61
        }
60
62
 
61
63
        qint64 ntfs::maxCapacity() const
62
64
        {
63
65
                return 256 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB);
64
66
        }
65
 
        
 
67
 
66
68
        qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
67
69
        {
68
70
                ExternalCommand cmd("ntfsresize", QStringList() << "--info" << "--force" << "--no-progress-bar" << deviceNode);
103
105
 
104
106
                ExternalCommand testCmd("ntfslabel", QStringList() << "--force" << deviceNode);
105
107
                testCmd.setProcessChannelMode(QProcess::SeparateChannels);
106
 
                
 
108
 
107
109
                if (!testCmd.run(-1))
108
110
                        return false;
109
 
                
 
111
 
110
112
                return testCmd.output().simplified() == newLabel.simplified();
111
113
        }
112
114
 
132
134
        {
133
135
                QStringList args;
134
136
                args << "-P" << "-f" << deviceNode << "-s" << QString::number(length);
135
 
                
 
137
 
136
138
                QStringList dryRunArgs = args;
137
139
                dryRunArgs << "-n";
138
140
                ExternalCommand cmdDryRun("ntfsresize", dryRunArgs);
142
144
                        ExternalCommand cmd(report, "ntfsresize", args);
143
145
                        return cmd.run(-1) && cmd.exitCode() == 0;
144
146
                }
145
 
                
 
147
 
146
148
                return false;
147
149
        }
148
150
 
150
152
        {
151
153
                char uuid[16];
152
154
                uuid_generate(reinterpret_cast<unsigned char*>(uuid));
153
 
                
 
155
 
154
156
                ExternalCommand cmd(report, "dd", QStringList() << "of=" + deviceNode << "bs=1" << "count=8" << "seek=72");
155
157
 
156
158
                if (!cmd.start())
158
160
 
159
161
                if (cmd.write(uuid, 8) != 8)
160
162
                        return false;
161
 
                
 
163
 
162
164
                return cmd.waitFor(-1);
163
165
        }
164
166
}