Merge lp:~csurbhi/ubuntu/maverick/gparted/gparted.fix-598946 into lp:ubuntu/maverick/gparted
- Maverick (10.10)
- gparted.fix-598946
- Merge into maverick
Status: | Merged |
---|---|
Merged at revision: | 24 |
Proposed branch: | lp:~csurbhi/ubuntu/maverick/gparted/gparted.fix-598946 |
Merge into: | lp:ubuntu/maverick/gparted |
Diff against target: |
696 lines (+512/-27) 10 files modified
.pc/applied-patches (+1/-0) configure.in (+18/-0) debian/changelog (+7/-0) debian/patches/02-btrfs.patch (+410/-0) debian/patches/series (+1/-0) include/Makefile.am (+6/-1) include/Utils.h (+12/-5) src/GParted_Core.cc (+47/-20) src/Makefile.am (+6/-1) src/Utils.cc (+4/-0) |
To merge this branch: | bzr merge lp:~csurbhi/ubuntu/maverick/gparted/gparted.fix-598946 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson | Approve | ||
Review via email: mp+29379@code.launchpad.net |
Commit message
Description of the change
This patch fixes the bug 598946 on LP. It adds the following btrfs support to gparted:
1) btrfs.mkfs
2) btrfs.fsck
3) btrfs-show
using the external btrfs-tools.
The original patch was fetched from https:/
It was slightly modified so as to keep the original support of btrfs detection intact. The original patch adds all the support in #if BTRFS_SUPPORT. Kept the original btrfs detection code in gparted in the #else part so as to allow btrfs partition from being detected even when gparted is compiled without BTRFS_SUPPORT = 1.
On the other hand when gparted is compiled with BTRFS_SUPPORT, the extra functionality along with detection is added.
Do consider merging this for maverick.
Thanks!
Colin Watson (cjwatson) wrote : | # |
Surbhi Palande (csurbhi) wrote : | # |
Created a new bzr branch with the above comments. This is kept at code.edge.
Shall delete this branch soon.
Surbhi Palande (csurbhi) wrote : | # |
1) Changed the debian/
2) Changed the configure.in to enable btrfs support by default. To disable btrfs support, ./configure should be invoked with --enable-btrfs=no
Surbhi Palande (csurbhi) wrote : | # |
- 24. By Surbhi Palande
-
Added btrfs support (mkfs, fsck, show) to gparted. Original patch came
from https://bugzilla. gnome.org/ attachment. cgi?id= 128768 . (LP: #598946)
Colin Watson (cjwatson) : | # |
Preview Diff
1 | === modified file '.pc/applied-patches' | |||
2 | --- .pc/applied-patches 2010-03-14 12:54:22 +0000 | |||
3 | +++ .pc/applied-patches 2010-07-14 16:03:42 +0000 | |||
4 | @@ -1,1 +1,2 @@ | |||
5 | 1 | 01_fix-desktop.patch | 1 | 01_fix-desktop.patch |
6 | 2 | 02-btrfs.patch | ||
7 | 2 | 3 | ||
8 | === modified file 'configure.in' | |||
9 | --- configure.in 2010-03-14 12:54:22 +0000 | |||
10 | +++ configure.in 2010-07-14 16:03:42 +0000 | |||
11 | @@ -170,6 +170,22 @@ | |||
12 | 170 | 170 | ||
13 | 171 | AM_CONDITIONAL(DISABLE_DOC, test ${enable_doc} = no) | 171 | AM_CONDITIONAL(DISABLE_DOC, test ${enable_doc} = no) |
14 | 172 | 172 | ||
15 | 173 | dnl ****************************** | ||
16 | 174 | dnl Optional btrfs support | ||
17 | 175 | dnl ****************************** | ||
18 | 176 | |||
19 | 177 | with_btrfs="yes" | ||
20 | 178 | AC_ARG_ENABLE( btrfs, | ||
21 | 179 | AS_HELP_STRING([--enable-btrfs], [enable experimental btrfs support (enabled by default)]), | ||
22 | 180 | with_btrfs=$enableval) | ||
23 | 181 | |||
24 | 182 | if test "x$with_btrfs" = "xyes"; then | ||
25 | 183 | AC_DEFINE(BTRFS_SUPPORT,1,[Build in btrfs support]) | ||
26 | 184 | else | ||
27 | 185 | with_btrfs="no" | ||
28 | 186 | fi | ||
29 | 187 | AM_CONDITIONAL(BTRFS_SUPPORT, test "x$with_btrfs" = "xyes") | ||
30 | 188 | |||
31 | 173 | 189 | ||
32 | 174 | AC_CONFIG_FILES([ | 190 | AC_CONFIG_FILES([ |
33 | 175 | Makefile | 191 | Makefile |
34 | @@ -194,6 +210,8 @@ | |||
35 | 194 | echo "================ Final configuration ===================" | 210 | echo "================ Final configuration ===================" |
36 | 195 | echo " Installing into prefix : $prefix" | 211 | echo " Installing into prefix : $prefix" |
37 | 196 | echo "" | 212 | echo "" |
38 | 213 | echo " Enable btrfs support? : $with_btrfs" | ||
39 | 214 | echo "" | ||
40 | 197 | echo " Build documentation? : $enable_doc" | 215 | echo " Build documentation? : $enable_doc" |
41 | 198 | echo "" | 216 | echo "" |
42 | 199 | echo " Need pt re-read work around? : $need_pt_reread_work_around" | 217 | echo " Need pt re-read work around? : $need_pt_reread_work_around" |
43 | 200 | 218 | ||
44 | === modified file 'debian/changelog' | |||
45 | --- debian/changelog 2010-03-22 13:10:57 +0000 | |||
46 | +++ debian/changelog 2010-07-14 16:03:42 +0000 | |||
47 | @@ -1,3 +1,10 @@ | |||
48 | 1 | gparted (0.5.2-2ubuntu1) maverick; urgency=low | ||
49 | 2 | |||
50 | 3 | * Added btrfs support (mkfs, fsck, show) to gparted. Original patch came | ||
51 | 4 | from https://bugzilla.gnome.org/attachment.cgi?id=128768 . (LP: #598946) | ||
52 | 5 | |||
53 | 6 | -- Surbhi Palande <surbhi.palande@canonical.com> Tue, 13 Jul 2010 16:57:36 +0300 | ||
54 | 7 | |||
55 | 1 | gparted (0.5.2-2) unstable; urgency=low | 8 | gparted (0.5.2-2) unstable; urgency=low |
56 | 2 | 9 | ||
57 | 3 | * Rebuild against parted 2.2 | 10 | * Rebuild against parted 2.2 |
58 | 4 | 11 | ||
59 | === added file 'debian/patches/02-btrfs.patch' | |||
60 | --- debian/patches/02-btrfs.patch 1970-01-01 00:00:00 +0000 | |||
61 | +++ debian/patches/02-btrfs.patch 2010-07-14 16:03:42 +0000 | |||
62 | @@ -0,0 +1,410 @@ | |||
63 | 1 | Index: b/configure.in | ||
64 | 2 | =================================================================== | ||
65 | 3 | --- a/configure.in | ||
66 | 4 | +++ b/configure.in | ||
67 | 5 | @@ -170,6 +170,22 @@ | ||
68 | 6 | |||
69 | 7 | AM_CONDITIONAL(DISABLE_DOC, test ${enable_doc} = no) | ||
70 | 8 | |||
71 | 9 | +dnl ****************************** | ||
72 | 10 | +dnl Optional btrfs support | ||
73 | 11 | +dnl ****************************** | ||
74 | 12 | + | ||
75 | 13 | +with_btrfs="yes" | ||
76 | 14 | +AC_ARG_ENABLE( btrfs, | ||
77 | 15 | + AS_HELP_STRING([--enable-btrfs], [enable experimental btrfs support (enabled by default)]), | ||
78 | 16 | + with_btrfs=$enableval) | ||
79 | 17 | + | ||
80 | 18 | +if test "x$with_btrfs" = "xyes"; then | ||
81 | 19 | + AC_DEFINE(BTRFS_SUPPORT,1,[Build in btrfs support]) | ||
82 | 20 | +else | ||
83 | 21 | + with_btrfs="no" | ||
84 | 22 | +fi | ||
85 | 23 | +AM_CONDITIONAL(BTRFS_SUPPORT, test "x$with_btrfs" = "xyes") | ||
86 | 24 | + | ||
87 | 25 | |||
88 | 26 | AC_CONFIG_FILES([ | ||
89 | 27 | Makefile | ||
90 | 28 | @@ -194,6 +210,8 @@ | ||
91 | 29 | echo "================ Final configuration ===================" | ||
92 | 30 | echo " Installing into prefix : $prefix" | ||
93 | 31 | echo "" | ||
94 | 32 | +echo " Enable btrfs support? : $with_btrfs" | ||
95 | 33 | +echo "" | ||
96 | 34 | echo " Build documentation? : $enable_doc" | ||
97 | 35 | echo "" | ||
98 | 36 | echo " Need pt re-read work around? : $need_pt_reread_work_around" | ||
99 | 37 | Index: b/include/Makefile.am | ||
100 | 38 | =================================================================== | ||
101 | 39 | --- a/include/Makefile.am | ||
102 | 40 | +++ b/include/Makefile.am | ||
103 | 41 | @@ -1,5 +1,9 @@ | ||
104 | 42 | gparted_includedir = $(pkgincludedir) | ||
105 | 43 | |||
106 | 44 | +if BTRFS_SUPPORT | ||
107 | 45 | +btrfs_source = btrfs.h | ||
108 | 46 | +endif | ||
109 | 47 | + | ||
110 | 48 | EXTRA_DIST = \ | ||
111 | 49 | Device.h \ | ||
112 | 50 | Dialog_Base_Partition.h \ | ||
113 | 51 | @@ -48,4 +52,5 @@ | ||
114 | 52 | reiser4.h \ | ||
115 | 53 | reiserfs.h \ | ||
116 | 54 | ufs.h \ | ||
117 | 55 | - xfs.h | ||
118 | 56 | + xfs.h \ | ||
119 | 57 | + $(btrfs_source) | ||
120 | 58 | Index: b/include/Utils.h | ||
121 | 59 | =================================================================== | ||
122 | 60 | --- a/include/Utils.h | ||
123 | 61 | +++ b/include/Utils.h | ||
124 | 62 | @@ -66,11 +66,18 @@ | ||
125 | 63 | FS_HFS = 15, | ||
126 | 64 | FS_HFSPLUS = 16, | ||
127 | 65 | FS_UFS = 17, | ||
128 | 66 | +#if BTRFS_SUPPORT | ||
129 | 67 | + FS_BTRFS = 18, | ||
130 | 68 | |||
131 | 69 | - FS_USED = 18, | ||
132 | 70 | - FS_UNUSED = 19, | ||
133 | 71 | + FS_USED = 19, | ||
134 | 72 | + FS_UNUSED = 20, | ||
135 | 73 | +#else | ||
136 | 74 | + FS_USED = 18, | ||
137 | 75 | + FS_UNUSED = 19, | ||
138 | 76 | + | ||
139 | 77 | + FS_BTRFS = 20, /* FIXME: Move this higher up list when full support added */ | ||
140 | 78 | +#endif | ||
141 | 79 | |||
142 | 80 | - FS_BTRFS = 20, /* FIXME: Move this higher up list when full support added */ | ||
143 | 81 | FS_LVM2 = 21, | ||
144 | 82 | FS_LUKS = 22 | ||
145 | 83 | } ; | ||
146 | 84 | Index: b/include/btrfs.h | ||
147 | 85 | =================================================================== | ||
148 | 86 | --- /dev/null | ||
149 | 87 | +++ b/include/btrfs.h | ||
150 | 88 | @@ -0,0 +1,42 @@ | ||
151 | 89 | +/* Copyright (C) 2009 Luca Bruno <lucab@debian.org> | ||
152 | 90 | + * | ||
153 | 91 | + * This program is free software; you can redistribute it and/or modify | ||
154 | 92 | + * it under the terms of the GNU General Public License as published by | ||
155 | 93 | + * the Free Software Foundation; either version 2 of the License, or | ||
156 | 94 | + * (at your option) any later version. | ||
157 | 95 | + * | ||
158 | 96 | + * This program is distributed in the hope that it will be useful, | ||
159 | 97 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
160 | 98 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
161 | 99 | + * GNU Library General Public License for more details. | ||
162 | 100 | + * | ||
163 | 101 | + * You should have received a copy of the GNU General Public License | ||
164 | 102 | + * along with this program; if not, write to the Free Software | ||
165 | 103 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
166 | 104 | + */ | ||
167 | 105 | + | ||
168 | 106 | + | ||
169 | 107 | +#ifndef BTRFS_H_ | ||
170 | 108 | +#define BTRFS_H_ | ||
171 | 109 | + | ||
172 | 110 | +#include "../include/FileSystem.h" | ||
173 | 111 | + | ||
174 | 112 | +namespace GParted | ||
175 | 113 | +{ | ||
176 | 114 | +class btrfs : public FileSystem | ||
177 | 115 | +{ | ||
178 | 116 | +public: | ||
179 | 117 | + FS get_filesystem_support() ; | ||
180 | 118 | + void set_used_sectors( Partition & partition ) ; | ||
181 | 119 | + void read_label( Partition & partition ) ; | ||
182 | 120 | + bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; | ||
183 | 121 | + bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; | ||
184 | 122 | + bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ; | ||
185 | 123 | + bool copy( const Glib::ustring & src_part_path, | ||
186 | 124 | + const Glib::ustring & dest_part_path, | ||
187 | 125 | + OperationDetail & operationdetail ) ; | ||
188 | 126 | + bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; | ||
189 | 127 | +}; | ||
190 | 128 | +} //GParted | ||
191 | 129 | + | ||
192 | 130 | +#endif //BTRFS_H_ | ||
193 | 131 | Index: b/src/GParted_Core.cc | ||
194 | 132 | =================================================================== | ||
195 | 133 | --- a/src/GParted_Core.cc | ||
196 | 134 | +++ b/src/GParted_Core.cc | ||
197 | 135 | @@ -27,6 +27,7 @@ | ||
198 | 136 | #include "../include/OperationFormat.h" | ||
199 | 137 | #include "../include/OperationResizeMove.h" | ||
200 | 138 | #include "../include/OperationLabelPartition.h" | ||
201 | 139 | +#include "../config.h" | ||
202 | 140 | |||
203 | 141 | #include "../include/ext2.h" | ||
204 | 142 | #include "../include/ext3.h" | ||
205 | 143 | @@ -42,7 +43,9 @@ | ||
206 | 144 | #include "../include/hfsplus.h" | ||
207 | 145 | #include "../include/reiser4.h" | ||
208 | 146 | #include "../include/ufs.h" | ||
209 | 147 | - | ||
210 | 148 | +#ifdef BTRFS_SUPPORT | ||
211 | 149 | +#include "../include/btrfs.h" | ||
212 | 150 | +#endif | ||
213 | 151 | #include <set> | ||
214 | 152 | #include <cerrno> | ||
215 | 153 | #include <cstring> | ||
216 | 154 | @@ -127,12 +130,17 @@ | ||
217 | 155 | |||
218 | 156 | xfs fs_xfs; | ||
219 | 157 | FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ; | ||
220 | 158 | - | ||
221 | 159 | + | ||
222 | 160 | FS *fs ; | ||
223 | 161 | +#ifdef BTRFS_SUPPORT | ||
224 | 162 | + btrfs fs_btrfs; | ||
225 | 163 | + FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ; | ||
226 | 164 | +#else | ||
227 | 165 | //btrfs FIXME: Add full support when on-disk-format stabilized | ||
228 | 166 | fs = new( FS ) ; | ||
229 | 167 | fs ->filesystem = GParted::FS_BTRFS ; | ||
230 | 168 | FILESYSTEMS .push_back( * fs ) ; | ||
231 | 169 | +#endif | ||
232 | 170 | |||
233 | 171 | //lvm2 physical volume -- not a file system | ||
234 | 172 | fs = new( FS ) ; | ||
235 | 173 | @@ -972,26 +980,23 @@ | ||
236 | 174 | if ( Glib::ustring( buf ) == "ReIsEr4" ) | ||
237 | 175 | return GParted::FS_REISER4 ; | ||
238 | 176 | |||
239 | 177 | - //lvm2 | ||
240 | 178 | - //NOTE: lvm2 is not a file system but we do wish to recognize the Physical Volume | ||
241 | 179 | - char magic1[16] ; | ||
242 | 180 | - char magic2[16] ; | ||
243 | 181 | +#ifdef BTRFS_SUPPORT | ||
244 | 182 | + //btrfs | ||
245 | 183 | + //extemporaneus hack - patch already sent to parted (detection only, there too) | ||
246 | 184 | + #define BTRFS_SUPER_INFO_SIZE 4096 | ||
247 | 185 | + #define BTRFS_SUPER_INFO_OFFSET (64 * 1024) | ||
248 | 186 | + #define BTRFS_SIGNATURE "_BHRfS_M" | ||
249 | 187 | + | ||
250 | 188 | + char buf_btrfs[BTRFS_SUPER_INFO_SIZE]; | ||
251 | 189 | |||
252 | 190 | ped_device_open( lp_device ); | ||
253 | 191 | - ped_geometry_read( & lp_partition ->geom, buf, 1, 1 ) ; | ||
254 | 192 | - strncpy(magic1, buf+0, 8) ; magic1[8] = '\0' ; //set and terminate string | ||
255 | 193 | - strncpy(magic2, buf+24, 4) ; magic2[4] = '\0' ; //set and terminate string | ||
256 | 194 | + if (ped_geometry_read( & lp_partition ->geom, buf_btrfs, \ | ||
257 | 195 | + (BTRFS_SUPER_INFO_OFFSET / 512), \ | ||
258 | 196 | + (BTRFS_SUPER_INFO_SIZE / 512))) | ||
259 | 197 | + if ( Glib::ustring( buf+64, strlen(BTRFS_SIGNATURE) ) == BTRFS_SIGNATURE) | ||
260 | 198 | + return GParted::FS_BTRFS; | ||
261 | 199 | ped_device_close( lp_device ); | ||
262 | 200 | - | ||
263 | 201 | - if ( Glib::ustring( magic1 ) == "LABELONE" | ||
264 | 202 | - && Glib::ustring( magic2 ) == "LVM2" ) | ||
265 | 203 | - { | ||
266 | 204 | - temp = _( "Logical Volume Management is not yet supported." ) ; | ||
267 | 205 | - temp += "\n" ; | ||
268 | 206 | - partition_temp .messages .push_back( temp ) ; | ||
269 | 207 | - return GParted::FS_LVM2 ; | ||
270 | 208 | - } | ||
271 | 209 | - | ||
272 | 210 | +#else | ||
273 | 211 | //btrfs | ||
274 | 212 | const Sector BTRFS_SUPER_INFO_SIZE = 4096 ; | ||
275 | 213 | const Sector BTRFS_SUPER_INFO_OFFSET = (64 * 1024) ; | ||
276 | 214 | @@ -1014,6 +1019,26 @@ | ||
277 | 215 | partition_temp .messages .push_back( temp ) ; | ||
278 | 216 | return GParted::FS_BTRFS ; | ||
279 | 217 | } | ||
280 | 218 | +#endif | ||
281 | 219 | + //lvm2 | ||
282 | 220 | + //NOTE: lvm2 is not a file system but we do wish to recognize the Physical Volume | ||
283 | 221 | + char magic1[16] ; | ||
284 | 222 | + char magic2[16] ; | ||
285 | 223 | + | ||
286 | 224 | + ped_device_open( lp_device ); | ||
287 | 225 | + ped_geometry_read( & lp_partition ->geom, buf, 1, 1 ) ; | ||
288 | 226 | + strncpy(magic1, buf+0, 8) ; magic1[8] = '\0' ; //set and terminate string | ||
289 | 227 | + strncpy(magic2, buf+24, 4) ; magic2[4] = '\0' ; //set and terminate string | ||
290 | 228 | + ped_device_close( lp_device ); | ||
291 | 229 | + | ||
292 | 230 | + if ( Glib::ustring( magic1 ) == "LABELONE" | ||
293 | 231 | + && Glib::ustring( magic2 ) == "LVM2" ) | ||
294 | 232 | + { | ||
295 | 233 | + temp = _( "Logical Volume Management is not yet supported." ) ; | ||
296 | 234 | + temp += "\n" ; | ||
297 | 235 | + partition_temp .messages .push_back( temp ) ; | ||
298 | 236 | + return GParted::FS_LVM2 ; | ||
299 | 237 | + } | ||
300 | 238 | |||
301 | 239 | //no file system found.... | ||
302 | 240 | temp = _( "Unable to detect file system! Possible reasons are:" ) ; | ||
303 | 241 | @@ -2599,7 +2624,9 @@ | ||
304 | 242 | case FS_HFS : p_filesystem = new hfs() ; break ; | ||
305 | 243 | case FS_HFSPLUS : p_filesystem = new hfsplus() ; break ; | ||
306 | 244 | case FS_UFS : p_filesystem = new ufs() ; break ; | ||
307 | 245 | - | ||
308 | 246 | +#ifdef BTRFS_SUPPORT | ||
309 | 247 | + case FS_BTRFS : p_filesystem = new btrfs() ; break ; | ||
310 | 248 | +#endif | ||
311 | 249 | default : p_filesystem = NULL ; | ||
312 | 250 | } | ||
313 | 251 | |||
314 | 252 | Index: b/src/Makefile.am | ||
315 | 253 | =================================================================== | ||
316 | 254 | --- a/src/Makefile.am | ||
317 | 255 | +++ b/src/Makefile.am | ||
318 | 256 | @@ -7,6 +7,10 @@ | ||
319 | 257 | |||
320 | 258 | AM_CXXFLAGS = -Wall | ||
321 | 259 | |||
322 | 260 | +if BTRFS_SUPPORT | ||
323 | 261 | +btrfs_source = btrfs.cc | ||
324 | 262 | +endif | ||
325 | 263 | + | ||
326 | 264 | sbin_PROGRAMS = gpartedbin | ||
327 | 265 | |||
328 | 266 | gpartedbin_SOURCES = \ | ||
329 | 267 | @@ -57,7 +61,8 @@ | ||
330 | 268 | reiser4.cc \ | ||
331 | 269 | reiserfs.cc \ | ||
332 | 270 | ufs.cc \ | ||
333 | 271 | - xfs.cc | ||
334 | 272 | + xfs.cc \ | ||
335 | 273 | + $(btrfs_source) | ||
336 | 274 | |||
337 | 275 | gpartedbin_LDFLAGS = -lparted -lgthread-2.0 | ||
338 | 276 | |||
339 | 277 | Index: b/src/Utils.cc | ||
340 | 278 | =================================================================== | ||
341 | 279 | --- a/src/Utils.cc | ||
342 | 280 | +++ b/src/Utils.cc | ||
343 | 281 | @@ -17,6 +17,7 @@ | ||
344 | 282 | */ | ||
345 | 283 | |||
346 | 284 | #include "../include/Utils.h" | ||
347 | 285 | +#include "../config.h" | ||
348 | 286 | |||
349 | 287 | #include <sstream> | ||
350 | 288 | #include <iomanip> | ||
351 | 289 | @@ -161,6 +162,9 @@ | ||
352 | 290 | case FS_REISER4 : return "reiser4progs" ; | ||
353 | 291 | case FS_REISERFS : return "reiserfsprogs" ; | ||
354 | 292 | case FS_UFS : return "" ; | ||
355 | 293 | +#ifdef BTRFS_SUPPORT | ||
356 | 294 | + case FS_BTRFS : return "btrfs-tools" ; | ||
357 | 295 | +#endif | ||
358 | 296 | case FS_XFS : return "xfsprogs" ; | ||
359 | 297 | |||
360 | 298 | default : return "" ; | ||
361 | 299 | Index: b/src/btrfs.cc | ||
362 | 300 | =================================================================== | ||
363 | 301 | --- /dev/null | ||
364 | 302 | +++ b/src/btrfs.cc | ||
365 | 303 | @@ -0,0 +1,107 @@ | ||
366 | 304 | +/* Copyright (C) 2009 Luca Bruno <lucab@debian.org> | ||
367 | 305 | + * | ||
368 | 306 | + * This program is free software; you can redistribute it and/or modify | ||
369 | 307 | + * it under the terms of the GNU General Public License as published by | ||
370 | 308 | + * the Free Software Foundation; either version 2 of the License, or | ||
371 | 309 | + * (at your option) any later version. | ||
372 | 310 | + * | ||
373 | 311 | + * This program is distributed in the hope that it will be useful, | ||
374 | 312 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
375 | 313 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
376 | 314 | + * GNU Library General Public License for more details. | ||
377 | 315 | + * | ||
378 | 316 | + * You should have received a copy of the GNU General Public License | ||
379 | 317 | + * along with this program; if not, write to the Free Software | ||
380 | 318 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
381 | 319 | + */ | ||
382 | 320 | + | ||
383 | 321 | + | ||
384 | 322 | +#include "../include/btrfs.h" | ||
385 | 323 | + | ||
386 | 324 | +namespace GParted | ||
387 | 325 | +{ | ||
388 | 326 | + | ||
389 | 327 | +FS btrfs::get_filesystem_support() | ||
390 | 328 | +{ | ||
391 | 329 | + FS fs ; | ||
392 | 330 | + fs .filesystem = GParted::FS_BTRFS ; | ||
393 | 331 | + | ||
394 | 332 | + if ( ! Glib::find_program_in_path( "btrfs-show" ) .empty() ) | ||
395 | 333 | + { | ||
396 | 334 | + fs .read = GParted::FS::EXTERNAL ; | ||
397 | 335 | + fs .read_label = FS::EXTERNAL ; | ||
398 | 336 | + } | ||
399 | 337 | + | ||
400 | 338 | + if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() ) | ||
401 | 339 | + fs .create = GParted::FS::EXTERNAL ; | ||
402 | 340 | + | ||
403 | 341 | + if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() ) | ||
404 | 342 | + fs .check = GParted::FS::EXTERNAL ; | ||
405 | 343 | + | ||
406 | 344 | + if ( fs .check ) | ||
407 | 345 | + { | ||
408 | 346 | + fs .copy = GParted::FS::GPARTED ; | ||
409 | 347 | + fs .move = GParted::FS::GPARTED ; | ||
410 | 348 | + } | ||
411 | 349 | + | ||
412 | 350 | + fs .MIN = 256 * MEBIBYTE ; | ||
413 | 351 | + | ||
414 | 352 | + return fs ; | ||
415 | 353 | +} | ||
416 | 354 | + | ||
417 | 355 | +bool btrfs::create( const Partition & new_partition, OperationDetail & operationdetail ) | ||
418 | 356 | +{ | ||
419 | 357 | + return (! execute_command( "mkfs.btrfs -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ); | ||
420 | 358 | +} | ||
421 | 359 | + | ||
422 | 360 | +bool btrfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) | ||
423 | 361 | +{ | ||
424 | 362 | + return (! execute_command( "btrfsck " + partition .get_path(), operationdetail )) ; | ||
425 | 363 | +} | ||
426 | 364 | + | ||
427 | 365 | +void btrfs::set_used_sectors( Partition & partition ) | ||
428 | 366 | +{ | ||
429 | 367 | +// TODO | ||
430 | 368 | + return; | ||
431 | 369 | +} | ||
432 | 370 | + | ||
433 | 371 | +bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail ) | ||
434 | 372 | +{ | ||
435 | 373 | +// TODO | ||
436 | 374 | + return true ; | ||
437 | 375 | +} | ||
438 | 376 | + | ||
439 | 377 | +bool btrfs::copy( const Glib::ustring & src_part_path, | ||
440 | 378 | + const Glib::ustring & dest_part_path, | ||
441 | 379 | + OperationDetail & operationdetail ) | ||
442 | 380 | +{ | ||
443 | 381 | +// TODO | ||
444 | 382 | + return true ; | ||
445 | 383 | +} | ||
446 | 384 | + | ||
447 | 385 | +bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) | ||
448 | 386 | +{ | ||
449 | 387 | +// TODO | ||
450 | 388 | + return true ; | ||
451 | 389 | +} | ||
452 | 390 | + | ||
453 | 391 | +void btrfs::read_label( Partition & partition ) | ||
454 | 392 | +{ | ||
455 | 393 | + if ( ! Utils::execute_command( "btrfs-show " + partition .get_path(), output, error, true ) ) | ||
456 | 394 | + { | ||
457 | 395 | + partition .label = Utils::regexp_label( output, "^Label ([^\n\t]*)" ) ; | ||
458 | 396 | + } | ||
459 | 397 | + else | ||
460 | 398 | + { | ||
461 | 399 | + if ( ! output .empty() ) | ||
462 | 400 | + partition .messages .push_back( output ) ; | ||
463 | 401 | + | ||
464 | 402 | + if ( ! error .empty() ) | ||
465 | 403 | + partition .messages .push_back( error ) ; | ||
466 | 404 | + } | ||
467 | 405 | + | ||
468 | 406 | +} | ||
469 | 407 | + | ||
470 | 408 | +} //GParted | ||
471 | 409 | + | ||
472 | 410 | + | ||
473 | 0 | 411 | ||
474 | === modified file 'debian/patches/series' | |||
475 | --- debian/patches/series 2009-11-07 20:00:00 +0000 | |||
476 | +++ debian/patches/series 2010-07-14 16:03:42 +0000 | |||
477 | @@ -1,1 +1,2 @@ | |||
478 | 1 | 01_fix-desktop.patch | 1 | 01_fix-desktop.patch |
479 | 2 | 02-btrfs.patch | ||
480 | 2 | 3 | ||
481 | === modified file 'include/Makefile.am' | |||
482 | --- include/Makefile.am 2009-12-15 12:06:03 +0000 | |||
483 | +++ include/Makefile.am 2010-07-14 16:03:42 +0000 | |||
484 | @@ -1,5 +1,9 @@ | |||
485 | 1 | gparted_includedir = $(pkgincludedir) | 1 | gparted_includedir = $(pkgincludedir) |
486 | 2 | 2 | ||
487 | 3 | if BTRFS_SUPPORT | ||
488 | 4 | btrfs_source = btrfs.h | ||
489 | 5 | endif | ||
490 | 6 | |||
491 | 3 | EXTRA_DIST = \ | 7 | EXTRA_DIST = \ |
492 | 4 | Device.h \ | 8 | Device.h \ |
493 | 5 | Dialog_Base_Partition.h \ | 9 | Dialog_Base_Partition.h \ |
494 | @@ -48,4 +52,5 @@ | |||
495 | 48 | reiser4.h \ | 52 | reiser4.h \ |
496 | 49 | reiserfs.h \ | 53 | reiserfs.h \ |
497 | 50 | ufs.h \ | 54 | ufs.h \ |
499 | 51 | xfs.h | 55 | xfs.h \ |
500 | 56 | $(btrfs_source) | ||
501 | 52 | 57 | ||
502 | === modified file 'include/Utils.h' | |||
503 | --- include/Utils.h 2010-01-27 12:50:10 +0000 | |||
504 | +++ include/Utils.h 2010-07-14 16:03:42 +0000 | |||
505 | @@ -66,11 +66,18 @@ | |||
506 | 66 | FS_HFS = 15, | 66 | FS_HFS = 15, |
507 | 67 | FS_HFSPLUS = 16, | 67 | FS_HFSPLUS = 16, |
508 | 68 | FS_UFS = 17, | 68 | FS_UFS = 17, |
514 | 69 | 69 | #if BTRFS_SUPPORT | |
515 | 70 | FS_USED = 18, | 70 | FS_BTRFS = 18, |
516 | 71 | FS_UNUSED = 19, | 71 | |
517 | 72 | 72 | FS_USED = 19, | |
518 | 73 | FS_BTRFS = 20, /* FIXME: Move this higher up list when full support added */ | 73 | FS_UNUSED = 20, |
519 | 74 | #else | ||
520 | 75 | FS_USED = 18, | ||
521 | 76 | FS_UNUSED = 19, | ||
522 | 77 | |||
523 | 78 | FS_BTRFS = 20, /* FIXME: Move this higher up list when full support added */ | ||
524 | 79 | #endif | ||
525 | 80 | |||
526 | 74 | FS_LVM2 = 21, | 81 | FS_LVM2 = 21, |
527 | 75 | FS_LUKS = 22 | 82 | FS_LUKS = 22 |
528 | 76 | } ; | 83 | } ; |
529 | 77 | 84 | ||
530 | === modified file 'src/GParted_Core.cc' | |||
531 | --- src/GParted_Core.cc 2010-03-14 12:54:22 +0000 | |||
532 | +++ src/GParted_Core.cc 2010-07-14 16:03:42 +0000 | |||
533 | @@ -27,6 +27,7 @@ | |||
534 | 27 | #include "../include/OperationFormat.h" | 27 | #include "../include/OperationFormat.h" |
535 | 28 | #include "../include/OperationResizeMove.h" | 28 | #include "../include/OperationResizeMove.h" |
536 | 29 | #include "../include/OperationLabelPartition.h" | 29 | #include "../include/OperationLabelPartition.h" |
537 | 30 | #include "../config.h" | ||
538 | 30 | 31 | ||
539 | 31 | #include "../include/ext2.h" | 32 | #include "../include/ext2.h" |
540 | 32 | #include "../include/ext3.h" | 33 | #include "../include/ext3.h" |
541 | @@ -42,7 +43,9 @@ | |||
542 | 42 | #include "../include/hfsplus.h" | 43 | #include "../include/hfsplus.h" |
543 | 43 | #include "../include/reiser4.h" | 44 | #include "../include/reiser4.h" |
544 | 44 | #include "../include/ufs.h" | 45 | #include "../include/ufs.h" |
546 | 45 | 46 | #ifdef BTRFS_SUPPORT | |
547 | 47 | #include "../include/btrfs.h" | ||
548 | 48 | #endif | ||
549 | 46 | #include <set> | 49 | #include <set> |
550 | 47 | #include <cerrno> | 50 | #include <cerrno> |
551 | 48 | #include <cstring> | 51 | #include <cstring> |
552 | @@ -127,12 +130,17 @@ | |||
553 | 127 | 130 | ||
554 | 128 | xfs fs_xfs; | 131 | xfs fs_xfs; |
555 | 129 | FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ; | 132 | FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ; |
557 | 130 | 133 | ||
558 | 131 | FS *fs ; | 134 | FS *fs ; |
559 | 135 | #ifdef BTRFS_SUPPORT | ||
560 | 136 | btrfs fs_btrfs; | ||
561 | 137 | FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ; | ||
562 | 138 | #else | ||
563 | 132 | //btrfs FIXME: Add full support when on-disk-format stabilized | 139 | //btrfs FIXME: Add full support when on-disk-format stabilized |
564 | 133 | fs = new( FS ) ; | 140 | fs = new( FS ) ; |
565 | 134 | fs ->filesystem = GParted::FS_BTRFS ; | 141 | fs ->filesystem = GParted::FS_BTRFS ; |
566 | 135 | FILESYSTEMS .push_back( * fs ) ; | 142 | FILESYSTEMS .push_back( * fs ) ; |
567 | 143 | #endif | ||
568 | 136 | 144 | ||
569 | 137 | //lvm2 physical volume -- not a file system | 145 | //lvm2 physical volume -- not a file system |
570 | 138 | fs = new( FS ) ; | 146 | fs = new( FS ) ; |
571 | @@ -972,26 +980,23 @@ | |||
572 | 972 | if ( Glib::ustring( buf ) == "ReIsEr4" ) | 980 | if ( Glib::ustring( buf ) == "ReIsEr4" ) |
573 | 973 | return GParted::FS_REISER4 ; | 981 | return GParted::FS_REISER4 ; |
574 | 974 | 982 | ||
579 | 975 | //lvm2 | 983 | #ifdef BTRFS_SUPPORT |
580 | 976 | //NOTE: lvm2 is not a file system but we do wish to recognize the Physical Volume | 984 | //btrfs |
581 | 977 | char magic1[16] ; | 985 | //extemporaneus hack - patch already sent to parted (detection only, there too) |
582 | 978 | char magic2[16] ; | 986 | #define BTRFS_SUPER_INFO_SIZE 4096 |
583 | 987 | #define BTRFS_SUPER_INFO_OFFSET (64 * 1024) | ||
584 | 988 | #define BTRFS_SIGNATURE "_BHRfS_M" | ||
585 | 989 | |||
586 | 990 | char buf_btrfs[BTRFS_SUPER_INFO_SIZE]; | ||
587 | 979 | 991 | ||
588 | 980 | ped_device_open( lp_device ); | 992 | ped_device_open( lp_device ); |
592 | 981 | ped_geometry_read( & lp_partition ->geom, buf, 1, 1 ) ; | 993 | if (ped_geometry_read( & lp_partition ->geom, buf_btrfs, \ |
593 | 982 | strncpy(magic1, buf+0, 8) ; magic1[8] = '\0' ; //set and terminate string | 994 | (BTRFS_SUPER_INFO_OFFSET / 512), \ |
594 | 983 | strncpy(magic2, buf+24, 4) ; magic2[4] = '\0' ; //set and terminate string | 995 | (BTRFS_SUPER_INFO_SIZE / 512))) |
595 | 996 | if ( Glib::ustring( buf+64, strlen(BTRFS_SIGNATURE) ) == BTRFS_SIGNATURE) | ||
596 | 997 | return GParted::FS_BTRFS; | ||
597 | 984 | ped_device_close( lp_device ); | 998 | ped_device_close( lp_device ); |
608 | 985 | 999 | #else | |
599 | 986 | if ( Glib::ustring( magic1 ) == "LABELONE" | ||
600 | 987 | && Glib::ustring( magic2 ) == "LVM2" ) | ||
601 | 988 | { | ||
602 | 989 | temp = _( "Logical Volume Management is not yet supported." ) ; | ||
603 | 990 | temp += "\n" ; | ||
604 | 991 | partition_temp .messages .push_back( temp ) ; | ||
605 | 992 | return GParted::FS_LVM2 ; | ||
606 | 993 | } | ||
607 | 994 | |||
609 | 995 | //btrfs | 1000 | //btrfs |
610 | 996 | const Sector BTRFS_SUPER_INFO_SIZE = 4096 ; | 1001 | const Sector BTRFS_SUPER_INFO_SIZE = 4096 ; |
611 | 997 | const Sector BTRFS_SUPER_INFO_OFFSET = (64 * 1024) ; | 1002 | const Sector BTRFS_SUPER_INFO_OFFSET = (64 * 1024) ; |
612 | @@ -1014,6 +1019,26 @@ | |||
613 | 1014 | partition_temp .messages .push_back( temp ) ; | 1019 | partition_temp .messages .push_back( temp ) ; |
614 | 1015 | return GParted::FS_BTRFS ; | 1020 | return GParted::FS_BTRFS ; |
615 | 1016 | } | 1021 | } |
616 | 1022 | #endif | ||
617 | 1023 | //lvm2 | ||
618 | 1024 | //NOTE: lvm2 is not a file system but we do wish to recognize the Physical Volume | ||
619 | 1025 | char magic1[16] ; | ||
620 | 1026 | char magic2[16] ; | ||
621 | 1027 | |||
622 | 1028 | ped_device_open( lp_device ); | ||
623 | 1029 | ped_geometry_read( & lp_partition ->geom, buf, 1, 1 ) ; | ||
624 | 1030 | strncpy(magic1, buf+0, 8) ; magic1[8] = '\0' ; //set and terminate string | ||
625 | 1031 | strncpy(magic2, buf+24, 4) ; magic2[4] = '\0' ; //set and terminate string | ||
626 | 1032 | ped_device_close( lp_device ); | ||
627 | 1033 | |||
628 | 1034 | if ( Glib::ustring( magic1 ) == "LABELONE" | ||
629 | 1035 | && Glib::ustring( magic2 ) == "LVM2" ) | ||
630 | 1036 | { | ||
631 | 1037 | temp = _( "Logical Volume Management is not yet supported." ) ; | ||
632 | 1038 | temp += "\n" ; | ||
633 | 1039 | partition_temp .messages .push_back( temp ) ; | ||
634 | 1040 | return GParted::FS_LVM2 ; | ||
635 | 1041 | } | ||
636 | 1017 | 1042 | ||
637 | 1018 | //no file system found.... | 1043 | //no file system found.... |
638 | 1019 | temp = _( "Unable to detect file system! Possible reasons are:" ) ; | 1044 | temp = _( "Unable to detect file system! Possible reasons are:" ) ; |
639 | @@ -2599,7 +2624,9 @@ | |||
640 | 2599 | case FS_HFS : p_filesystem = new hfs() ; break ; | 2624 | case FS_HFS : p_filesystem = new hfs() ; break ; |
641 | 2600 | case FS_HFSPLUS : p_filesystem = new hfsplus() ; break ; | 2625 | case FS_HFSPLUS : p_filesystem = new hfsplus() ; break ; |
642 | 2601 | case FS_UFS : p_filesystem = new ufs() ; break ; | 2626 | case FS_UFS : p_filesystem = new ufs() ; break ; |
644 | 2602 | 2627 | #ifdef BTRFS_SUPPORT | |
645 | 2628 | case FS_BTRFS : p_filesystem = new btrfs() ; break ; | ||
646 | 2629 | #endif | ||
647 | 2603 | default : p_filesystem = NULL ; | 2630 | default : p_filesystem = NULL ; |
648 | 2604 | } | 2631 | } |
649 | 2605 | 2632 | ||
650 | 2606 | 2633 | ||
651 | === modified file 'src/Makefile.am' | |||
652 | --- src/Makefile.am 2009-12-15 12:06:03 +0000 | |||
653 | +++ src/Makefile.am 2010-07-14 16:03:42 +0000 | |||
654 | @@ -7,6 +7,10 @@ | |||
655 | 7 | 7 | ||
656 | 8 | AM_CXXFLAGS = -Wall | 8 | AM_CXXFLAGS = -Wall |
657 | 9 | 9 | ||
658 | 10 | if BTRFS_SUPPORT | ||
659 | 11 | btrfs_source = btrfs.cc | ||
660 | 12 | endif | ||
661 | 13 | |||
662 | 10 | sbin_PROGRAMS = gpartedbin | 14 | sbin_PROGRAMS = gpartedbin |
663 | 11 | 15 | ||
664 | 12 | gpartedbin_SOURCES = \ | 16 | gpartedbin_SOURCES = \ |
665 | @@ -57,7 +61,8 @@ | |||
666 | 57 | reiser4.cc \ | 61 | reiser4.cc \ |
667 | 58 | reiserfs.cc \ | 62 | reiserfs.cc \ |
668 | 59 | ufs.cc \ | 63 | ufs.cc \ |
670 | 60 | xfs.cc | 64 | xfs.cc \ |
671 | 65 | $(btrfs_source) | ||
672 | 61 | 66 | ||
673 | 62 | gpartedbin_LDFLAGS = -lparted -lgthread-2.0 | 67 | gpartedbin_LDFLAGS = -lparted -lgthread-2.0 |
674 | 63 | 68 | ||
675 | 64 | 69 | ||
676 | === modified file 'src/Utils.cc' | |||
677 | --- src/Utils.cc 2010-03-14 12:54:22 +0000 | |||
678 | +++ src/Utils.cc 2010-07-14 16:03:42 +0000 | |||
679 | @@ -17,6 +17,7 @@ | |||
680 | 17 | */ | 17 | */ |
681 | 18 | 18 | ||
682 | 19 | #include "../include/Utils.h" | 19 | #include "../include/Utils.h" |
683 | 20 | #include "../config.h" | ||
684 | 20 | 21 | ||
685 | 21 | #include <sstream> | 22 | #include <sstream> |
686 | 22 | #include <iomanip> | 23 | #include <iomanip> |
687 | @@ -161,6 +162,9 @@ | |||
688 | 161 | case FS_REISER4 : return "reiser4progs" ; | 162 | case FS_REISER4 : return "reiser4progs" ; |
689 | 162 | case FS_REISERFS : return "reiserfsprogs" ; | 163 | case FS_REISERFS : return "reiserfsprogs" ; |
690 | 163 | case FS_UFS : return "" ; | 164 | case FS_UFS : return "" ; |
691 | 165 | #ifdef BTRFS_SUPPORT | ||
692 | 166 | case FS_BTRFS : return "btrfs-tools" ; | ||
693 | 167 | #endif | ||
694 | 164 | case FS_XFS : return "xfsprogs" ; | 168 | case FS_XFS : return "xfsprogs" ; |
695 | 165 | 169 | ||
696 | 166 | default : return "" ; | 170 | default : return "" ; |
Thanks for working on this bug.
The gparted package uses the newish 3.0 (quilt) source package format, source/ format, so you need to do a bit more than doc/quilt/ README. source to set up .quiltrc; you might also ARGS="- -no-timestamps -p ab" or similar. Then
according to debian/
applying the patch directly to the source tree. Follow the directions
in /usr/share/
want to set QUILT_REFRESH_
import your patch; the least error-prone way is probably to start from a
clean checkout of lp:ubuntu/gparted, run 'quilt new 02_btrfs.patch',
then 'quilt shell', make your changes, exit, and run 'quilt refresh'
(although there are other faster ways).
(Debian is converging on 3.0 (quilt), so it's a useful one to learn,
although many packages also use older patch systems so we still have to
be pretty flexible. There's a wrapper script in
lp:~mvo/+junk/edit-patch which may be useful.)
You'll need to 'bzr add' the new file under debian/patches/ at the end.
You should end up with a 'bzr diff' that shows both the raw changes and
a new file in debian/patches/ with those same changes (this may seem a
bit odd but it's a trade-off against other useful properties that I can
describe elsewhere if you're interested).
The patch changes configure.in, but not configure. I think you'll need
to run 'autoreconf' inside 'quilt shell' in order for this change to
take effect.
It seems a bit odd to have this support be configured by a configure
option, but I see that this was in one of the upstream patches so it's
not necessary to undo that. In any case, it looks like the current
state of your branch won't build it in by default. You should add
--enable-btrfs to the configure options in debian/rules (make this
change directly rather than as a quilt patch).