summaryrefslogtreecommitdiff
path: root/extra/gpart/gpart-0.1h-reiserfs-3.6.patch
blob: 257015d2b1fb83b17c432d73d8358e0342a31fb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
diff -rupN ./gpart-0.1h.orig/README ./gpart-0.1h/README
--- ./gpart-0.1h.orig/README	Wed Feb  7 20:58:12 2001
+++ ./gpart-0.1h/README	Fri Jan 10 16:29:43 2003
@@ -24,25 +24,25 @@
 
  - Currently recognized partitions/filesystems types ---------------------
 
-   Modname Typ   Description
-   fat     0x01  "Primary DOS with 12 bit FAT"
-           0x04  "Primary DOS with 16 bit FAT (<= 32MB)"
-           0x06  "Primary 'big' DOS (> 32MB)"
-           0x0B  "DOS or Windows 95 with 32 bit FAT"
-           0x0C  "DOS or Windows 95 with 32 bit FAT, LBA"
-   ntfs    0x07  "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
-   hpfs    0x07  "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
-   ext2    0x83  "Linux ext2 filesystem"
-   lswap   0x82  "Linux swap"
-   bsddl   0xA5  "FreeBSD/NetBSD/386BSD"
-   s86dl   0x82  "Solaris/x86 disklabel"
-   minix   0x80  "Minix V1"
-           0x81  "Minix V2"
-   rfs     0x83  "Reiser filesystem"
-   hmlvm   0xFE  "Linux LVM physical volumes"
-   qnx4    0x4F  "QNX 4.x"
-   beos    0xEB  "BeOS fs"
-   xfs     0x83  "SGI XFS filesystem"
+   Modname  Typ   Description
+   fat      0x01  "Primary DOS with 12 bit FAT"
+    	    0x04  "Primary DOS with 16 bit FAT (<= 32MB)"
+            0x06  "Primary 'big' DOS (> 32MB)"
+            0x0B  "DOS or Windows 95 with 32 bit FAT"
+            0x0C  "DOS or Windows 95 with 32 bit FAT, LBA"
+   ntfs     0x07  "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
+   hpfs     0x07  "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
+   ext2     0x83  "Linux ext2 filesystem"
+   lswap    0x82  "Linux swap"
+   bsddl    0xA5  "FreeBSD/NetBSD/386BSD"
+   s86dl    0x82  "Solaris/x86 disklabel"
+   minix    0x80  "Minix V1"
+            0x81  "Minix V2"
+   reiserfs 0x83  "ReiserFS filesystem"
+   hmlvm    0xFE  "Linux LVM physical volumes"
+   qnx4     0x4F  "QNX 4.x"
+   beos     0xEB  "BeOS fs"
+   xfs      0x83  "SGI XFS filesystem"
 
 
 
diff -rupN ./gpart-0.1h.orig/man/gpart.man ./gpart-0.1h/man/gpart.man
--- ./gpart-0.1h.orig/man/gpart.man	Wed Feb  7 20:54:18 2001
+++ ./gpart-0.1h/man/gpart.man	Fri Jan 10 16:31:52 2003
@@ -63,8 +63,8 @@ MS Windows NT/2000 filesystem.
 .I qnx4
 QNX 4.x filesystem.
 .TP
-.I rfs
-The Reiser filesystem (version 3.5.X, X > 11).
+.I reiserfs
+The Reiser filesystem (version 3.5.X, X > 11, 3.6.X).
 .TP
 .I s86dl
 Sun Solaris on Intel platforms uses a sub-partitioning
diff -rupN ./gpart-0.1h.orig/src/Makefile ./gpart-0.1h/src/Makefile
--- ./gpart-0.1h.orig/src/Makefile	Tue Jan 30 20:01:08 2001
+++ ./gpart-0.1h/src/Makefile	Fri Jan 10 16:32:24 2003
@@ -19,7 +19,7 @@ CFLAGS+=-DGPART_LANG=\'$(GPART_LANG)\'
 endif
 
 
-mod=ext2 lswap fat bsddl ntfs hpfs s86dl minix rfs hmlvm qnx4 beos xfs
+mod=ext2 lswap fat bsddl ntfs hpfs s86dl minix reiserfs hmlvm qnx4 beos xfs
 modobj=$(foreach m,$(mod),gm_$(m).o)
 obj=gpart.o gmodules.o disku.o l64seek.o $(modobj)
 src=$(obj:.o=.c)
diff -rupN ./gpart-0.1h.orig/src/gm_reiserfs.c ./gpart-0.1h/src/gm_reiserfs.c
--- ./gpart-0.1h.orig/src/gm_reiserfs.c	Thu Jan  1 03:00:00 1970
+++ ./gpart-0.1h/src/gm_reiserfs.c	Fri Jan 10 17:25:30 2003
@@ -0,0 +1,91 @@
+/*      
+ * gm_reiserfs.c -- gpart ReiserFS guessing module
+ *
+ * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
+ * Guess PC-type hard disk partitions.
+ *
+ * gpart is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Created:   21.01.1999 <mb@ichabod.han.de>
+ * Modified:  26.12.2000 Francis Devereux <francis@devereux.tc>
+ *            Added reiserfs 3.5.28 support.
+ * Modified:  10.01.2003 Yury Umanets <umka@namesys.com>
+ *            Added reiserfs 3.6.x support.
+ *
+ */
+
+#include <string.h>
+#include <errno.h>
+#include "gpart.h"
+#include "gm_reiserfs.h"
+
+static const char	rcsid[] = "$Id: gm_reiserfs.c,v 1.5 2003/01/10 16:38:08 mb Exp mb $";
+
+
+int reiserfs_init(disk_desc *d,g_module *m)
+{
+	if ((d == 0) || (m == 0))
+		return (0);
+
+	m->m_desc = "ReiserFS filesystem";
+	return (REISERFS_FIRST_BLOCK * 1024 + SB_V35_SIZE);
+}
+
+
+
+int reiserfs_term(disk_desc *d)
+{
+	return (1);
+}
+
+
+
+int reiserfs_gfun(disk_desc *d,g_module *m)
+{
+	struct reiserfs_super_block_v35	*sb;
+	dos_part_entry			*pt = &m->m_part;
+	s64_t				size;
+
+	m->m_guess = GM_NO;
+	sb = (struct reiserfs_super_blockv35 *)(d->d_sbuf + REISERFS_FIRST_BLOCK * 1024);
+	if (strncmp(sb->s_magic,REISERFS_SUPER_V35_MAGIC,12) == 0 || 
+	    strncmp(sb->s_magic,REISERFS_SUPER_V36_MAGIC,12) == 0)
+	{
+		/*
+		 * sanity checks.
+		 */
+
+		if (sb->s_block_count < sb->s_free_blocks)
+			return (1);
+
+		if (sb->s_block_count < REISERFS_MIN_BLOCK_AMOUNT)
+			return (1);
+
+		if ((sb->s_state != REISERFS_VALID_FS) &&
+		    (sb->s_state != REISERFS_ERROR_FS))
+			return (1);
+
+		if (sb->s_oid_maxsize % 2) /* must be even */
+			return (1);
+
+		if (sb->s_oid_maxsize < sb->s_oid_cursize)
+			return (1);
+
+		if ((sb->s_blocksize != 4096) && (sb->s_blocksize != 8192))
+			return (1);
+
+		/*
+		 * ok.
+		 */
+
+		m->m_guess = GM_YES;
+		pt->p_start = d->d_nsb;
+		size = sb->s_block_count; size *= sb->s_blocksize; size /= d->d_ssize;
+		pt->p_size = (unsigned long)size;
+		pt->p_typ = 0x83;
+	}
+	return (1);
+}
diff -rupN ./gpart-0.1h.orig/src/gm_reiserfs.h ./gpart-0.1h/src/gm_reiserfs.h
--- ./gpart-0.1h.orig/src/gm_reiserfs.h	Thu Jan  1 03:00:00 1970
+++ ./gpart-0.1h/src/gm_reiserfs.h	Fri Jan 10 17:25:55 2003
@@ -0,0 +1,82 @@
+/*
+ * gm_reiserfs.h -- gpart ReiserFS guessing module header
+ * 
+ * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
+ * Guess PC-type hard disk partitions.
+ *
+ * gpart is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Created:   21.01.1999 <mb@ichabod.han.de>
+ * Modified:  26.12.2000 Francis Devereux <francis@devereux.tc>
+ *            Update support reiserfs version 3.5.28
+ * Modified:  10.01.2003 Yury Umanets <umka@namesys.com>
+ *            Added reiserfs 3.6.x support.
+ *
+ */
+
+#ifndef _GM_reiserfs_H
+#define _GM_reiserfs_H
+
+/* imported from asm/types.h */
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+/*
+ * taken from ReiserFS v3.5.28, v3.6.x. Reiserfs Copyright 1996-2000 Hans Reiser
+ */
+
+#define REISERFS_SUPER_V35_MAGIC	"ReIsErFs"
+#define REISERFS_SUPER_V36_MAGIC	"ReIsEr2Fs"
+
+#define REISERFS_FIRST_BLOCK		64
+#define REISERFS_VALID_FS		1
+#define REISERFS_ERROR_FS		2
+#define REISERFS_MIN_BLOCK_AMOUNT	100
+
+struct reiserfs_super_block_v35
+{
+	__u32 s_block_count;		/* blocks count         */
+	__u32 s_free_blocks;		/* free blocks count    */
+	__u32 s_root_block;		/* root block number    */
+	__u32 s_journal_block;		/* journal block number    */
+	__u32 s_journal_dev;		/* journal device number  */
+	__u32 s_orig_journal_size;	/* size of the journal on FS creation.  used to make sure they don't overflow it */
+	__u32 s_journal_trans_max;	/* max number of blocks in a transaction.  */
+	__u32 s_journal_block_count;	/* total size of the journal. can change over time  */
+	__u32 s_journal_max_batch;	/* max number of blocks to batch into a trans */
+	__u32 s_journal_max_commit_age;	/* in seconds, how old can an async commit be */
+	__u32 s_journal_max_trans_age;	/* in seconds, how old can a transaction be */
+	__u16 s_blocksize;		/* block size           */
+	__u16 s_oid_maxsize;		/* max size of object id array, see get_objectid() commentary  */
+	__u16 s_oid_cursize;		/* current size of object id array */
+	__u16 s_state;			/* valid or error       */
+	char s_magic[12];		/* reiserfs magic string indicates that file system is reiserfs */
+	__u32 s_hash_function_code;	/* indicate, what hash fuction is being use to sort names in a directory*/
+	__u16 s_tree_height;		/* height of disk tree */
+	__u16 s_bmap_nr;		/* amount of bitmap blocks needed to address each block of file system */
+	__u16 s_reserved;
+};
+
+#define SB_V35_SIZE (sizeof(struct reiserfs_super_block_v35))
+
+struct reiserfs_super_block_v36 {
+	struct reiserfs_super_block_v35 s_v35;
+	__u32 s_inode_generation; 
+	__u32 s_flags;
+	char s_uuid[16];
+	char s_label[16];
+	char s_unused[88];
+};
+
+#define SB_V36_SIZE (sizeof(struct reiserfs_super_block_v36))
+
+#endif /* _GM_REISERFS_H */
diff -rupN ./gpart-0.1h.orig/src/gm_rfs.c ./gpart-0.1h/src/gm_rfs.c
--- ./gpart-0.1h.orig/src/gm_rfs.c	Wed Feb  7 21:08:08 2001
+++ ./gpart-0.1h/src/gm_rfs.c	Thu Jan  1 03:00:00 1970
@@ -1,88 +0,0 @@
-/*      
- * gm_rfs.c -- gpart ReiserFS guessing module
- *
- * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
- * Guess PC-type hard disk partitions.
- *
- * gpart is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Created:   21.01.1999 <mb@ichabod.han.de>
- * Modified:  26.12.2000 Francis Devereux <francis@devereux.tc>
- *            Added reiserfs 3.5.28 support.
- *
- */
-
-#include <string.h>
-#include <errno.h>
-#include "gpart.h"
-#include "gm_rfs.h"
-
-static const char	rcsid[] = "$Id: gm_rfs.c,v 1.5 2001/02/07 18:08:08 mb Exp mb $";
-
-
-int rfs_init(disk_desc *d,g_module *m)
-{
-	if ((d == 0) || (m == 0))
-		return (0);
-
-	m->m_desc = "Reiser filesystem";
-	return (REISERFS_FIRST_BLOCK * 1024 + SB_SIZE);
-}
-
-
-
-int rfs_term(disk_desc *d)
-{
-	return (1);
-}
-
-
-
-int rfs_gfun(disk_desc *d,g_module *m)
-{
-	struct reiserfs_super_block	*sb;
-	dos_part_entry			*pt = &m->m_part;
-	s64_t				size;
-
-	m->m_guess = GM_NO;
-	sb = (struct reiserfs_super_block *)(d->d_sbuf + REISERFS_FIRST_BLOCK * 1024);
-	if (strncmp(sb->s_magic,REISERFS_SUPER_MAGIC,12) == 0)
-	{
-		/*
-		 * sanity checks.
-		 */
-
-		if (sb->s_block_count < sb->s_free_blocks)
-			return (1);
-
-		if (sb->s_block_count < REISERFS_MIN_BLOCK_AMOUNT)
-			return (1);
-
-		if ((sb->s_state != REISERFS_VALID_FS) &&
-		    (sb->s_state != REISERFS_ERROR_FS))
-			return (1);
-
-		if (sb->s_oid_maxsize % 2) /* must be even */
-			return (1);
-
-		if (sb->s_oid_maxsize < sb->s_oid_cursize)
-			return (1);
-
-		if ((sb->s_blocksize != 4096) && (sb->s_blocksize != 8192))
-			return (1);
-
-		/*
-		 * ok.
-		 */
-
-		m->m_guess = GM_YES;
-		pt->p_start = d->d_nsb;
-		size = sb->s_block_count; size *= sb->s_blocksize; size /= d->d_ssize;
-		pt->p_size = (unsigned long)size;
-		pt->p_typ = 0x83;
-	}
-	return (1);
-}
diff -rupN ./gpart-0.1h.orig/src/gm_rfs.h ./gpart-0.1h/src/gm_rfs.h
--- ./gpart-0.1h.orig/src/gm_rfs.h	Mon Jan 29 16:34:35 2001
+++ ./gpart-0.1h/src/gm_rfs.h	Thu Jan  1 03:00:00 1970
@@ -1,68 +0,0 @@
-/*
- * gm_rfs.h -- gpart ReiserFS guessing module header
- * 
- * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
- * Guess PC-type hard disk partitions.
- *
- * gpart is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Created:   21.01.1999 <mb@ichabod.han.de>
- * Modified:  26.12.2000 Francis Devereux <francis@devereux.tc>
- *            Update support reiserfs version 3.5.28
- *
- */
-
-#ifndef _GM_RFS_H
-#define _GM_RFS_H
-
-/* imported from asm/types.h */
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-/*
- * taken from ReiserFS v3.5.28. Reiserfs Copyright 1996-2000 Hans Reiser
- */
-
-#define REISERFS_SUPER_MAGIC		"ReIsErFs"
-#define REISERFS_FIRST_BLOCK		64
-#define REISERFS_VALID_FS		1
-#define REISERFS_ERROR_FS		2
-#define REISERFS_MIN_BLOCK_AMOUNT	100
-
-struct reiserfs_super_block
-{
-	__u32 s_block_count;		/* blocks count         */
-	__u32 s_free_blocks;		/* free blocks count    */
-	__u32 s_root_block;		/* root block number    */
-	__u32 s_journal_block;		/* journal block number    */
-	__u32 s_journal_dev;		/* journal device number  */
-	__u32 s_orig_journal_size;	/* size of the journal on FS creation.  used to make sure they don't overflow it */
-	__u32 s_journal_trans_max;	/* max number of blocks in a transaction.  */
-	__u32 s_journal_block_count;	/* total size of the journal. can change over time  */
-	__u32 s_journal_max_batch;	/* max number of blocks to batch into a trans */
-	__u32 s_journal_max_commit_age;	/* in seconds, how old can an async commit be */
-	__u32 s_journal_max_trans_age;	/* in seconds, how old can a transaction be */
-	__u16 s_blocksize;		/* block size           */
-	__u16 s_oid_maxsize;		/* max size of object id array, see get_objectid() commentary  */
-	__u16 s_oid_cursize;		/* current size of object id array */
-	__u16 s_state;			/* valid or error       */
-	char s_magic[12];		/* reiserfs magic string indicates that file system is reiserfs */
-	__u32 s_hash_function_code;	/* indicate, what hash fuction is being use to sort names in a directory*/
-	__u16 s_tree_height;		/* height of disk tree */
-	__u16 s_bmap_nr;		/* amount of bitmap blocks needed to address each block of file system */
-	__u16 s_reserved;
-};
-
-#define SB_SIZE (sizeof(struct reiserfs_super_block))
-
-
-#endif /* _GM_RFS_H */
diff -rupN ./gpart-0.1h.orig/src/gmodules.c ./gpart-0.1h/src/gmodules.c
--- ./gpart-0.1h.orig/src/gmodules.c	Tue Jan 30 20:01:00 2001
+++ ./gpart-0.1h/src/gmodules.c	Fri Jan 10 16:31:28 2003
@@ -154,7 +154,7 @@ void g_mod_addinternals()
 	GMODINS(bsddl);
 	GMODINS(lswap);
 	GMODINS(qnx4);
-	GMODINS(rfs);
+	GMODINS(reiserfs);
 	GMODINS(ntfs);
 	GMODINS(hpfs);
 	GMODINS(minix);
diff -rupN ./gpart-0.1h.orig/src/gmodules.h ./gpart-0.1h/src/gmodules.h
--- ./gpart-0.1h.orig/src/gmodules.h	Tue Jan 30 20:00:47 2001
+++ ./gpart-0.1h/src/gmodules.h	Fri Jan 10 16:31:23 2003
@@ -63,7 +63,7 @@ g_module *g_mod_setweight(char *,float);
 
 GMODDECL(bsddl); GMODDECL(ext2); GMODDECL(fat);
 GMODDECL(hpfs); GMODDECL(lswap); GMODDECL(ntfs);
-GMODDECL(s86dl); GMODDECL(minix); GMODDECL(rfs);
+GMODDECL(s86dl); GMODDECL(minix); GMODDECL(reiserfs);
 GMODDECL(hmlvm); GMODDECL(qnx4); GMODDECL(beos);
 GMODDECL(xfs);