/[gentoo-x86]/sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch
Gentoo

Contents of /sys-fs/e2fsprogs/files/e2fsprogs-1.41-mint.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Fri Nov 19 18:49:02 2010 UTC (3 years, 10 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Import Prefix Changes

(Portage version: 2.2.0_alpha4/cvs/Linux x86_64)

1 http://bugs.gentoo.org/show_bug.cgi?id=256234
2 http://sourceforge.net/tracker/?func=detail&aid=2550325&group_id=2406&atid=302406
3
4 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/Makefile.in e2fsprogs-1.41.3-mint/lib/ext2fs/Makefile.in
5 --- e2fsprogs-1.41.3/lib/ext2fs/Makefile.in 2008-10-07 14:22:39.000000000 +0000
6 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/Makefile.in 2009-01-23 10:48:50.000000000 +0000
7 @@ -74,7 +74,9 @@
8 unix_io.o \
9 unlink.o \
10 valid_blk.o \
11 - version.o
12 + version.o \
13 + mint_io.o \
14 + xhdi.o
15
16 SRCS= ext2_err.c \
17 $(srcdir)/alloc.c \
18 @@ -146,6 +148,8 @@
19 $(srcdir)/unlink.c \
20 $(srcdir)/valid_blk.c \
21 $(srcdir)/version.c \
22 + $(srcdir)/mint_io.c \
23 + $(srcdir)/xhdi.c \
24 $(srcdir)/write_bb_file.c
25
26 HFILES= bitops.h ext2fs.h ext2_io.h ext2_fs.h ext2_ext_attr.h ext3_extents.h \
27 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/bitops.h e2fsprogs-1.41.3-mint/lib/ext2fs/bitops.h
28 --- e2fsprogs-1.41.3/lib/ext2fs/bitops.h 2008-10-07 14:22:39.000000000 +0000
29 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/bitops.h 2009-01-23 10:47:35.000000000 +0000
30 @@ -125,7 +125,7 @@
31 */
32 #ifdef NO_INLINE_FUNCS
33 #if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
34 - defined(__i586__) || defined(__mc68000__)))
35 + defined(__i586__) || defined(__mc68020__)))
36 /* This prevents bitops.c from trying to include the C */
37 /* function version of these functions */
38 #define _EXT2_HAVE_ASM_BITOPS_
39 @@ -246,7 +246,7 @@
40 #endif /* i386 */
41
42 #if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
43 - (defined(__mc68000__)))
44 + (defined(__mc68020__)))
45
46 #define _EXT2_HAVE_ASM_BITOPS_
47
48 @@ -280,6 +280,50 @@
49 return retval;
50 }
51
52 +#elif defined(__mc68000__)
53 +
54 +#define _EXT2_HAVE_ASM_BITOPS_
55 +
56 +_INLINE_ int
57 +ext2fs_set_bit (unsigned int nr, void *addr)
58 +{
59 + int mask, retval;
60 + unsigned char *ADDR = (unsigned char *) addr;
61 +
62 + ADDR += nr >> 3;
63 + mask = 1UL << (nr & 0x07);
64 + retval = (mask & *ADDR) != 0;
65 + *ADDR |= mask;
66 +
67 + return retval;
68 +}
69 +
70 +_INLINE_ int
71 +ext2fs_clear_bit (unsigned int nr, void *addr)
72 +{
73 + int mask, retval;
74 + unsigned char *ADDR = (unsigned char *) addr;
75 +
76 + ADDR += nr >> 3;
77 + mask = 1UL << (nr & 0x07);
78 + retval = (mask & *ADDR) != 0;
79 + *ADDR &= ~mask;
80 +
81 + return retval;
82 +}
83 +
84 +_INLINE_ int
85 +ext2fs_test_bit (unsigned int nr, const void *addr)
86 +{
87 + int mask;
88 + const unsigned char *ADDR = (const unsigned char *) addr;
89 +
90 + ADDR += nr >> 3;
91 + mask = 1UL << (nr & 0x07);
92 +
93 + return ((mask & *ADDR) != 0);
94 +}
95 +
96 #endif /* __mc68000__ */
97
98
99 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/ext2_fs.h e2fsprogs-1.41.3-mint/lib/ext2fs/ext2_fs.h
100 --- e2fsprogs-1.41.3/lib/ext2fs/ext2_fs.h 2009-01-23 10:01:34.000000000 +0000
101 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/ext2_fs.h 2009-01-23 10:49:44.000000000 +0000
102 @@ -307,6 +307,7 @@
103 #define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
104 #endif
105
106 +#ifndef __MINT__
107 #define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
108 #define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
109 #define EXT2_IOC_GETVERSION _IOR('v', 1, long)
110 @@ -316,6 +317,9 @@
111 #define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
112 #define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
113 #define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
114 +#else
115 +#include <mint/dcntl.h>
116 +#endif
117
118 /*
119 * Structure of an inode on the disk
120 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/getsize.c e2fsprogs-1.41.3-mint/lib/ext2fs/getsize.c
121 --- e2fsprogs-1.41.3/lib/ext2fs/getsize.c 2008-10-07 14:22:39.000000000 +0000
122 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/getsize.c 2009-01-23 10:47:35.000000000 +0000
123 @@ -58,6 +58,11 @@
124 #define BLKGETSIZE DKIOCGETBLOCKCOUNT32
125 #endif /* APPLE_DARWIN */
126
127 +#ifdef __MINT__
128 +#include <sys/ioctl.h>
129 +#include "mint_io.h"
130 +#endif
131 +
132 #include "ext2_fs.h"
133 #include "ext2fs.h"
134
135 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/llseek.c e2fsprogs-1.41.3-mint/lib/ext2fs/llseek.c
136 --- e2fsprogs-1.41.3/lib/ext2fs/llseek.c 2008-10-07 14:22:39.000000000 +0000
137 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/llseek.c 2009-01-23 10:47:35.000000000 +0000
138 @@ -115,6 +115,8 @@
139
140 #else /* !linux */
141
142 +#ifndef __MINT__
143 +
144 #ifndef EINVAL
145 #define EINVAL EXT2_ET_INVALID_ARGUMENT
146 #endif
147 @@ -133,6 +135,8 @@
148 #endif
149 }
150
151 +#endif /* __MINT__ */
152 +
153 #endif /* linux */
154
155
156 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/mint_io.c e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.c
157 --- e2fsprogs-1.41.3/lib/ext2fs/mint_io.c 1970-01-01 00:00:00.000000000 +0000
158 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.c 2009-01-23 10:49:51.000000000 +0000
159 @@ -0,0 +1,858 @@
160 +/*
161 + * $Id: mint_io.c,v 1.4 2003/11/18 21:05:42 standa Exp $
162 + *
163 + * This file belongs to FreeMiNT. It's not in the original MiNT 1.12
164 + * distribution. See the file CHANGES for a detailed log of changes.
165 + *
166 + *
167 + * Copyright 2000 Frank Naumann <fnaumann@freemint.de>
168 + * All rights reserved.
169 + *
170 + * This program is free software; you can redistribute it and/or modify
171 + * it under the terms of the GNU General Public License as published by
172 + * the Free Software Foundation; either version 2, or (at your option)
173 + * any later version.
174 + *
175 + * This file is distributed in the hope that it will be useful,
176 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
177 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
178 + * GNU General Public License for more details.
179 + *
180 + * You should have received a copy of the GNU General Public License
181 + * along with this program; if not, write to the Free Software
182 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
183 + *
184 + *
185 + * Author: Frank Naumann <fnaumann@freemint.de>
186 + * Started: 200-06-14
187 + *
188 + * Please send suggestions, patches or bug reports to me or
189 + * the MiNT mailing list.
190 + *
191 + */
192 +
193 +# ifdef __MINT__
194 +
195 +# include <assert.h>
196 +# include <ctype.h>
197 +# include <errno.h>
198 +# include <fcntl.h>
199 +# include <limits.h>
200 +# include <stdarg.h>
201 +# include <stdlib.h>
202 +# include <stdio.h>
203 +# include <string.h>
204 +# include <time.h>
205 +# include <unistd.h>
206 +
207 +# include "et/com_err.h"
208 +# include "ext2fs/ext2_io.h"
209 +# include <sys/ioctl.h>
210 +# include <sys/stat.h>
211 +# define loff_t ext2_loff_t
212 +# define llseek ext2fs_llseek
213 +
214 +# include <mintbind.h>
215 +# include "mint_io.h"
216 +# include "xhdi.h"
217 +
218 +
219 +# if 0
220 +# define DEBUG(x) printf x
221 +# else
222 +# define DEBUG(x)
223 +# endif
224 +
225 +
226 +/* prototypes */
227 +
228 +int __open_v(const char *_filename, int iomode, va_list argp);
229 +
230 +int open(__const char *__file, int __oflag, ...) __THROW;
231 +int __open(__const char *__file, int __oflag, ...) __THROW;
232 +
233 +int ioctl(int fd, int cmd, void *arg);
234 +int __ioctl(int fd, int cmd, void *arg);
235 +
236 +int fsync(int __fd) __THROW;
237 +int __fsync(int __fd) __THROW;
238 +
239 +__off_t lseek(int __fd, __off_t __offset, int __whence) __THROW;
240 +__off_t __lseek(int __fd, __off_t __offset, int __whence) __THROW;
241 +
242 +int close(int __fd) __THROW;
243 +int __close(int __fd) __THROW;
244 +
245 +ssize_t read(int __fd, void *__buf, size_t __nbytes) __THROW;
246 +ssize_t __read(int __fd, void *__buf, size_t __nbytes) __THROW;
247 +
248 +ssize_t write(int __fd, __const void *__buf, size_t __n) __THROW;
249 +ssize_t __write(int __fd, __const void *__buf, size_t __n) __THROW;
250 +
251 +int fstat(int __fd, struct stat *__buf) __THROW;
252 +int __fstat(int __fd, struct stat *__buf) __THROW;
253 +
254 +int stat(const char *filename, struct stat *st) __THROW;
255 +
256 +
257 +struct device
258 +{
259 + int used;
260 +
261 + int drv;
262 + int open_flags;
263 +
264 + ushort xhdi_maj;
265 + ushort xhdi_min;
266 + ulong xhdi_start;
267 + ulong xhdi_blocks;
268 + ulong xhdi_blocksize;
269 + char xhdi_id[4];
270 +
271 + loff_t pos;
272 +};
273 +
274 +# define DEVS 16
275 +static struct device devs[DEVS];
276 +
277 +static void
278 +init_device(struct device *dev)
279 +{
280 + dev->used = 0;
281 +
282 + dev->drv = -1;
283 + dev->open_flags = 0;
284 + dev->xhdi_maj = 0;
285 + dev->xhdi_min = 0;
286 + dev->xhdi_start = 0;
287 + dev->xhdi_blocks = 0;
288 + dev->xhdi_blocksize = 0;
289 +
290 + dev->pos = 0;
291 +}
292 +
293 +static inline void
294 +init(void)
295 +{
296 + static int done = 0;
297 + int i;
298 +
299 + if (done)
300 + return;
301 +
302 + assert(sizeof(loff_t) == sizeof(long long));
303 +
304 + for (i = 0; i < DEVS; i++)
305 + init_device (&devs[i]);
306 +
307 + init_XHDI();
308 +
309 + /* we are now initialized */
310 + done = 1;
311 +}
312 +
313 +static struct device *
314 +get_device(int fd)
315 +{
316 + struct device *dev;
317 +
318 + if ((fd < 1024) || (fd >= (1024 + DEVS)))
319 + return NULL;
320 +
321 + fd -= 1024;
322 + dev = &devs[fd];
323 +
324 + assert(dev->used);
325 +
326 + return dev;
327 +}
328 +
329 +static int
330 +alloc_device(void)
331 +{
332 + int i;
333 +
334 + for (i = 0; i < DEVS; i++)
335 + {
336 + struct device *dev = &devs[i];
337 +
338 + if (!dev->used)
339 + {
340 + dev->used = 1;
341 + return (i + 1024);
342 + }
343 + }
344 +
345 + __set_errno(ENOMEM);
346 + return -1;
347 +}
348 +
349 +static void
350 +free_device(struct device *dev)
351 +{
352 + assert(dev->used);
353 +
354 + init_device (dev);
355 +}
356 +
357 +
358 +int
359 +open(const char *filename, int iomode, ...)
360 +{
361 + const char *f = filename;
362 + struct device *mydev = NULL;
363 + int dev = -1;
364 + long ret;
365 +
366 + init();
367 +
368 + if (!filename)
369 + {
370 + __set_errno(EINVAL);
371 + return -1;
372 + }
373 +
374 + if ((f[1] == ':') && (f[2] == '\0'))
375 + {
376 + int c = tolower(f[0]);
377 +
378 + if (c >= 'a' && c <= 'z')
379 + c = c - 'a';
380 + else if (c >= '1' && c <= '6')
381 + c = 26 + (c - '1');
382 +
383 + if ((c >= 0) && (c < 32))
384 + {
385 + dev = alloc_device();
386 + if (dev != -1)
387 + {
388 + mydev = get_device(dev);
389 + assert(mydev);
390 +
391 + mydev->drv = c;
392 + mydev->open_flags = iomode;
393 + }
394 + }
395 + }
396 +
397 + if (dev == -1)
398 + {
399 + /* fall through */
400 +
401 + va_list args;
402 + int retval;
403 +
404 + va_start(args, iomode);
405 + retval = __open_v(filename, iomode, args);
406 + va_end(args);
407 +
408 + return retval;
409 + }
410 +
411 + if (mydev->open_flags == O_RDONLY)
412 + {
413 + DEBUG(("readonly mode!\n"));
414 + sync();
415 + }
416 + else if (Dlock(1, mydev->drv))
417 + {
418 + printf("Can't lock partition %c:!\n", mydev->drv+'A');
419 +
420 + if (mydev)
421 + free_device(mydev);
422 +
423 + __set_errno(EACCES);
424 + return -1;
425 + }
426 +
427 + __set_errno(EERROR);
428 +
429 + ret = XHGetVersion ();
430 + DEBUG(("XHDI version: %lx\n", ret));
431 +
432 + ret = XHInqDev2(mydev->drv,
433 + &mydev->xhdi_maj, &mydev->xhdi_min,
434 + &mydev->xhdi_start, NULL,
435 + &mydev->xhdi_blocks, mydev->xhdi_id);
436 + if (ret)
437 + {
438 + printf("XHInqDev2 [%c] fail (ret = %li, errno = %i)\n",
439 + mydev->drv+'A', ret, errno);
440 + ret = -1;
441 + }
442 + else
443 + {
444 + ret = XHInqTarget(mydev->xhdi_maj, mydev->xhdi_min,
445 + &mydev->xhdi_blocksize, NULL, NULL);
446 + if (ret)
447 + {
448 + printf("XHInqTarget [%i:%i] fail (ret = %li, errno = %i)\n",
449 + mydev->xhdi_maj, mydev->xhdi_min, ret, errno);
450 + ret = -1;
451 + }
452 + else
453 + {
454 + char *xhdi_id = mydev->xhdi_id;
455 +
456 + if ( 0
457 + || ((xhdi_id[0] == 'G') && (xhdi_id[1] == 'E') && (xhdi_id[2] == 'M')) /* GEM */
458 + || ((xhdi_id[0] == 'B') && (xhdi_id[1] == 'G') && (xhdi_id[2] == 'M')) /* BGM */
459 + || ((xhdi_id[0] == 'F') && (xhdi_id[1] == '3') && (xhdi_id[2] == '2')) /* F32 */
460 + || ((xhdi_id[0] == 'M') && (xhdi_id[1] == 'I') && (xhdi_id[2] == 'X')) /* MIX */
461 + || ((xhdi_id[0] == 'R') && (xhdi_id[1] == 'A') && (xhdi_id[2] == 'W')) /* RAW */
462 + || ((xhdi_id[0] == 'L') && (xhdi_id[1] == 'N') && (xhdi_id[2] == 'X')) /* LNX */
463 + || ((xhdi_id[0] == '\0') && (xhdi_id[1] == 'D'))) /* any DOS */
464 + {
465 + DEBUG(("Partition ok and accepted!\n"));
466 + DEBUG(("start = %lu, blocks = %lu, blocksize = %lu\n",
467 + mydev->xhdi_start, mydev->xhdi_blocks,
468 + mydev->xhdi_blocksize));
469 + }
470 + else
471 + {
472 + xhdi_id [3] = '\0';
473 + printf("Wrong partition ID [%s]!\n", xhdi_id);
474 + printf("Only 'RAW', 'LNX' and DOS partitions are supported.\n");
475 +
476 + __set_errno(EPERM);
477 + ret = -1;
478 + }
479 + }
480 + }
481 +
482 + if (ret)
483 + {
484 + if (mydev)
485 + free_device(mydev);
486 +
487 + dev = -1;
488 + }
489 +
490 + return dev;
491 +}
492 +
493 +int
494 +close(int fd)
495 +{
496 + struct device *mydev = get_device(fd);
497 + int ret = 0;
498 +
499 + if (!mydev)
500 + /* fall through */
501 + return __close(fd);
502 +
503 + if (mydev->open_flags == O_RDONLY)
504 + {
505 + ;
506 + }
507 + else if (Dlock(0, mydev->drv))
508 + {
509 + printf("Can't unlock partition %c:!\n", 'A'+mydev->drv);
510 +
511 + __set_errno(EACCES);
512 + ret = -1;
513 + }
514 +
515 + free_device(mydev);
516 + return ret;
517 +}
518 +
519 +/* simple buffer */
520 +static char buffer[1024L * 128];
521 +static ulong buf_recno = 0;
522 +static long buf_n = 0;
523 +
524 +static long
525 +rwabs_xhdi(struct device *mydev, ushort rw, void *buf, ulong size, ulong recno)
526 +{
527 + ulong n = size / mydev->xhdi_blocksize;
528 + long r;
529 +
530 + assert((size % mydev->xhdi_blocksize) == 0);
531 +
532 + if (!n || (recno + n) > mydev->xhdi_blocks)
533 + {
534 + printf("rwabs_xhdi: access outside partition (drv = %c:)\n", 'A'+mydev->drv);
535 + exit(2);
536 + }
537 +
538 + if (n > 65535UL)
539 + {
540 + printf("rwabs_xhdi: n to large (drv = %c)\n", 'A'+mydev->drv);
541 + exit(2);
542 + }
543 +
544 + if (!rw && (buf_recno == recno) && (buf_n == n))
545 + {
546 + bcopy(buffer, buf, buf_n * mydev->xhdi_blocksize);
547 + return 0;
548 + }
549 +
550 + r = XHReadWrite (mydev->xhdi_maj, mydev->xhdi_min, rw, mydev->xhdi_start + recno, n, buf);
551 +
552 + if (!r && (n * mydev->xhdi_blocksize) <= sizeof(buffer))
553 + {
554 + bcopy(buf, buffer, n * mydev->xhdi_blocksize);
555 +
556 + buf_recno = recno;
557 + buf_n = n;
558 + }
559 + else
560 + buf_n = 0;
561 +
562 + return r;
563 +}
564 +
565 +# define max(a,b) (a > b ? a : b)
566 +# define min(a,b) (a > b ? b : a)
567 +
568 +int
569 +read(int fd, void *_buf, size_t size)
570 +{
571 + struct device *mydev = get_device(fd);
572 +
573 + if (!mydev)
574 + /* fall through */
575 + return __read(fd, _buf, size);
576 +
577 +{
578 + char *buf = _buf;
579 + long todo; /* characters remaining */
580 + long done; /* characters processed */
581 +
582 + todo = size;
583 + done = 0;
584 +
585 + if (todo == 0)
586 + return 0;
587 +
588 + /* partial block copy
589 + */
590 + if (mydev->pos % mydev->xhdi_blocksize)
591 + {
592 + char tmp[mydev->xhdi_blocksize];
593 +
594 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
595 + ulong offset = mydev->pos % mydev->xhdi_blocksize;
596 + ulong data;
597 + long ret;
598 +
599 + ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
600 + if (ret)
601 + {
602 + DEBUG(("read: partial part: read failure (r = %li, errno = %i)\n", ret, errno));
603 + goto out;
604 + }
605 +
606 + data = mydev->xhdi_blocksize - offset;
607 + data = min (todo, data);
608 +
609 + memcpy(buf, tmp + offset, data);
610 +
611 + buf += data;
612 + todo -= data;
613 + done += data;
614 + mydev->pos += data;
615 + }
616 +
617 + if (todo)
618 + {
619 + assert((todo > 0));
620 + assert((mydev->pos % mydev->xhdi_blocksize) == 0);
621 + }
622 +
623 +
624 + /* full blocks
625 + */
626 + if (todo / mydev->xhdi_blocksize)
627 + {
628 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
629 + ulong data = (todo / mydev->xhdi_blocksize) * mydev->xhdi_blocksize;
630 + long ret;
631 +
632 + ret = rwabs_xhdi (mydev, 0, buf, data, recno);
633 + if (ret)
634 + {
635 + DEBUG(("read: full blocks: read failure (r = %li, errno = %i)\n", ret, errno));
636 + goto out;
637 + }
638 +
639 + buf += data;
640 + todo -= data;
641 + done += data;
642 + mydev->pos += data;
643 + }
644 +
645 + if (todo)
646 + {
647 + assert((todo > 0) && (todo < mydev->xhdi_blocksize));
648 + assert((mydev->pos % mydev->xhdi_blocksize) == 0);
649 + }
650 +
651 + /* anything left?
652 + */
653 + if (todo)
654 + {
655 + char tmp[mydev->xhdi_blocksize];
656 +
657 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
658 + long ret;
659 +
660 + ret = rwabs_xhdi (mydev, 0, tmp, mydev->xhdi_blocksize, recno);
661 + if (ret)
662 + {
663 + DEBUG(("read: left part: read failure (r = %li, errno = %i)]\n", ret, errno));
664 + goto out;
665 + }
666 +
667 + memcpy(buf, tmp, todo);
668 +
669 + done += todo;
670 + mydev->pos += todo;
671 + }
672 +
673 + assert(done == size);
674 +
675 +out:
676 + return done;
677 +}
678 +}
679 +
680 +int
681 +write(int fd, const void *_buf, size_t size)
682 +{
683 + struct device *mydev = get_device(fd);
684 +
685 + if (!mydev)
686 + /* fall through */
687 + return __write(fd, _buf, size);
688 +
689 + if (mydev->open_flags == O_RDONLY)
690 + {
691 + __set_errno(EPERM);
692 + return -1;
693 + }
694 +{
695 + const char *buf = _buf;
696 + long todo; /* characters remaining */
697 + long done; /* characters processed */
698 +
699 + todo = size;
700 + done = 0;
701 +
702 + if (todo == 0)
703 + return 0;
704 +
705 + /* partial block copy
706 + */
707 + if (mydev->pos % mydev->xhdi_blocksize)
708 + {
709 + char tmp[mydev->xhdi_blocksize];
710 +
711 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
712 + ulong offset = mydev->pos % mydev->xhdi_blocksize;
713 + ulong data;
714 + long ret;
715 +
716 + ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
717 + if (ret)
718 + {
719 + DEBUG(("write: partial part: read failure (r = %li, errno = %i)\n", ret, errno));
720 + goto out;
721 + }
722 +
723 + data = mydev->xhdi_blocksize - offset;
724 + data = min (todo, data);
725 +
726 + memcpy(tmp + offset, buf, data);
727 +
728 + ret = rwabs_xhdi(mydev, 1, tmp, mydev->xhdi_blocksize, recno);
729 + if (ret)
730 + {
731 + DEBUG(("write: partial part: write failure (r = %li, errno = %i)\n", ret, errno));
732 + goto out;
733 + }
734 +
735 + buf += data;
736 + todo -= data;
737 + done += data;
738 + mydev->pos += data;
739 + }
740 +
741 + if (todo)
742 + {
743 + assert((todo > 0));
744 + assert((mydev->pos % mydev->xhdi_blocksize) == 0);
745 + }
746 +
747 + /* full blocks
748 + */
749 + if (todo / mydev->xhdi_blocksize)
750 + {
751 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
752 + ulong data = (todo / mydev->xhdi_blocksize) * mydev->xhdi_blocksize;
753 + long ret;
754 +
755 + ret = rwabs_xhdi(mydev, 1, (void *)buf, data, recno);
756 + if (ret)
757 + {
758 + DEBUG(("write: full blocks: write failure (r = %li, errno = %i)\n", ret, errno));
759 + goto out;
760 + }
761 +
762 + buf += data;
763 + todo -= data;
764 + done += data;
765 + mydev->pos += data;
766 + }
767 +
768 + if (todo)
769 + {
770 + assert((todo > 0) && (todo < mydev->xhdi_blocksize));
771 + assert((mydev->pos % mydev->xhdi_blocksize) == 0);
772 + }
773 +
774 + /* anything left?
775 + */
776 + if (todo)
777 + {
778 + char tmp[mydev->xhdi_blocksize];
779 +
780 + ulong recno = mydev->pos / mydev->xhdi_blocksize;
781 + long ret;
782 +
783 + ret = rwabs_xhdi(mydev, 0, tmp, mydev->xhdi_blocksize, recno);
784 + if (ret)
785 + {
786 + DEBUG(("write: left part: read failure (r = %li, errno = %i)]\n", ret, errno));
787 + goto out;
788 + }
789 +
790 + memcpy(tmp, buf, todo);
791 +
792 + ret = rwabs_xhdi(mydev, 1, tmp, mydev->xhdi_blocksize, recno);
793 + if (ret)
794 + {
795 + DEBUG(("write: partial part: write failure (r = %li, errno = %i)\n", ret, errno));
796 + goto out;
797 + }
798 +
799 + done += todo;
800 + mydev->pos += todo;
801 + }
802 +
803 + assert(done == size);
804 +
805 +out:
806 + return done;
807 +}
808 +}
809 +
810 +int
811 +ioctl(int fd, int cmd, void *arg)
812 +{
813 + struct device *mydev = get_device(fd);
814 +
815 + if (!mydev)
816 + /* fall through */
817 + return __ioctl(fd, cmd, arg);
818 +
819 + DEBUG(("ioctl: cmd = %i\n", cmd));
820 +
821 + switch (cmd)
822 + {
823 + case BLKGETSIZE:
824 + {
825 + ulong *size = arg;
826 + *size = mydev->xhdi_blocks * (mydev->xhdi_blocksize / 512);
827 + break;
828 + }
829 + case BLOCKSIZE:
830 + {
831 + ulong *block_size = arg;
832 + *block_size = mydev->xhdi_blocksize;
833 + break;
834 + }
835 + default:
836 + __set_errno(EINVAL);
837 + return -1;
838 + }
839 +
840 + return 0;
841 +}
842 +
843 +int
844 +fstat(int fd, struct stat *st)
845 +{
846 + struct device *mydev = get_device(fd);
847 +
848 + if (!mydev)
849 + /* fall through */
850 + return __fstat(fd, st);
851 +
852 + bzero(st, sizeof(*st));
853 +
854 + st->st_dev = mydev->xhdi_maj;
855 + st->st_ino = mydev->drv;
856 + st->st_mode = S_IFBLK | S_IRUSR | S_IWUSR;
857 + st->st_nlink = 1;
858 + st->st_uid = 0;
859 + st->st_gid = 0;
860 + st->st_rdev = mydev->xhdi_min;
861 + st->st_atime = time (NULL);
862 + st->st_mtime = time (NULL);
863 + st->st_ctime = time (NULL);
864 + st->st_size = (int64_t) mydev->xhdi_blocks * mydev->xhdi_blocksize;
865 + st->st_blocks = (int64_t) mydev->xhdi_blocks * mydev->xhdi_blocksize / 512;
866 + st->st_blksize = mydev->xhdi_blocksize;
867 + st->st_flags = 0;
868 + st->st_gen = 0;
869 +
870 + return 0;
871 +}
872 +
873 +int
874 +stat(const char *filename, struct stat *st)
875 +{
876 + struct device *mydev;
877 + int fd, res;
878 +
879 + fd = open(filename, O_RDONLY);
880 + if (fd == -1)
881 + return -1;
882 +
883 + mydev = get_device(fd);
884 + if (!mydev)
885 + {
886 + close(fd);
887 +
888 + /* fall through */
889 + return __stat(filename, st);
890 + }
891 +
892 + res = fstat(fd, st);
893 + close(fd);
894 +
895 + return res;
896 +}
897 +
898 +int
899 +fsync(int fd)
900 +{
901 + struct device *mydev = get_device(fd);
902 +
903 + if (!mydev)
904 + /* fall through */
905 + return __fsync(fd);
906 +
907 + /* nothing todo */
908 + return 0;
909 +}
910 +
911 +loff_t llseek(int fd, loff_t offset, int origin);
912 +
913 +loff_t
914 +llseek(int fd, loff_t offset, int origin)
915 +{
916 + struct device *mydev = get_device(fd);
917 +
918 + if (!mydev)
919 + /* fall through */
920 + return __lseek(fd, (off_t) offset, origin);
921 +
922 +
923 + switch (origin)
924 + {
925 + case SEEK_SET:
926 + break;
927 + case SEEK_CUR:
928 + offset += mydev->pos;
929 + break;
930 + case SEEK_END:
931 + offset += (int64_t) mydev->xhdi_blocks * mydev->xhdi_blocksize;
932 + break;
933 + default:
934 + return -1;
935 + }
936 +
937 + if (offset > (loff_t) mydev->xhdi_blocks * mydev->xhdi_blocksize)
938 + {
939 + __set_errno(EINVAL);
940 + return -1;
941 + }
942 +
943 + mydev->pos = offset;
944 + return mydev->pos;
945 +}
946 +
947 +loff_t lseek64(int fd, loff_t offset, int origin);
948 +
949 +loff_t
950 +lseek64(int fd, loff_t offset, int origin)
951 +{
952 + return llseek(fd, offset, origin);
953 +}
954 +
955 +__off_t
956 +lseek(int fd, __off_t offset, int mode)
957 +{
958 + struct device *mydev = get_device(fd);
959 +
960 + if (!mydev)
961 + /* fall through */
962 + return __lseek(fd, offset, mode);
963 +
964 +{
965 + loff_t _offset = offset;
966 +
967 + switch (mode)
968 + {
969 + case SEEK_SET:
970 + break;
971 + case SEEK_CUR:
972 + _offset += mydev->pos;
973 + break;
974 + case SEEK_END:
975 + _offset += (loff_t) mydev->xhdi_blocks * mydev->xhdi_blocksize;
976 + break;
977 + default:
978 + return -1;
979 + }
980 +
981 + if (_offset > LONG_MAX)
982 + {
983 + __set_errno(EINVAL);
984 + return -1;
985 + }
986 +
987 + if (_offset > (loff_t) mydev->xhdi_blocks * mydev->xhdi_blocksize)
988 + {
989 + __set_errno(EINVAL);
990 + return -1;
991 + }
992 +
993 + mydev->pos = _offset;
994 + return (off_t) mydev->pos;
995 +}
996 +}
997 +
998 +int gettype(int fd);
999 +
1000 +int
1001 +gettype(int fd)
1002 +{
1003 + struct device *mydev = get_device(fd);
1004 + char *xhdi_id;
1005 +
1006 + if (!mydev)
1007 + return -1;
1008 +
1009 + /* Get filesystem type by XHDI ID */
1010 + xhdi_id = mydev->xhdi_id;
1011 + if ((xhdi_id[0] == '\0') && (xhdi_id[1] == 'D'))
1012 + return 0; /* DOS (\0D*) */
1013 + else
1014 + return 1; /* Atari (GEM/GBM) */
1015 +}
1016 +
1017 +# endif /* __MINT__ */
1018 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/mint_io.h e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.h
1019 --- e2fsprogs-1.41.3/lib/ext2fs/mint_io.h 1970-01-01 00:00:00.000000000 +0000
1020 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/mint_io.h 2009-01-23 10:49:53.000000000 +0000
1021 @@ -0,0 +1,22 @@
1022 +/*
1023 + * mint_io.h
1024 + *
1025 + * Copyright (C) 2000 Frank Naumann <fnaumann@freemint.de>.
1026 + *
1027 + * %Begin-Header%
1028 + * This file may be redistributed under the terms of the GNU Public
1029 + * License.
1030 + * %End-Header%
1031 + */
1032 +
1033 +# ifdef __MINT__
1034 +
1035 +# ifndef _mint_io_h
1036 +# define _mint_io_h
1037 +
1038 +# define BLKGETSIZE (('b'<< 8) | 1)
1039 +# define BLOCKSIZE (('b'<< 8) | 2)
1040 +
1041 +# endif /* _mint_io_h */
1042 +
1043 +# endif /* __MINT__ */
1044 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/unix_io.c e2fsprogs-1.41.3-mint/lib/ext2fs/unix_io.c
1045 --- e2fsprogs-1.41.3/lib/ext2fs/unix_io.c 2008-10-13 03:12:22.000000000 +0000
1046 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/unix_io.c 2009-01-23 10:47:35.000000000 +0000
1047 @@ -51,9 +51,15 @@
1048 #define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
1049 #endif
1050
1051 +#ifdef __MINT__
1052 +#include <sys/ioctl.h>
1053 +#include "mint_io.h"
1054 +#endif
1055 +
1056 #include "ext2_fs.h"
1057 #include "ext2fs.h"
1058
1059 +
1060 /*
1061 * For checking structure magic numbers...
1062 */
1063 @@ -512,6 +518,16 @@
1064 }
1065 }
1066 #endif
1067 +
1068 +#ifdef __MINT__
1069 + {
1070 + unsigned long block_size;
1071 + retval = ioctl(data->dev, BLOCKSIZE, &block_size);
1072 + if (retval == 0)
1073 + io->block_size = block_size;
1074 + }
1075 +#endif
1076 +
1077 *channel = io;
1078 return 0;
1079
1080 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/xhdi.c e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.c
1081 --- e2fsprogs-1.41.3/lib/ext2fs/xhdi.c 1970-01-01 00:00:00.000000000 +0000
1082 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.c 2009-01-23 10:49:55.000000000 +0000
1083 @@ -0,0 +1,577 @@
1084 +/*
1085 + * Copyright 2000 Frank Naumann <fnaumann@freemint.de>
1086 + * All rights reserved.
1087 + *
1088 + * This program is free software; you can redistribute it and/or modify
1089 + * it under the terms of the GNU General Public License as published by
1090 + * the Free Software Foundation; either version 2, or (at your option)
1091 + * any later version.
1092 + *
1093 + * This file is distributed in the hope that it will be useful,
1094 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1095 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1096 + * GNU General Public License for more details.
1097 + *
1098 + * You should have received a copy of the GNU General Public License
1099 + * along with this program; if not, write to the Free Software
1100 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1101 + *
1102 + *
1103 + * Started: 2000-05-02
1104 + *
1105 + * Changes:
1106 + *
1107 + * 0.1:
1108 + *
1109 + * fix: Cookie handling stuff; use Getcookie from MiNT-Lib now
1110 + * requires an actual MiNT-Lib (>= PL49)
1111 + *
1112 + * 0.0:
1113 + *
1114 + * - inital version
1115 + *
1116 + */
1117 +
1118 +# include "xhdi.h"
1119 +
1120 +# include <stdio.h>
1121 +# include <stdlib.h>
1122 +# include <errno.h>
1123 +# include <mintbind.h>
1124 +# include <mint/cookie.h>
1125 +
1126 +
1127 +/*
1128 + * internal usage
1129 + */
1130 +
1131 +/* dummy routine */
1132 +static long
1133 +XHDIfail (void)
1134 +{
1135 + return -ENOSYS;
1136 +}
1137 +
1138 +/* XHDI handler function */
1139 +static long (*XHDI)() = XHDIfail;
1140 +
1141 +ushort XHDI_installed = 0;
1142 +
1143 +
1144 +# define C_XHDI 0x58484449L
1145 +# define XHDIMAGIC 0x27011992L
1146 +
1147 +/* initalize flag */
1148 +static ushort init = 1;
1149 +
1150 +long
1151 +init_XHDI (void)
1152 +{
1153 + long *val;
1154 + long r;
1155 +
1156 + init = 0;
1157 +
1158 + r = Getcookie (C_XHDI, (long *) &val);
1159 + if (r == C_FOUND)
1160 + {
1161 + long *magic_test = val;
1162 +
1163 + /* check magic */
1164 + if (magic_test)
1165 + {
1166 + magic_test--;
1167 + if (*magic_test == XHDIMAGIC)
1168 + {
1169 + XHDI = val;
1170 + }
1171 + }
1172 + }
1173 +
1174 + r = XHGetVersion ();
1175 + if (r < 0)
1176 + {
1177 + perror ("XHGetVersion");
1178 +
1179 + XHDI = XHDIfail;
1180 + return r;
1181 + }
1182 +
1183 + /* we need at least XHDI 1.10 */
1184 + if (r >= 0x110)
1185 + {
1186 + XHDI_installed = r;
1187 + return 0;
1188 + }
1189 +
1190 + XHDI = XHDIfail;
1191 + return -1;
1192 +}
1193 +
1194 +
1195 +/*
1196 + * XHDI wrapper routines
1197 + */
1198 +
1199 +# define CALL \
1200 + long oldstack = 0; \
1201 + long r; \
1202 + \
1203 + if (init) init_XHDI (); \
1204 + \
1205 + if (!Super (1L)) \
1206 + oldstack = Super (0L); \
1207 + \
1208 + r = XHDI (args); \
1209 + if (r < 0) \
1210 + { \
1211 + __set_errno (-r); \
1212 + r = -1; \
1213 + } \
1214 + \
1215 + if (oldstack) \
1216 + Super (oldstack); \
1217 + \
1218 + return r
1219 +
1220 +long
1221 +XHGetVersion (void)
1222 +{
1223 + struct args_XHGetVersion
1224 + {
1225 + ushort opcode;
1226 + }
1227 + args =
1228 + {
1229 + 0
1230 + };
1231 +
1232 + CALL;
1233 +}
1234 +
1235 +long
1236 +XHInqTarget (ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name)
1237 +{
1238 + struct args_XHInqTarget
1239 + {
1240 + ushort opcode;
1241 + ushort major;
1242 + ushort minor;
1243 + ulong *block_size;
1244 + ulong *device_flags;
1245 + char *product_name;
1246 + }
1247 + args =
1248 + {
1249 + 1,
1250 + major,
1251 + minor,
1252 + block_size,
1253 + device_flags,
1254 + product_name
1255 + };
1256 +
1257 + CALL;
1258 +}
1259 +
1260 +long
1261 +XHReserve (ushort major, ushort minor, ushort do_reserve, ushort key)
1262 +{
1263 + struct args_XHReserve
1264 + {
1265 + ushort opcode;
1266 + ushort major;
1267 + ushort minor;
1268 + ushort do_reserve;
1269 + ushort key;
1270 + }
1271 + args =
1272 + {
1273 + 2,
1274 + major,
1275 + minor,
1276 + do_reserve,
1277 + key
1278 + };
1279 +
1280 + CALL;
1281 +}
1282 +
1283 +long
1284 +XHLock (ushort major, ushort minor, ushort do_lock, ushort key)
1285 +{
1286 + struct args_XHLock
1287 + {
1288 + ushort opcode;
1289 + ushort major;
1290 + ushort minor;
1291 + ushort do_lock;
1292 + ushort key;
1293 + }
1294 + args =
1295 + {
1296 + 3,
1297 + major,
1298 + minor,
1299 + do_lock,
1300 + key
1301 + };
1302 +
1303 + CALL;
1304 +}
1305 +
1306 +long
1307 +XHStop (ushort major, ushort minor, ushort do_stop, ushort key)
1308 +{
1309 + struct args_XHStop
1310 + {
1311 + ushort opcode;
1312 + ushort major;
1313 + ushort minor;
1314 + ushort do_stop;
1315 + ushort key;
1316 + }
1317 + args =
1318 + {
1319 + 4,
1320 + major,
1321 + minor,
1322 + do_stop,
1323 + key
1324 + };
1325 +
1326 + CALL;
1327 +}
1328 +
1329 +long
1330 +XHEject (ushort major, ushort minor, ushort do_eject, ushort key)
1331 +{
1332 + struct args_XHEject
1333 + {
1334 + ushort opcode;
1335 + ushort major;
1336 + ushort minor;
1337 + ushort do_eject;
1338 + ushort key;
1339 + }
1340 + args =
1341 + {
1342 + 5,
1343 + major,
1344 + minor,
1345 + do_eject,
1346 + key
1347 + };
1348 +
1349 + CALL;
1350 +}
1351 +
1352 +long
1353 +XHDrvMap (void)
1354 +{
1355 + struct args_XHDrvMap
1356 + {
1357 + ushort opcode;
1358 + }
1359 + args =
1360 + {
1361 + 6
1362 + };
1363 +
1364 + CALL;
1365 +}
1366 +
1367 +long
1368 +XHInqDev (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB *bpb)
1369 +{
1370 + struct args_XHInqDev
1371 + {
1372 + ushort opcode;
1373 + ushort bios;
1374 + ushort *major;
1375 + ushort *minor;
1376 + ulong *start;
1377 + __BPB *bpb;
1378 + }
1379 + args =
1380 + {
1381 + 7,
1382 + bios,
1383 + major,
1384 + minor,
1385 + start,
1386 + bpb
1387 + };
1388 +
1389 + CALL;
1390 +}
1391 +
1392 +long
1393 +XHInqDriver (ushort bios, char *name, char *version, char *company, ushort *ahdi_version, ushort *maxIPL)
1394 +{
1395 + struct args_XHInqDriver
1396 + {
1397 + ushort opcode;
1398 + ushort bios;
1399 + char *name;
1400 + char *version;
1401 + char *company;
1402 + ushort *ahdi_version;
1403 + ushort *maxIPL;
1404 + }
1405 + args =
1406 + {
1407 + 8,
1408 + bios,
1409 + name,
1410 + version,
1411 + company,
1412 + ahdi_version,
1413 + maxIPL
1414 + };
1415 +
1416 + CALL;
1417 +}
1418 +
1419 +long
1420 +XHNewCookie (void *newcookie)
1421 +{
1422 + struct args_XHNewCookie
1423 + {
1424 + ushort opcode;
1425 + void *newcookie;
1426 + }
1427 + args =
1428 + {
1429 + 9,
1430 + newcookie
1431 + };
1432 +
1433 + CALL;
1434 +}
1435 +
1436 +long
1437 +XHReadWrite (ushort major, ushort minor, ushort rwflag, ulong recno, ushort count, void *buf)
1438 +{
1439 + struct args_XHReadWrite
1440 + {
1441 + ushort opcode;
1442 + ushort major;
1443 + ushort minor;
1444 + ushort rwflag;
1445 + ulong recno;
1446 + ushort count;
1447 + void *buf;
1448 + }
1449 + args =
1450 + {
1451 + 10,
1452 + major,
1453 + minor,
1454 + rwflag,
1455 + recno,
1456 + count,
1457 + buf
1458 + };
1459 +
1460 + CALL;
1461 +}
1462 +
1463 +long
1464 +XHInqTarget2 (ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name, ushort stringlen)
1465 +{
1466 + struct args_XHInqTarget2
1467 + {
1468 + ushort opcode;
1469 + ushort major;
1470 + ushort minor;
1471 + ulong *block_size;
1472 + ulong *device_flags;
1473 + char *product_name;
1474 + ushort stringlen;
1475 + }
1476 + args =
1477 + {
1478 + 11,
1479 + major,
1480 + minor,
1481 + block_size,
1482 + device_flags,
1483 + product_name,
1484 + stringlen
1485 + };
1486 +
1487 + CALL;
1488 +}
1489 +
1490 +long
1491 +XHInqDev2 (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB *bpb, ulong *blocks, char *partid)
1492 +{
1493 + struct args_XHInqDev2
1494 + {
1495 + ushort opcode;
1496 + ushort bios;
1497 + ushort *major;
1498 + ushort *minor;
1499 + ulong *start;
1500 + __BPB *bpb;
1501 + ulong *blocks;
1502 + char *partid;
1503 + }
1504 + args =
1505 + {
1506 + 12,
1507 + bios,
1508 + major,
1509 + minor,
1510 + start,
1511 + bpb,
1512 + blocks,
1513 + partid
1514 + };
1515 +
1516 + CALL;
1517 +}
1518 +
1519 +long
1520 +XHDriverSpecial (ulong key1, ulong key2, ushort subopcode, void *data)
1521 +{
1522 + struct args_XHDriverSpecial
1523 + {
1524 + ushort opcode;
1525 + ulong key1;
1526 + ulong key2;
1527 + ushort subopcode;
1528 + void *data;
1529 + }
1530 + args =
1531 + {
1532 + 13,
1533 + key1,
1534 + key2,
1535 + subopcode,
1536 + data
1537 + };
1538 +
1539 + CALL;
1540 +}
1541 +
1542 +long
1543 +XHGetCapacity (ushort major, ushort minor, ulong *blocks, ulong *bs)
1544 +{
1545 + struct args_XHGetCapacity
1546 + {
1547 + ushort opcode;
1548 + ushort major;
1549 + ushort minor;
1550 + ulong *blocks;
1551 + ulong *bs;
1552 + }
1553 + args =
1554 + {
1555 + 14,
1556 + major,
1557 + minor,
1558 + blocks,
1559 + bs
1560 + };
1561 +
1562 + CALL;
1563 +}
1564 +
1565 +long
1566 +XHMediumChanged (ushort major, ushort minor)
1567 +{
1568 + struct args_XHMediumChanged
1569 + {
1570 + ushort opcode;
1571 + ushort major;
1572 + ushort minor;
1573 + }
1574 + args =
1575 + {
1576 + 15,
1577 + major,
1578 + minor
1579 + };
1580 +
1581 + CALL;
1582 +}
1583 +
1584 +long
1585 +XHMiNTInfo (ushort op, void *data)
1586 +{
1587 + struct args_XHMiNTInfo
1588 + {
1589 + ushort opcode;
1590 + ushort op;
1591 + void *data;
1592 + }
1593 + args =
1594 + {
1595 + 16,
1596 + op,
1597 + data
1598 + };
1599 +
1600 + CALL;
1601 +}
1602 +
1603 +long
1604 +XHDOSLimits (ushort which, ulong limit)
1605 +{
1606 + struct args_XHDOSLimits
1607 + {
1608 + ushort opcode;
1609 + ushort which;
1610 + ulong limit;
1611 + }
1612 + args =
1613 + {
1614 + 17,
1615 + which,
1616 + limit
1617 + };
1618 +
1619 + CALL;
1620 +}
1621 +
1622 +long
1623 +XHLastAccess (ushort major, ushort minor, ulong *ms)
1624 +{
1625 + struct args_XHLastAccess
1626 + {
1627 + ushort opcode;
1628 + ushort major;
1629 + ushort minor;
1630 + ulong *ms;
1631 + }
1632 + args =
1633 + {
1634 + 18,
1635 + major,
1636 + minor,
1637 + ms
1638 + };
1639 +
1640 + CALL;
1641 +}
1642 +
1643 +long
1644 +XHReaccess (ushort major, ushort minor)
1645 +{
1646 + struct args_XHReaccess
1647 + {
1648 + ushort opcode;
1649 + ushort major;
1650 + ushort minor;
1651 + }
1652 + args =
1653 + {
1654 + 19,
1655 + major,
1656 + minor
1657 + };
1658 +
1659 + CALL;
1660 +}
1661 diff -ur --new-file e2fsprogs-1.41.3/lib/ext2fs/xhdi.h e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.h
1662 --- e2fsprogs-1.41.3/lib/ext2fs/xhdi.h 1970-01-01 00:00:00.000000000 +0000
1663 +++ e2fsprogs-1.41.3-mint/lib/ext2fs/xhdi.h 2009-01-23 10:49:56.000000000 +0000
1664 @@ -0,0 +1,144 @@
1665 +/*
1666 + * Copyright 2000 Frank Naumann <fnaumann@freemint.de>
1667 + * All rights reserved.
1668 + *
1669 + * This program is free software; you can redistribute it and/or modify
1670 + * it under the terms of the GNU General Public License as published by
1671 + * the Free Software Foundation; either version 2, or (at your option)
1672 + * any later version.
1673 + *
1674 + * This file is distributed in the hope that it will be useful,
1675 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1676 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1677 + * GNU General Public License for more details.
1678 + *
1679 + * You should have received a copy of the GNU General Public License
1680 + * along with this program; if not, write to the Free Software
1681 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1682 + *
1683 + */
1684 +
1685 +# ifndef _xhdi_h
1686 +# define _xhdi_h
1687 +
1688 +# include <sys/types.h>
1689 +
1690 +typedef unsigned char uchar;
1691 +
1692 +
1693 +/*
1694 + * BIOS parameter block (osbind.h is buggy)
1695 + */
1696 +
1697 +typedef struct
1698 +{
1699 + ushort recsiz; /* bytes per sector */
1700 + short clsiz; /* sectors per cluster */
1701 + ushort clsizb; /* bytes per cluster */
1702 + short rdlen; /* root directory size */
1703 + short fsiz; /* size of FAT */
1704 + short fatrec; /* startsector of second FAT */
1705 + short datrec; /* first data sector */
1706 + ushort numcl; /* total number of clusters */
1707 + short bflags; /* some flags */
1708 +
1709 +} __BPB;
1710 +
1711 +
1712 +/*
1713 + * Extended BIOS Parameter Block (XHDI)
1714 + */
1715 +
1716 +typedef struct
1717 +{
1718 + ushort recsiz; /* bytes per sector */
1719 + short clsiz; /* sectors per cluster */
1720 + ushort clsizb; /* bytes per cluster */
1721 + short rdlen; /* root directory size or 0 if FAT32 */
1722 + short fsiz; /* size of FAT or 0 if FAT32 */
1723 + short fatrec; /* startsector of second FAT or 0 if FAT32 */
1724 + short datrec; /* first data sector or 0 if FAT32 */
1725 + ushort numcl; /* total number of clusters or 0 if FAT32 */
1726 + short bflags; /* bit 0: 0 = FAT12, 1 = FAT16
1727 + * bit 1: 0 = 2 FATs, 1 = 1 FAT
1728 + * bit 2: 0 = BPB, 1 = EXTENDED_BPB
1729 + */
1730 +
1731 + /* Ab hier undokumentiert, nur A: und B:! */
1732 + short ntracks; /* Anzahl Spuren */
1733 + short nsides; /* Anzahl Seiten */
1734 + short spc; /* Sektoren pro Zylinder */
1735 + short spt; /* Sektoren pro Spur */
1736 + ushort nhid; /* Anzahl versteckte Sektoren */
1737 + uchar ser[3]; /* Seriennummer */
1738 + uchar serms[4]; /* ab TOS 2.06: MS-DOS-4.0-Seriennummer */
1739 + char unused;
1740 +
1741 + /* if bit 2 of bflags are set */
1742 + long l_recsiz; /* bytes per sector */
1743 + long l_clsiz; /* sectors per cluster */
1744 + long l_clsizb; /* bytes per cluster */
1745 + long l_rdlen; /* root directory size */
1746 + long l_fsiz; /* size of FAT */
1747 + long l_fatrec; /* startsector of second FAT */
1748 + long l_datrec; /* first data sector */
1749 + long l_numcl; /* total number of clusters */
1750 + long l_rdstcl; /* if FAT32: startcluster of root directory
1751 + * otherwise 0
1752 + */
1753 +} __xhdi_BPB;
1754 +
1755 +
1756 +# define XH_TARGET_STOPPABLE 0x00000001L
1757 +# define XH_TARGET_REMOVABLE 0x00000002L
1758 +# define XH_TARGET_LOCKABLE 0x00000004L
1759 +# define XH_TARGET_EJECTABLE 0x00000008L
1760 +# define XH_TARGET_LOCKED 0x20000000L
1761 +# define XH_TARGET_STOPPED 0x40000000L
1762 +# define XH_TARGET_RESERVED 0x80000000L
1763 +
1764 +# define XH_MI_SETKERINFO 0
1765 +# define XH_MI_GETKERINFO 1
1766 +
1767 +# define XH_DL_SECSIZ 0
1768 +# define XH_DL_MINFAT 1
1769 +# define XH_DL_MAXFAT 2
1770 +# define XH_DL_MINSPC 3
1771 +# define XH_DL_MAXSPC 4
1772 +# define XH_DL_CLUSTS 5
1773 +# define XH_DL_MAXSEC 6
1774 +# define XH_DL_DRIVES 7
1775 +# define XH_DL_CLSIZB 8
1776 +# define XH_DL_RDLEN 9
1777 +# define XH_DL_CLUSTS12 12
1778 +# define XH_DL_CLUSTS32 13
1779 +# define XH_DL_BFLAGS 14
1780 +
1781 +
1782 +extern ushort XHDI_installed;
1783 +
1784 +long init_XHDI (void);
1785 +
1786 +long XHGetVersion (void);
1787 +long XHInqTarget (ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name);
1788 +long XHReserve (ushort major, ushort minor, ushort do_reserve, ushort key);
1789 +long XHLock (ushort major, ushort minor, ushort do_lock, ushort key);
1790 +long XHStop (ushort major, ushort minor, ushort do_stop, ushort key);
1791 +long XHEject (ushort major, ushort minor, ushort do_eject, ushort key);
1792 +long XHDrvMap (void);
1793 +long XHInqDev (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB *bpb);
1794 +long XHInqDriver (ushort bios, char *name, char *version, char *company, ushort *ahdi_version, ushort *maxIPL);
1795 +long XHNewCookie (void *newcookie);
1796 +long XHReadWrite (ushort major, ushort minor, ushort rwflag, ulong recno, ushort count, void *buf);
1797 +long XHInqTarget2 (ushort major, ushort minor, ulong *block_size, ulong *device_flags, char *product_name, ushort stringlen);
1798 +long XHInqDev2 (ushort bios, ushort *major, ushort *minor, ulong *start, __BPB *bpb, ulong *blocks, char *partid);
1799 +long XHDriverSpecial (ulong key1, ulong key2, ushort subopcode, void *data);
1800 +long XHGetCapacity (ushort major, ushort minor, ulong *blocks, ulong *bs);
1801 +long XHMediumChanged (ushort major, ushort minor);
1802 +long XHMiNTInfo (ushort op, void *data);
1803 +long XHDOSLimits (ushort which, ulong limit);
1804 +long XHLastAccess (ushort major, ushort minor, ulong *ms);
1805 +long XHReaccess (ushort major, ushort minor);
1806 +
1807 +
1808 +# endif /* _xhdi_h */
1809 diff -ur --new-file e2fsprogs-1.41.3/misc/e2undo.c e2fsprogs-1.41.3-mint/misc/e2undo.c
1810 --- e2fsprogs-1.41.3/misc/e2undo.c 2009-01-23 12:59:44.000000000 +0000
1811 +++ e2fsprogs-1.41.3-mint/misc/e2undo.c 2009-01-23 12:56:40.000000000 +0000
1812 @@ -19,6 +19,7 @@
1813 #if HAVE_ERRNO_H
1814 #include <errno.h>
1815 #endif
1816 +#include <sys/types.h>
1817 #include "ext2fs/tdb.h"
1818 #include "ext2fs/ext2fs.h"
1819 #include "nls-enable.h"
1820 diff -ur --new-file e2fsprogs-1.41.3/misc/e2initrd_helper.c e2fsprogs-1.41.3-mint/misc/e2initrd_helper.c
1821 --- e2fsprogs-1.41.3/misc/e2initrd_helper.c 2009-01-23 12:58:29.000000000 +0000
1822 +++ e2fsprogs-1.41.3-mint/misc/e2initrd_helper.c 2009-01-23 12:59:11.000000000 +0000
1823 @@ -50,7 +50,7 @@
1824 int ptr;
1825 };
1826
1827 -struct fs_info {
1828 +struct _fs_info {
1829 char *device;
1830 char *mountpt;
1831 char *type;
1832 @@ -58,7 +58,7 @@
1833 int freq;
1834 int passno;
1835 int flags;
1836 - struct fs_info *next;
1837 + struct _fs_info *next;
1838 };
1839
1840 static void usage(void)
1841 @@ -230,7 +230,7 @@
1842 *q = 0;
1843 }
1844
1845 -static int parse_fstab_line(char *line, struct fs_info *fs)
1846 +static int parse_fstab_line(char *line, struct _fs_info *fs)
1847 {
1848 char *dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
1849
1850 @@ -280,7 +280,7 @@
1851 return 0;
1852 }
1853
1854 -static void free_fstab_line(struct fs_info *fs)
1855 +static void free_fstab_line(struct _fs_info *fs)
1856 {
1857 if (fs->device)
1858 fs->device = 0;
1859 @@ -290,7 +290,7 @@
1860 fs->type = 0;
1861 if (fs->opts)
1862 fs->opts = 0;
1863 - memset(fs, 0, sizeof(struct fs_info));
1864 + memset(fs, 0, sizeof(struct _fs_info));
1865 }
1866
1867
1868 @@ -334,7 +334,7 @@
1869 errcode_t retval;
1870 struct mem_file file;
1871 char *buf;
1872 - struct fs_info fs_info;
1873 + struct _fs_info _fs_info;
1874 int ret;
1875
1876 retval = get_file(fs, "/etc/fstab", &file);
1877 @@ -344,14 +344,14 @@
1878 if (!buf)
1879 continue;
1880
1881 - ret = parse_fstab_line(buf, &fs_info);
1882 + ret = parse_fstab_line(buf, &_fs_info);
1883 if (ret < 0)
1884 goto next_line;
1885
1886 - if (!strcmp(fs_info.mountpt, "/"))
1887 - printf("%s\n", fs_info.type);
1888 + if (!strcmp(_fs_info.mountpt, "/"))
1889 + printf("%s\n", _fs_info.type);
1890
1891 - free_fstab_line(&fs_info);
1892 + free_fstab_line(&_fs_info);
1893
1894 next_line:
1895 free(buf);
1896 diff -ur --new-file e2fsprogs-1.41.3/misc/mke2fs.c e2fsprogs-1.41.3-mint/misc/mke2fs.c
1897 --- e2fsprogs-1.41.3/misc/mke2fs.c 2008-10-07 14:22:39.000000000 +0000
1898 +++ e2fsprogs-1.41.3-mint/misc/mke2fs.c 2009-01-23 10:47:35.000000000 +0000
1899 @@ -1819,6 +1819,36 @@
1900 return retval;
1901 }
1902
1903 +#ifdef __MINT__
1904 +void
1905 +warn (const char *drv)
1906 +{
1907 + char c;
1908 + int check;
1909 +
1910 + check = open (drv, O_RDONLY);
1911 + if (check == -1)
1912 + return;
1913 +
1914 + close (check);
1915 +
1916 + if (check < 1024)
1917 + return;
1918 +
1919 + fprintf (stderr, "\n");
1920 + fprintf (stderr, "WARNING: THIS WILL TOTALLY DESTROY ANY DATA ON %s:\n", drv);
1921 + fprintf (stderr, "Are you ABSOLUTELY SURE you want to do this? (y/n) ");
1922 + scanf ("%c", &c);
1923 + fprintf (stderr, "\n");
1924 +
1925 + if (c == 'y' || c == 'Y')
1926 + return;
1927 +
1928 + fprintf (stderr, "Aborted\n");
1929 + exit (1);
1930 +}
1931 +#endif
1932 +
1933 int main (int argc, char *argv[])
1934 {
1935 errcode_t retval = 0;
1936 @@ -1839,6 +1869,11 @@
1937 #endif
1938 PRS(argc, argv);
1939
1940 +#ifdef __MINT__
1941 + if (!quiet)
1942 + warn (device_name);
1943 +#endif
1944 +
1945 #ifdef CONFIG_TESTIO_DEBUG
1946 if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
1947 io_ptr = test_io_manager;

  ViewVC Help
Powered by ViewVC 1.1.20