]> git.pld-linux.org Git - packages/kernel.git/blame - 2.2.18-pre2-beos09032000.patch
- obsolete
[packages/kernel.git] / 2.2.18-pre2-beos09032000.patch
CommitLineData
820c7554 1diff -aur --new-file linux-2.2.18-pre2-clean/Documentation/Configure.help linux-2.2.18-pre2-beos/Documentation/Configure.help
2--- linux-2.2.18-pre2-clean/Documentation/Configure.help Thu Aug 24 01:54:28 2000
3+++ linux-2.2.18-pre2-beos/Documentation/Configure.help Sat Sep 2 12:54:02 2000
4@@ -7674,6 +7674,24 @@
5 CONFIG_QNX4FS_RW
6 Say Y if you want to test write support for QNX4 filesystems.
7
8+BeOS filesystem support (EXPERIMENTAL)
9+CONFIG_BEOS_FS
10+ This is the filesystem used by the BeOS operating system. Say Y if
11+ you want to get read access to file on BeOS partitions of your hard
12+ drive or floppy disk.
13+
14+ This filesystem support is also available as a module ( = code which
15+ can be inserted in and removed from the running kernel whenever you
16+ want). The module is called beos.o. If you want to compile it as a
17+ module, say M here and read Documentation/modules.txt.
18+
19+ If unsure, say N.
20+
21+Other platform BeOS fs support
22+CONFIG_BEOS_CONV
23+ Say Y if you want to use other platform BeOS (i.e. mount BeOS(ppc) on
24+ Intel box).
25+
26 Kernel automounter support
27 CONFIG_AUTOFS_FS
28 The automounter is a tool to automatically mount remote filesystems
29diff -aur --new-file linux-2.2.18-pre2-clean/fs/Config.in linux-2.2.18-pre2-beos/fs/Config.in
30--- linux-2.2.18-pre2-clean/fs/Config.in Thu Aug 24 01:54:28 2000
31+++ linux-2.2.18-pre2-beos/fs/Config.in Sat Sep 2 12:51:25 2000
32@@ -47,6 +47,12 @@
33 bool ' QNX4FS write support (DANGEROUS)' CONFIG_QNX4FS_RW
34 fi
35 fi
36+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
37+ tristate 'BeOS filesystem support (read only) (EXPERIMENTAL)' CONFIG_BEOS_FS
38+ if [ "$CONFIG_BEOS_FS" != "n" ]; then
39+ bool ' BeOS other platform support' CONFIG_BEOS_CONV
40+ fi
41+fi
42 tristate 'ROM filesystem support' CONFIG_ROMFS_FS
43 tristate 'Second extended fs support' CONFIG_EXT2_FS
44 tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS
45diff -aur --new-file linux-2.2.18-pre2-clean/fs/Makefile linux-2.2.18-pre2-beos/fs/Makefile
46--- linux-2.2.18-pre2-clean/fs/Makefile Thu Aug 24 01:54:28 2000
47+++ linux-2.2.18-pre2-beos/fs/Makefile Sat Sep 2 12:51:47 2000
48@@ -18,7 +18,7 @@
49 MOD_LIST_NAME := FS_MODULES
50 ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \
51 hpfs sysv smbfs ncpfs ufs affs romfs autofs hfs lockd \
52- nfsd nls devpts adfs qnx4 efs
53+ nfsd nls devpts adfs qnx4 efs beos
54
55 ifeq ($(CONFIG_QUOTA),y)
56 O_OBJS += dquot.o
57@@ -212,6 +212,14 @@
58 else
59 ifeq ($(CONFIG_QNX4FS_FS),m)
60 MOD_SUB_DIRS += qnx4
61+ endif
62+endif
63+
64+ifeq ($(CONFIG_BEOS_FS),y)
65+SUB_DIRS += beos
66+else
67+ ifeq ($(CONFIG_BEOS_FS),m)
68+ MOD_SUB_DIRS += beos
69 endif
70 endif
71
72diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/COPYING linux-2.2.18-pre2-beos/fs/beos/COPYING
73--- linux-2.2.18-pre2-clean/fs/beos/COPYING Wed Dec 31 18:00:00 1969
74+++ linux-2.2.18-pre2-beos/fs/beos/COPYING Thu May 20 05:41:55 1999
75@@ -0,0 +1,339 @@
76+ GNU GENERAL PUBLIC LICENSE
77+ Version 2, June 1991
78+
79+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
80+ 675 Mass Ave, Cambridge, MA 02139, USA
81+ Everyone is permitted to copy and distribute verbatim copies
82+ of this license document, but changing it is not allowed.
83+
84+ Preamble
85+
86+ The licenses for most software are designed to take away your
87+freedom to share and change it. By contrast, the GNU General Public
88+License is intended to guarantee your freedom to share and change free
89+software--to make sure the software is free for all its users. This
90+General Public License applies to most of the Free Software
91+Foundation's software and to any other program whose authors commit to
92+using it. (Some other Free Software Foundation software is covered by
93+the GNU Library General Public License instead.) You can apply it to
94+your programs, too.
95+
96+ When we speak of free software, we are referring to freedom, not
97+price. Our General Public Licenses are designed to make sure that you
98+have the freedom to distribute copies of free software (and charge for
99+this service if you wish), that you receive source code or can get it
100+if you want it, that you can change the software or use pieces of it
101+in new free programs; and that you know you can do these things.
102+
103+ To protect your rights, we need to make restrictions that forbid
104+anyone to deny you these rights or to ask you to surrender the rights.
105+These restrictions translate to certain responsibilities for you if you
106+distribute copies of the software, or if you modify it.
107+
108+ For example, if you distribute copies of such a program, whether
109+gratis or for a fee, you must give the recipients all the rights that
110+you have. You must make sure that they, too, receive or can get the
111+source code. And you must show them these terms so they know their
112+rights.
113+
114+ We protect your rights with two steps: (1) copyright the software, and
115+(2) offer you this license which gives you legal permission to copy,
116+distribute and/or modify the software.
117+
118+ Also, for each author's protection and ours, we want to make certain
119+that everyone understands that there is no warranty for this free
120+software. If the software is modified by someone else and passed on, we
121+want its recipients to know that what they have is not the original, so
122+that any problems introduced by others will not reflect on the original
123+authors' reputations.
124+
125+ Finally, any free program is threatened constantly by software
126+patents. We wish to avoid the danger that redistributors of a free
127+program will individually obtain patent licenses, in effect making the
128+program proprietary. To prevent this, we have made it clear that any
129+patent must be licensed for everyone's free use or not licensed at all.
130+
131+ The precise terms and conditions for copying, distribution and
132+modification follow.
133+\f
134+ GNU GENERAL PUBLIC LICENSE
135+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
136+
137+ 0. This License applies to any program or other work which contains
138+a notice placed by the copyright holder saying it may be distributed
139+under the terms of this General Public License. The "Program", below,
140+refers to any such program or work, and a "work based on the Program"
141+means either the Program or any derivative work under copyright law:
142+that is to say, a work containing the Program or a portion of it,
143+either verbatim or with modifications and/or translated into another
144+language. (Hereinafter, translation is included without limitation in
145+the term "modification".) Each licensee is addressed as "you".
146+
147+Activities other than copying, distribution and modification are not
148+covered by this License; they are outside its scope. The act of
149+running the Program is not restricted, and the output from the Program
150+is covered only if its contents constitute a work based on the
151+Program (independent of having been made by running the Program).
152+Whether that is true depends on what the Program does.
153+
154+ 1. You may copy and distribute verbatim copies of the Program's
155+source code as you receive it, in any medium, provided that you
156+conspicuously and appropriately publish on each copy an appropriate
157+copyright notice and disclaimer of warranty; keep intact all the
158+notices that refer to this License and to the absence of any warranty;
159+and give any other recipients of the Program a copy of this License
160+along with the Program.
161+
162+You may charge a fee for the physical act of transferring a copy, and
163+you may at your option offer warranty protection in exchange for a fee.
164+
165+ 2. You may modify your copy or copies of the Program or any portion
166+of it, thus forming a work based on the Program, and copy and
167+distribute such modifications or work under the terms of Section 1
168+above, provided that you also meet all of these conditions:
169+
170+ a) You must cause the modified files to carry prominent notices
171+ stating that you changed the files and the date of any change.
172+
173+ b) You must cause any work that you distribute or publish, that in
174+ whole or in part contains or is derived from the Program or any
175+ part thereof, to be licensed as a whole at no charge to all third
176+ parties under the terms of this License.
177+
178+ c) If the modified program normally reads commands interactively
179+ when run, you must cause it, when started running for such
180+ interactive use in the most ordinary way, to print or display an
181+ announcement including an appropriate copyright notice and a
182+ notice that there is no warranty (or else, saying that you provide
183+ a warranty) and that users may redistribute the program under
184+ these conditions, and telling the user how to view a copy of this
185+ License. (Exception: if the Program itself is interactive but
186+ does not normally print such an announcement, your work based on
187+ the Program is not required to print an announcement.)
188+\f
189+These requirements apply to the modified work as a whole. If
190+identifiable sections of that work are not derived from the Program,
191+and can be reasonably considered independent and separate works in
192+themselves, then this License, and its terms, do not apply to those
193+sections when you distribute them as separate works. But when you
194+distribute the same sections as part of a whole which is a work based
195+on the Program, the distribution of the whole must be on the terms of
196+this License, whose permissions for other licensees extend to the
197+entire whole, and thus to each and every part regardless of who wrote it.
198+
199+Thus, it is not the intent of this section to claim rights or contest
200+your rights to work written entirely by you; rather, the intent is to
201+exercise the right to control the distribution of derivative or
202+collective works based on the Program.
203+
204+In addition, mere aggregation of another work not based on the Program
205+with the Program (or with a work based on the Program) on a volume of
206+a storage or distribution medium does not bring the other work under
207+the scope of this License.
208+
209+ 3. You may copy and distribute the Program (or a work based on it,
210+under Section 2) in object code or executable form under the terms of
211+Sections 1 and 2 above provided that you also do one of the following:
212+
213+ a) Accompany it with the complete corresponding machine-readable
214+ source code, which must be distributed under the terms of Sections
215+ 1 and 2 above on a medium customarily used for software interchange; or,
216+
217+ b) Accompany it with a written offer, valid for at least three
218+ years, to give any third party, for a charge no more than your
219+ cost of physically performing source distribution, a complete
220+ machine-readable copy of the corresponding source code, to be
221+ distributed under the terms of Sections 1 and 2 above on a medium
222+ customarily used for software interchange; or,
223+
224+ c) Accompany it with the information you received as to the offer
225+ to distribute corresponding source code. (This alternative is
226+ allowed only for noncommercial distribution and only if you
227+ received the program in object code or executable form with such
228+ an offer, in accord with Subsection b above.)
229+
230+The source code for a work means the preferred form of the work for
231+making modifications to it. For an executable work, complete source
232+code means all the source code for all modules it contains, plus any
233+associated interface definition files, plus the scripts used to
234+control compilation and installation of the executable. However, as a
235+special exception, the source code distributed need not include
236+anything that is normally distributed (in either source or binary
237+form) with the major components (compiler, kernel, and so on) of the
238+operating system on which the executable runs, unless that component
239+itself accompanies the executable.
240+
241+If distribution of executable or object code is made by offering
242+access to copy from a designated place, then offering equivalent
243+access to copy the source code from the same place counts as
244+distribution of the source code, even though third parties are not
245+compelled to copy the source along with the object code.
246+\f
247+ 4. You may not copy, modify, sublicense, or distribute the Program
248+except as expressly provided under this License. Any attempt
249+otherwise to copy, modify, sublicense or distribute the Program is
250+void, and will automatically terminate your rights under this License.
251+However, parties who have received copies, or rights, from you under
252+this License will not have their licenses terminated so long as such
253+parties remain in full compliance.
254+
255+ 5. You are not required to accept this License, since you have not
256+signed it. However, nothing else grants you permission to modify or
257+distribute the Program or its derivative works. These actions are
258+prohibited by law if you do not accept this License. Therefore, by
259+modifying or distributing the Program (or any work based on the
260+Program), you indicate your acceptance of this License to do so, and
261+all its terms and conditions for copying, distributing or modifying
262+the Program or works based on it.
263+
264+ 6. Each time you redistribute the Program (or any work based on the
265+Program), the recipient automatically receives a license from the
266+original licensor to copy, distribute or modify the Program subject to
267+these terms and conditions. You may not impose any further
268+restrictions on the recipients' exercise of the rights granted herein.
269+You are not responsible for enforcing compliance by third parties to
270+this License.
271+
272+ 7. If, as a consequence of a court judgment or allegation of patent
273+infringement or for any other reason (not limited to patent issues),
274+conditions are imposed on you (whether by court order, agreement or
275+otherwise) that contradict the conditions of this License, they do not
276+excuse you from the conditions of this License. If you cannot
277+distribute so as to satisfy simultaneously your obligations under this
278+License and any other pertinent obligations, then as a consequence you
279+may not distribute the Program at all. For example, if a patent
280+license would not permit royalty-free redistribution of the Program by
281+all those who receive copies directly or indirectly through you, then
282+the only way you could satisfy both it and this License would be to
283+refrain entirely from distribution of the Program.
284+
285+If any portion of this section is held invalid or unenforceable under
286+any particular circumstance, the balance of the section is intended to
287+apply and the section as a whole is intended to apply in other
288+circumstances.
289+
290+It is not the purpose of this section to induce you to infringe any
291+patents or other property right claims or to contest validity of any
292+such claims; this section has the sole purpose of protecting the
293+integrity of the free software distribution system, which is
294+implemented by public license practices. Many people have made
295+generous contributions to the wide range of software distributed
296+through that system in reliance on consistent application of that
297+system; it is up to the author/donor to decide if he or she is willing
298+to distribute software through any other system and a licensee cannot
299+impose that choice.
300+
301+This section is intended to make thoroughly clear what is believed to
302+be a consequence of the rest of this License.
303+\f
304+ 8. If the distribution and/or use of the Program is restricted in
305+certain countries either by patents or by copyrighted interfaces, the
306+original copyright holder who places the Program under this License
307+may add an explicit geographical distribution limitation excluding
308+those countries, so that distribution is permitted only in or among
309+countries not thus excluded. In such case, this License incorporates
310+the limitation as if written in the body of this License.
311+
312+ 9. The Free Software Foundation may publish revised and/or new versions
313+of the General Public License from time to time. Such new versions will
314+be similar in spirit to the present version, but may differ in detail to
315+address new problems or concerns.
316+
317+Each version is given a distinguishing version number. If the Program
318+specifies a version number of this License which applies to it and "any
319+later version", you have the option of following the terms and conditions
320+either of that version or of any later version published by the Free
321+Software Foundation. If the Program does not specify a version number of
322+this License, you may choose any version ever published by the Free Software
323+Foundation.
324+
325+ 10. If you wish to incorporate parts of the Program into other free
326+programs whose distribution conditions are different, write to the author
327+to ask for permission. For software which is copyrighted by the Free
328+Software Foundation, write to the Free Software Foundation; we sometimes
329+make exceptions for this. Our decision will be guided by the two goals
330+of preserving the free status of all derivatives of our free software and
331+of promoting the sharing and reuse of software generally.
332+
333+ NO WARRANTY
334+
335+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
336+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
337+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
338+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
339+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
340+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
341+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
342+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
343+REPAIR OR CORRECTION.
344+
345+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
346+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
347+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
348+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
349+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
350+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
351+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
352+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
353+POSSIBILITY OF SUCH DAMAGES.
354+
355+ END OF TERMS AND CONDITIONS
356+\f
357+ How to Apply These Terms to Your New Programs
358+
359+ If you develop a new program, and you want it to be of the greatest
360+possible use to the public, the best way to achieve this is to make it
361+free software which everyone can redistribute and change under these terms.
362+
363+ To do so, attach the following notices to the program. It is safest
364+to attach them to the start of each source file to most effectively
365+convey the exclusion of warranty; and each file should have at least
366+the "copyright" line and a pointer to where the full notice is found.
367+
368+ <one line to give the program's name and a brief idea of what it does.>
369+ Copyright (C) 19yy <name of author>
370+
371+ This program is free software; you can redistribute it and/or modify
372+ it under the terms of the GNU General Public License as published by
373+ the Free Software Foundation; either version 2 of the License, or
374+ (at your option) any later version.
375+
376+ This program is distributed in the hope that it will be useful,
377+ but WITHOUT ANY WARRANTY; without even the implied warranty of
378+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379+ GNU General Public License for more details.
380+
381+ You should have received a copy of the GNU General Public License
382+ along with this program; if not, write to the Free Software
383+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
384+
385+Also add information on how to contact you by electronic and paper mail.
386+
387+If the program is interactive, make it output a short notice like this
388+when it starts in an interactive mode:
389+
390+ Gnomovision version 69, Copyright (C) 19yy name of author
391+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
392+ This is free software, and you are welcome to redistribute it
393+ under certain conditions; type `show c' for details.
394+
395+The hypothetical commands `show w' and `show c' should show the appropriate
396+parts of the General Public License. Of course, the commands you use may
397+be called something other than `show w' and `show c'; they could even be
398+mouse-clicks or menu items--whatever suits your program.
399+
400+You should also get your employer (if you work as a programmer) or your
401+school, if any, to sign a "copyright disclaimer" for the program, if
402+necessary. Here is a sample; alter the names:
403+
404+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
405+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
406+
407+ <signature of Ty Coon>, 1 April 1989
408+ Ty Coon, President of Vice
409+
410+This General Public License does not permit incorporating your program into
411+proprietary programs. If your program is a subroutine library, you may
412+consider it more useful to permit linking proprietary applications with the
413+library. If this is what you want to do, use the GNU Library General
414+Public License instead of this License.
415diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/ChangeLog linux-2.2.18-pre2-beos/fs/beos/ChangeLog
416--- linux-2.2.18-pre2-clean/fs/beos/ChangeLog Wed Dec 31 18:00:00 1969
417+++ linux-2.2.18-pre2-beos/fs/beos/ChangeLog Sat Sep 2 12:57:10 2000
418@@ -0,0 +1,29 @@
419+2000-09-02
420+==========
421+o Fixed nls conversion routines and changed type of lookup function to
422+ dentry
423+
424+2000-08-16
425+==========
426+o Modified all to be called beos instead of bfs for future use with 2.4
427+ kernels.
428+o Mods to compile/work with 2.2.18-pre2 by Miles Lott <milos@insync.net>
429+
430+1999-05-25
431+==========
432+o Added BEOS(ppc) support.
433+o Added LinuxPPC support.
434+o Added nls (native language support).
435+o Fixed using blocksize other than 1024 bytes.
436+o Fixed memory leaks.
437+o Fixed many bugs.
438+
439+1999-02-21
440+==========
441+o Added mount option "uid" and "gid".
442+o Added symbolic link support.
443+o Fixed many bugs.
444+
445+1999-02-14
446+==========
447+o Release first alpha version.
448diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/Makefile linux-2.2.18-pre2-beos/fs/beos/Makefile
449--- linux-2.2.18-pre2-clean/fs/beos/Makefile Wed Dec 31 18:00:00 1969
450+++ linux-2.2.18-pre2-beos/fs/beos/Makefile Thu Aug 24 10:45:24 2000
451@@ -0,0 +1,15 @@
452+#
453+# Makefile for the linux BEOS-filesystem routines.
454+#
455+# Note! Dependencies are done automagically by 'make dep', which also
456+# removes any old dependencies. DON'T put your own dependencies here
457+# unless it's something special (ie not a .c file).
458+#
459+# Note 2! The CFLAGS definitions are now in the main makefile...
460+
461+O_TARGET := beos.o
462+O_OBJS := dir.o file.o inode.o namei.o super.o index.o debug.o symlink.o \
463+ util.o
464+M_OBJS := $(O_TARGET)
465+
466+include $(TOPDIR)/Rules.make
467diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/README linux-2.2.18-pre2-beos/fs/beos/README
468--- linux-2.2.18-pre2-clean/fs/beos/README Wed Dec 31 18:00:00 1969
469+++ linux-2.2.18-pre2-beos/fs/beos/README Thu Aug 24 10:45:24 2000
470@@ -0,0 +1,87 @@
471+BEOS filesystem for Linux 1999-05-28
472+
473+
474+WARNING
475+=======
476+Make sure you understand that this is alpha software. This means that the
477+implementation is neither complete nor well-tested. So using this driver,
478+by own risk.
479+
480+
481+WHAT'S THIS DRIVER
482+==================
483+This module is BEOS(filesystem of BeOS operating system) driver for Linux
484+2.2.x / 2.3.x. Current version supports BEOS(x86) and BEOS(ppc).
485+
486+
487+HOW TO INSTALL
488+==============
489+step 1. Install sources code to source code tree of linux.
490+
491+ i.e.
492+ cd /usr/src/linux
493+ tar ~/beos-YYYYMMDD.tar.gz
494+ patch -p1 < linux-2.2.x.patch
495+
496+step 2. Configuretion & make kernel
497+
498+ i.e.
499+ make config
500+ make dep; make clean
501+ make bzImage
502+ make modules
503+
504+ Note that at 'BEOS Filesystem support', you should answer y(es) ori
505+ m(odule). If you want to use other platform BEOS, you should answer
506+ y(es) aginst 'Other platform BEOS support'.
507+
508+step 3. Install
509+
510+ i.e.
511+ cp /usr/src/arch/i386/boot/zImage /vmlinuz
512+ make modules_install
513+
514+
515+USING BEOS
516+=========
517+To use the BEOS filesystem, use filesystem type 'beos'.
518+
519+ex)
520+ mount -t beos -o type=x86,iocharset=iso8859-1 /dev/fd0 /beos
521+
522+
523+MOUNT OPTIONS
524+=============
525+uid=nnn All files in the partition will be owned by user id nnn.
526+gid=nnn All files in the partition will be in group nnn.
527+type=nnn Set filesystem type. nnn is x86 or ppc. Default value is
528+ platform depends (linux-x86 is x86, linux-ppc is ppc).
529+iocharset=nnn charactor-set. But not support DBCS.
530+
531+
532+KNOWLEDGE ISSUE
533+===============
534+o Current implement supports read-only.
535+
536+
537+HOW TO GET LASTEST VERSION
538+==========================
539+The source and more information can be found in
540+
541+ http://hp.vector.co.jp/authors/VA008030/beos/
542+
543+
544+SPECIAL THANKS
545+==============
546+Dominic Giampalo ... writing "Practical file system design with Be file
547+ system"
548+Hiroyuki Yamada ... testing LinuxPPC.
549+
550+
551+AUTHOR
552+======
553+Makoto Kato <m_kato@ga2.so-net.ne.jp>
554+
555+MAINTAINER
556+==========
557+Miles Lott <milos@insync.net>
558diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/debug.c linux-2.2.18-pre2-beos/fs/beos/debug.c
559--- linux-2.2.18-pre2-clean/fs/beos/debug.c Wed Dec 31 18:00:00 1969
560+++ linux-2.2.18-pre2-beos/fs/beos/debug.c Sat Aug 26 09:53:07 2000
561@@ -0,0 +1,177 @@
562+/*
563+ * linux/fs/beos/debug.c
564+ *
565+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
566+ *
567+ * debug functions
568+ */
569+
570+#include <stdarg.h>
571+#include <linux/kernel.h>
572+#include <linux/fs.h>
573+//#include <linux/beos_fs.h>
574+
575+#ifdef BEOS_DEBUG
576+
577+
578+void beos_dump_inode (beos_inode * inode)
579+{
580+ int i, j;
581+
582+ printk (" beos_inode infomation\n");
583+
584+ for (i = 0; i < sizeof(beos_inode); i += 16) {
585+ printk (" %04x:", i);
586+ for (j = 0; j < 16; j++) {
587+ printk (" %02x", *(((char*) inode) + i + j) & 0xff);
588+ }
589+ printk ("\n");
590+ }
591+
592+ printk (" magic1 %08x\n", inode->magic1);
593+ printk (" inode_num %lu, %u %u\n", inode->inode_num.allocation_group,
594+ inode->inode_num.start, inode->inode_num.len);
595+ printk (" uid %lu\n", inode->uid);
596+ printk (" gid %lu\n", inode->gid);
597+ printk (" mode %08x\n", inode->mode);
598+ printk (" flags %08x\n", inode->flags);
599+ printk (" create_time %u\n", inode->create_time >> 8);
600+ printk (" last_modified_time %u\n", inode->last_modified_time >> 8);
601+ printk (" parent %lu, %u, %u\n", inode->parent.allocation_group,
602+ inode->parent.start, inode->parent.len);
603+ printk (" attributes %lu, %u, %u\n",
604+ inode->attributes.allocation_group,
605+ inode->attributes.start, inode->attributes.len);
606+ printk (" type %08x\n", inode->type);
607+ printk (" inode_size %lu\n", inode->inode_size);
608+
609+ if (S_ISLNK(inode->mode)) {
610+
611+ /*
612+ * This is symbolic link.
613+ */
614+
615+ printk (" Symbolic link [%s]\n", inode->data.symlink);
616+ } else {
617+ int i;
618+
619+ for (i = 0; i < BEOS_NUM_DIRECT_BLOCKS; i++) {
620+ printk (" direct %d [%lu, %u, %u]\n",
621+ inode->data.datastream.direct[i].allocation_group,
622+ inode->data.datastream.direct[i].start,
623+ inode->data.datastream.direct[i].len);
624+ }
625+ printk (" max_direct_range %Lu\n",
626+ inode->data.datastream.max_direct_range);
627+ printk (" indirect [%lu, %u, %u]\n",
628+ inode->data.datastream.indirect.allocation_group,
629+ inode->data.datastream.indirect.start,
630+ inode->data.datastream.indirect.len);
631+ printk (" max_indirect_range %016X\n",
632+ inode->data.datastream.max_indirect_range);
633+ printk (" double indirect [%lu, %u, %u]\n",
634+ inode->data.datastream.double_indirect.allocation_group,
635+ inode->data.datastream.double_indirect.start,
636+ inode->data.datastream.double_indirect.len);
637+ printk (" max_double_indirect_range %016X\n",
638+ inode->data.datastream.max_double_indirect_range);
639+ printk (" size %016X\n",
640+ inode->data.datastream.size);
641+ }
642+}
643+
644+
645+/*
646+ * Display super block structure for debug.
647+ */
648+
649+void beos_dump_super_block (beos_super_block * bs)
650+{
651+ int i, j;
652+
653+ printk (" beos_super_block information\n");
654+
655+ for (i = 0; i < sizeof(beos_super_block); i += 16) {
656+ printk (" %04x:", i);
657+ for (j = 0; j < 16; j++) {
658+ printk (" %02x", *(((char*) bs) + i + j) & 0xff);
659+ }
660+ printk ("\n");
661+ }
662+
663+ printk (" name %s\n", bs->name);
664+ printk (" magic1 %08x\n", bs->magic1);
665+ printk (" fs_byte_order %08x\n", bs->fs_byte_order);
666+
667+ printk (" block_size %lu\n", bs->block_size);
668+ printk (" block_shift %lu\n", bs->block_shift);
669+
670+ printk (" num_blocks %016X\n", bs->num_blocks);
671+ for (i = 0; i < sizeof(beos_off_t); i++) {
672+ printk( " %02x", *(((char*) &bs->num_blocks) + i) & 0xff);
673+ }
674+ printk ("\n used_blocks %016X\n", bs->used_blocks);
675+
676+ printk (" magic2 %08x\n", bs->magic2);
677+ printk (" blocks_per_ag %lu\n", bs->blocks_per_ag);
678+ printk (" ag_shift %lu\n", bs->ag_shift);
679+ printk (" num_ags %lu\n", bs->num_ags);
680+
681+ printk (" flags %08x\n", bs->flags);
682+
683+ printk (" log_blocks %lu, %u, %u\n",
684+ bs->log_blocks.allocation_group,
685+ bs->log_blocks.start, bs->log_blocks.len);
686+ printk (" log_start %Ld\n", bs->log_start);
687+ printk (" log_end %Ld\n", bs->log_end);
688+
689+ printk (" magic3 %08x\n", bs->magic3);
690+ printk (" root_dir %lu, %u, %u\n",
691+ bs->root_dir.allocation_group, bs->root_dir.start,
692+ bs->root_dir.len);
693+ printk (" indices %lu, %u, %u\n",
694+ bs->indices.allocation_group, bs->indices.start,
695+ bs->indices.len);
696+}
697+
698+
699+
700+void beos_dump_small_data (beos_small_data * sd)
701+{
702+}
703+
704+
705+
706+void beos_dump_inode_addr (beos_inode_addr iaddr)
707+{
708+ printk (" inode addr [%lu, %u, %u]\n",
709+ iaddr.allocation_group, iaddr.start, iaddr.len);
710+}
711+
712+
713+
714+void beos_dump_index_entry (beos_index_entry * entry)
715+{
716+ printk (" index entry structure\n");
717+ printk (" magic %08x\n", entry->magic);
718+ printk (" node_size %lu\n", entry->node_size);
719+ printk (" max_number_of_levels %08x\n",
720+ entry->max_number_of_levels);
721+ printk (" data_type %08x\n", entry->data_type);
722+ printk (" root_node_pointer %016X\n", entry->root_node_pointer);
723+ printk (" free_node_pointer %016X\n", entry->free_node_pointer);
724+ printk (" maximum size %016X\n", entry->maximum_size);
725+}
726+
727+
728+void beos_dump_index_node (beos_index_node * node)
729+{
730+ printk (" inode of index node structure\n");
731+ printk (" left %016X\n", node->left);
732+ printk (" right %016X\n", node->right);
733+ printk (" overflow %016X\n", node->overflow);
734+ printk (" all_key_count %u\n", node->all_key_count);
735+ printk (" all_key_length %u\n", node->all_key_length);
736+}
737+
738+#endif
739diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/dir.c linux-2.2.18-pre2-beos/fs/beos/dir.c
740--- linux-2.2.18-pre2-clean/fs/beos/dir.c Wed Dec 31 18:00:00 1969
741+++ linux-2.2.18-pre2-beos/fs/beos/dir.c Sat Sep 2 12:29:12 2000
742@@ -0,0 +1,222 @@
743+/*
744+ * linux/fs/beos/dir.c
745+ *
746+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
747+ *
748+ * from
749+ *
750+ * linux/fs/minix/dir.c
751+ *
752+ * Copyright (C) 1991, 1992 Linus Torvalds
753+ */
754+
755+#include <asm/uaccess.h>
756+
757+#include <linux/errno.h>
758+#include <linux/fs.h>
759+#include <linux/sched.h>
760+#include <linux/stat.h>
761+#include <linux/mm.h>
762+#include <linux/nls.h>
763+
764+
765+static ssize_t beos_dir_read (struct file * filp, char * buf, size_t count,
766+ loff_t *ppos)
767+{
768+ return -EISDIR;
769+}
770+
771+
772+static int beos_readdir(struct file *, void *, filldir_t);
773+
774+static struct file_operations beos_dir_operations = {
775+ NULL, /* lseek - default */
776+ beos_dir_read,
777+ NULL, /* write - bad */
778+ beos_readdir,
779+ NULL, /* poll - default */
780+ NULL, /* ioctl */
781+ NULL, /* mmap */
782+ NULL, /* no special open code */
783+ NULL, /* flush */
784+ NULL, /* no special release code */
785+ file_fsync,
786+ NULL, /* fasync */
787+ NULL, /* check_media_change */
788+ NULL /* revalidate */
789+};
790+
791+
792+/*
793+ * directories can handle most operations...
794+ */
795+
796+struct inode_operations beos_dir_inode_operations = {
797+ &beos_dir_operations, /* default directory file-ops */
798+ NULL, /* create */
799+ &beos_lookup, /* lookup */
800+ NULL, /* link */
801+ NULL, /* unlink */
802+ NULL, /* symlink */
803+ NULL, /* mkdir */
804+ NULL, /* rmdir */
805+ NULL, /* mknod */
806+ NULL, /* rename */
807+ NULL, /* readlink */
808+ NULL, /* follow_link */
809+ NULL, /* readpage */
810+ NULL, /* writepage */
811+ NULL, /* bmap */
812+ NULL, /* truncate */
813+ NULL, /* permission */
814+ NULL /* smap */
815+};
816+
817+
818+/*
819+ * description:
820+ * A directory structure of BEOS became index structure.
821+ *
822+ * struct beos_index_node
823+ * {
824+ * off_t left_link;
825+ * off_t right_link;
826+ * off_t overflow_link;
827+ * short all_node_count;
828+ * short all_key_length
829+ * byte key_data[all_key_length]
830+ * short key_index_count[all_node_count - 1]
831+ * off_t values[all_node_count]
832+ * }
833+ *
834+ * directry have above key.
835+ * [.] [..] [file and directry] ...
836+ */
837+
838+static int beos_readdir(struct file * filp, void * dirent, filldir_t filldir)
839+{
840+ struct inode * inode = filp->f_dentry->d_inode;
841+ struct super_block * sb = inode->i_sb;
842+ beos_inode_addr iaddr;
843+ char * tmpname;
844+ int error;
845+ int count = 0;
846+ int len;
847+ beos_data_stream * ds;
848+ int pos = 0;
849+
850+ BEOS_OUTPUT (("---> beos_readdir() "
851+ "inode %ld filp->f_pos %lu\n",
852+ inode->i_ino, filp->f_pos));
853+
854+ if (!inode || !S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
855+ return -EBADF;
856+
857+ tmpname = (char *) __getname();
858+ if (!tmpname)
859+ return -ENOMEM;
860+
861+ ds = &inode->u.beos_i.i_data.ds;
862+
863+ while (pos >= 0) {
864+
865+ struct buffer_head * bh;
866+ beos_index_node * bn;
867+ beos_off_t value;
868+ int flags;
869+ int k;
870+ beos_off_t offset;
871+ char * tmpname2;
872+ int len_dist;
873+
874+ if (pos)
875+ flags = 1;
876+ else
877+ flags = 0;
878+
879+ iaddr = beos_read_data_stream (sb, ds, &pos);
880+ if (!pos || BEOS_IS_EMPTY_IADDR(&iaddr))
881+ break;
882+
883+ /*
884+ * read index node
885+ */
886+
887+ bh = beos_read_index_node (iaddr, sb, flags, &offset);
888+ if (!bh) {
889+
890+ BEOS_OUTPUT (("<--- beos_readdir() "
891+ "cannot read index node\n"));
892+ return -EBADF;
893+
894+ }
895+
896+ bn = (beos_index_node *) (bh->b_data + offset);
897+ BEOS_DUMP_INDEX_NODE (bn);
898+
899+ /*
900+ * Is there no directry key in this index node?
901+ */
902+
903+ if (bn->all_key_count + count <= filp->f_pos) {
904+
905+ /*
906+ * Not exist
907+ */
908+
909+ BEOS_OUTPUT (("key not exist. next...\n"));
910+ count += bn->all_key_count;
911+ brelse (bh);
912+ continue;
913+
914+ }
915+
916+ k = filp->f_pos - count;
917+
918+ /*
919+ * search key
920+ */
921+
922+ if (!beos_get_key_from_index_node (bn, &k,
923+ sb->u.beos_sb.mount_opts.beos_type, tmpname, &len,
924+ &value)) {
925+
926+ putname (tmpname);
927+ brelse (bh);
928+
929+ return -EBADF;
930+ }
931+
932+ /*
933+ * Convert UTF-8 to nls charset
934+ */
935+
936+ if (!beos_utf2nls (tmpname, len, &tmpname2, &len_dist, sb)) {
937+ putname (tmpname);
938+ brelse (bh);
939+
940+ return -ENOMEM;
941+ }
942+ error = filldir (dirent, tmpname2, len_dist, filp->f_pos,
943+ (ino_t) value);
944+ putname (tmpname2);
945+
946+ if (error)
947+ filp->f_pos = 0;
948+ else
949+ filp->f_pos++;
950+
951+ brelse (bh);
952+
953+ goto finish;
954+ }
955+
956+ filp->f_pos = 0;
957+finish:
958+ putname (tmpname);
959+
960+ BEOS_OUTPUT (("<--- beos_readdir() filp->f_pos %d\n",
961+ filp->f_pos));
962+
963+ return 0;
964+}
965diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/file.c linux-2.2.18-pre2-beos/fs/beos/file.c
966--- linux-2.2.18-pre2-clean/fs/beos/file.c Wed Dec 31 18:00:00 1969
967+++ linux-2.2.18-pre2-beos/fs/beos/file.c Thu Aug 24 10:45:24 2000
968@@ -0,0 +1,452 @@
969+/*
970+ * linux/fs/beos/file.c
971+ *
972+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
973+ *
974+ * from
975+ *
976+ * linux/fs/minix/file.c
977+ *
978+ * Copyright (C) 1991, 1992 Linus Torvalds
979+ */
980+
981+#include <asm/uaccess.h>
982+#include <asm/system.h>
983+
984+#include <linux/errno.h>
985+#include <linux/fs.h>
986+#include <linux/beos_fs.h>
987+#include <linux/fcntl.h>
988+#include <linux/sched.h>
989+#include <linux/stat.h>
990+#include <linux/locks.h>
991+#include <linux/mm.h>
992+#include <linux/pagemap.h>
993+
994+
995+ssize_t beos_file_read (struct file *, char *, size_t, loff_t *);
996+static beos_inode_addr beos_startpos_from_ds (struct super_block *,
997+ beos_data_stream *, off_t);
998+static int beos_read_indirect_block (struct super_block *, const beos_inode_addr,
999+ const int, beos_inode_addr *);
1000+static int beos_read_double_indirect_block (struct super_block *,
1001+ const beos_inode_addr, const int, beos_inode_addr *);
1002+static ssize_t beos_file_write (struct file *, const char *, size_t, loff_t *);
1003+
1004+
1005+static struct file_operations beos_file_ops =
1006+{
1007+ NULL, /* lseek */
1008+ beos_file_read,
1009+#ifdef CONFIG_BEOS_FS_RW
1010+ beos_file_write,
1011+#else
1012+ NULL,
1013+#endif
1014+ NULL, /* readdir - bad */
1015+ NULL, /* poll - default */
1016+ NULL, /* ioctl - default */
1017+ generic_file_mmap,
1018+ NULL,
1019+ NULL, /* flush */
1020+ NULL, /* release */
1021+ file_fsync,
1022+};
1023+
1024+struct inode_operations beos_file_inode_operations =
1025+{
1026+ &beos_file_ops, /* default file operations */
1027+ NULL, /* create */
1028+ NULL, /* lookup */
1029+ NULL, /* link */
1030+ NULL, /* unlink */
1031+ NULL, /* symlink */
1032+ NULL, /* mkdir */
1033+ NULL, /* rmdir */
1034+ NULL, /* mknod */
1035+ NULL, /* rename */
1036+ NULL, /* readlink */
1037+ NULL, /* follow_link */
1038+ generic_readpage, /* readpage */
1039+ NULL, /* writepage */
1040+ &beos_bmap, /* bmap */
1041+ NULL, /* truncate */
1042+ NULL, /* permission */
1043+ NULL /* smap */
1044+};
1045+
1046+
1047+ssize_t beos_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
1048+{
1049+ struct inode * inode = filp->f_dentry->d_inode;
1050+ struct super_block * sb = inode->i_sb;
1051+ beos_data_stream * ds = &inode->u.beos_i.i_data.ds;
1052+ beos_inode_addr iaddr;
1053+ beos_inode_addr iaddr2;
1054+ off_t pos = *ppos;
1055+ off_t sum = 0;
1056+ int i;
1057+ int j;
1058+ off_t read_count;
1059+ off_t offset;
1060+
1061+ BEOS_OUTPUT (("---> beos_file_read() "
1062+ "inode %lu count %lu ppos %Lu\n",
1063+ inode->i_ino, (__u32) count, *ppos));
1064+
1065+ /*
1066+ * Get start position
1067+ */
1068+
1069+ for (i = 0; ;) {
1070+ iaddr = beos_read_data_stream (sb, ds, &i);
1071+ if (BEOS_IS_EMPTY_IADDR(&iaddr)) {
1072+ BEOS_OUTPUT ((" end data_stream\n"));
1073+ break;
1074+ }
1075+
1076+ if ((pos >= sum)
1077+ && (pos < sum + iaddr.len * sb->u.beos_sb.block_size)) {
1078+
1079+ iaddr.start += (pos - sum) / sb->u.beos_sb.block_size;
1080+ iaddr.len -= (pos - sum) / sb->u.beos_sb.block_size;
1081+ break;
1082+ }
1083+ sum += iaddr.len * sb->u.beos_sb.block_size;
1084+ }
1085+
1086+ read_count = 0;
1087+ offset = (pos - sum) % sb->u.beos_sb.block_size;
1088+ iaddr2 = iaddr;
1089+
1090+ count = inode->i_size > pos + count ? count : inode->i_size - pos;
1091+
1092+ for ( j = 0; j < iaddr.len; j++) {
1093+
1094+ struct buffer_head * bh;
1095+
1096+ bh = beos_bread2 (sb, iaddr2);
1097+ if (!bh)
1098+ return -EBADF;
1099+
1100+ BEOS_OUTPUT ((" read_count %Ld offset %Ld\n",
1101+ read_count, offset));
1102+
1103+ if (count > sb->u.beos_sb.block_size) {
1104+
1105+ memcpy (buf + read_count, bh->b_data + offset,
1106+ sb->u.beos_sb.block_size - offset);
1107+
1108+ *ppos += sb->u.beos_sb.block_size - offset;
1109+ count -= sb->u.beos_sb.block_size - offset;
1110+ read_count += sb->u.beos_sb.block_size - offset;
1111+ offset = 0;
1112+
1113+ iaddr2.start += 1;
1114+
1115+ brelse (bh);
1116+
1117+ } else {
1118+
1119+ memcpy (buf + read_count, bh->b_data + offset, count);
1120+
1121+ *ppos += count;
1122+ read_count += count;
1123+
1124+ brelse (bh);
1125+ break;
1126+ }
1127+ }
1128+
1129+ ppos += read_count;
1130+
1131+ BEOS_OUTPUT (("<--- beos_file_read() "
1132+ "return value %d, ppos %Ld\n", read_count, *ppos));
1133+
1134+ return read_count;
1135+}
1136+
1137+/*
1138+ * Read indirect block
1139+ */
1140+
1141+static int beos_read_indirect_block (struct super_block * sb,
1142+ const beos_inode_addr indirect, const int pos,
1143+ beos_inode_addr * iaddr)
1144+{
1145+ beos_inode_addr * array;
1146+ struct buffer_head * bh;
1147+ beos_inode_addr addr = indirect;
1148+ int p = pos;
1149+
1150+ BEOS_OUTPUT (("---> beos_read_indirect_block()\n"));
1151+
1152+ /*
1153+ * explore nessealy block
1154+ */
1155+
1156+ addr.start += p / BEOS_BLOCK_PER_INODE(sb);
1157+ addr.len -= p / BEOS_BLOCK_PER_INODE(sb);
1158+
1159+ if (addr.len < 1) {
1160+ goto error;
1161+ }
1162+
1163+ p = p % BEOS_BLOCK_PER_INODE(sb);
1164+
1165+ bh = beos_bread2 (sb, addr);
1166+ if (!bh) {
1167+ goto error;
1168+ }
1169+
1170+ array = (beos_inode_addr *) bh->b_data;
1171+
1172+ /*
1173+ * Is this block inode address??
1174+ */
1175+
1176+ if (!BEOS_IS_EMPTY_IADDR(&array[p % BEOS_BLOCK_PER_INODE(sb)])) {
1177+ *iaddr = array[p % BEOS_BLOCK_PER_INODE(sb)];
1178+ } else {
1179+ brelse (bh);
1180+ goto error;
1181+ }
1182+
1183+ brelse (bh);
1184+
1185+ BEOS_OUTPUT (("<--- beos_read_indirect_block()\n"));
1186+
1187+ return 0;
1188+
1189+error:
1190+ printk ("BEOS: cannot read indirect block\n");
1191+ return -EBADF;
1192+}
1193+
1194+/*
1195+ * beos_read_double_indirect_block
1196+ *
1197+ * description:
1198+ * Read double-indirect block
1199+ *
1200+ * parameter:
1201+ * sb ... super block
1202+ * double_indirect ... inode address of double-indirect block
1203+ * pos ... position of double-indirect block
1204+ * (*pos - max_direct_block - max_indirect_block)
1205+ *
1206+ * return value:
1207+ * 0 ... sucess
1208+ */
1209+
1210+static int beos_read_double_indirect_block (struct super_block * sb,
1211+ const beos_inode_addr double_indirect, const int pos,
1212+ beos_inode_addr * iaddr)
1213+{
1214+ struct buffer_head * bh_indirect;
1215+ int p = pos;
1216+ beos_inode_addr * indirects;
1217+ beos_inode_addr addr = double_indirect;
1218+ int i;
1219+
1220+ BEOS_OUTPUT (("---> beos_read_double_indirect_block() \n"));
1221+
1222+ while (addr.len) {
1223+ bh_indirect = beos_bread2 (sb, addr);
1224+
1225+ if (!bh_indirect) {
1226+ BEOS_OUTPUT (("cannot read double-indirect block "
1227+ "[%lu, %u, %u]\n",
1228+ double_indirect.allocation_group,
1229+ double_indirect.start, double_indirect.len));
1230+ return -EBADF;
1231+ }
1232+
1233+ addr.start++;
1234+ addr.len--;
1235+
1236+ indirects = (beos_inode_addr *) bh_indirect->b_data;
1237+
1238+ for (i = 0; i < BEOS_BLOCK_PER_INODE(sb); i++) {
1239+
1240+ if (p < indirects[i].len * BEOS_BLOCK_PER_INODE(sb)) {
1241+
1242+ /*
1243+ * find block!
1244+ */
1245+
1246+ int err;
1247+
1248+ err = beos_read_indirect_block (sb,
1249+ indirects[i], p, iaddr);
1250+ brelse (bh_indirect);
1251+
1252+ return err;
1253+ }
1254+
1255+ p -= indirects[i].len * BEOS_BLOCK_PER_INODE(sb);
1256+ }
1257+
1258+ brelse(bh_indirect);
1259+ }
1260+
1261+ /*
1262+ * cannot find block...
1263+ */
1264+
1265+ BEOS_OUTPUT (("cannot find block...\n"));
1266+
1267+ return -EIO;
1268+}
1269+
1270+
1271+beos_inode_addr beos_read_data_stream (struct super_block * sb,
1272+ beos_data_stream * ds, int * pos)
1273+{
1274+ beos_inode_addr iaddr = {0, 0, 0};
1275+
1276+ BEOS_OUTPUT (("---> beos_read_data_stream() "
1277+ "pos %d\n", *pos));
1278+
1279+ if( *pos < 0 )
1280+ return iaddr;
1281+
1282+ if (*pos < ds->max_direct_range) {
1283+
1284+ /*
1285+ * This position is in direct block.
1286+ */
1287+
1288+ BEOS_OUTPUT ((" read in direct block [%lu, %u, %u]\n",
1289+ ds->direct[*pos].allocation_group,
1290+ ds->direct[*pos].start, ds->direct[*pos].len));
1291+
1292+ /*
1293+ * Is this block inode address??
1294+ */
1295+
1296+ if (!BEOS_IS_EMPTY_IADDR(&ds->direct[*pos])) {
1297+ iaddr = ds->direct[(*pos)++];
1298+ }
1299+ } else if (*pos < ds->max_indirect_range + ds->max_direct_range) {
1300+
1301+ /*
1302+ * This position is in in-direct block.
1303+ */
1304+
1305+ int p = *pos - ds->max_direct_range;
1306+
1307+ BEOS_OUTPUT ((" read in indirect block [%lu, %u, %u]\n",
1308+ ds->indirect.allocation_group, ds->indirect.start,
1309+ ds->indirect.len));
1310+
1311+ if (!beos_read_indirect_block (sb, ds->indirect, p, &iaddr)) {
1312+ (*pos)++;
1313+ }
1314+ } else if (*pos < ds->max_double_indirect_range
1315+ + ds->max_direct_range + ds->max_indirect_range) {
1316+
1317+ /*
1318+ * This position is in double-in-direct block.
1319+ */
1320+
1321+ int p = *pos - ds->max_direct_range - ds->max_indirect_range;
1322+
1323+ BEOS_OUTPUT ((" read in double indirect block\n"));
1324+
1325+ if (!beos_read_double_indirect_block (sb, ds->double_indirect,
1326+ p, &iaddr)) {
1327+
1328+ (*pos)++;
1329+ }
1330+ } else {
1331+ /*
1332+ * out of range block
1333+ */
1334+ }
1335+
1336+ if (BEOS_IS_EMPTY_IADDR(&iaddr))
1337+ *pos = 0;
1338+
1339+ return iaddr;
1340+}
1341+
1342+/*
1343+ * Get inode address of start position form data stream
1344+ */
1345+
1346+static beos_inode_addr beos_startpos_from_ds (struct super_block * sb,
1347+ beos_data_stream * ds, off_t pos)
1348+{
1349+ beos_inode_addr iaddr;
1350+ off_t sum = 0;
1351+ int i = 0;
1352+
1353+ BEOS_OUTPUT (("---> beos_startpos_from_ds()\n"));
1354+
1355+ /*
1356+ * Get start position
1357+ */
1358+
1359+ while(1) {
1360+ iaddr = beos_read_data_stream (sb, ds, &i);
1361+ if (BEOS_IS_EMPTY_IADDR(&iaddr)) {
1362+ BEOS_OUTPUT ((" end data_stream\n"));
1363+ break;
1364+ }
1365+
1366+ if ((pos >= sum)
1367+ && (pos < sum + iaddr.len * sb->u.beos_sb.block_size)) {
1368+ iaddr.start += (pos - sum) / sb->u.beos_sb.block_size;
1369+ iaddr.len -= (pos - sum) / sb->u.beos_sb.block_size;
1370+ break;
1371+ }
1372+ sum += iaddr.len * sb->u.beos_sb.block_size;
1373+ }
1374+
1375+ BEOS_OUTPUT (("<--- beos_startpos_from_ds()\n"));
1376+
1377+ return iaddr;
1378+}
1379+
1380+#ifdef CONFIG_BEOS_RW
1381+static ssize_t beos_file_write (struct file * filp, const char * buf,
1382+ size_t count, loff_t *ppos)
1383+{
1384+ struct inode * inode = filp->f_dentry->d_inode;
1385+ struct super_block * sb;
1386+// struct buffer_head * bh;
1387+ beos_data_stream * ds;
1388+ beos_inode_addr iaddr;
1389+ loff_t pos;
1390+ ssize_t written;
1391+
1392+ if (!inode) {
1393+ return -EINVAL;
1394+ }
1395+
1396+ if (!S_ISREG(inode->i_mode)) {
1397+ return -EINVAL;
1398+ }
1399+
1400+ sb = inode->i_sb;
1401+ ds = &inode->u.beos_i.i_data.ds;
1402+
1403+ if (filp->f_flags & O_APPEND)
1404+ pos = inode->i_size;
1405+ else
1406+ pos = *ppos;
1407+
1408+ iaddr = beos_startpos_from_ds (sb, ds, pos);
1409+ written = 0;
1410+
1411+ if (pos > inode->i_size)
1412+ inode->i_size = pos;
1413+
1414+ inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1415+ *ppos = pos;
1416+ mark_inode_dirty(inode);
1417+
1418+ return written;
1419+}
1420+#endif
1421diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/index.c linux-2.2.18-pre2-beos/fs/beos/index.c
1422--- linux-2.2.18-pre2-clean/fs/beos/index.c Wed Dec 31 18:00:00 1969
1423+++ linux-2.2.18-pre2-beos/fs/beos/index.c Mon Aug 28 18:20:44 2000
1424@@ -0,0 +1,321 @@
1425+/*
1426+ * linux/beos/fs/index.c
1427+ *
1428+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
1429+ *
1430+ *
1431+ * Index functions for BEOS.
1432+ */
1433+
1434+#include <asm/uaccess.h>
1435+
1436+#include <linux/errno.h>
1437+#include <linux/fs.h>
1438+#include <linux/sched.h>
1439+#include <linux/stat.h>
1440+#include <linux/mm.h>
1441+#include <linux/slab.h>
1442+
1443+
1444+static void beos_convert_index_entry (int, beos_index_entry *, beos_index_entry *);
1445+static void beos_convert_index_node (int, beos_index_node *, beos_index_node *);
1446+
1447+/*
1448+ * Convert little-edian and big-edian.
1449+ */
1450+
1451+static void beos_convert_index_entry (int fstype, beos_index_entry * entry,
1452+ beos_index_entry * out)
1453+{
1454+ switch (fstype)
1455+ {
1456+ case BEOS_X86:
1457+ out->magic = le32_to_cpu(entry->magic);
1458+ out->node_size = le32_to_cpu(entry->node_size);
1459+ out->max_number_of_levels =
1460+ le32_to_cpu(entry->max_number_of_levels);
1461+ out->data_type = le32_to_cpu(entry->data_type);
1462+ out->root_node_pointer =
1463+ le64_to_cpu(entry->root_node_pointer);
1464+ out->free_node_pointer =
1465+ le64_to_cpu(entry->free_node_pointer);
1466+ out->maximum_size = le64_to_cpu(entry->maximum_size);
1467+ break;
1468+
1469+ case BEOS_PPC:
1470+ out->magic = be32_to_cpu(entry->magic);
1471+ out->node_size = be32_to_cpu(entry->node_size);
1472+ out->max_number_of_levels =
1473+ be32_to_cpu(entry->max_number_of_levels);
1474+ out->data_type = be32_to_cpu(entry->data_type);
1475+ out->root_node_pointer =
1476+ be64_to_cpu(entry->root_node_pointer);
1477+ out->free_node_pointer =
1478+ be64_to_cpu(entry->free_node_pointer);
1479+ out->maximum_size = be64_to_cpu(entry->maximum_size);
1480+ break;
1481+ }
1482+}
1483+
1484+
1485+static void beos_convert_index_node (int fstype, beos_index_node * node,
1486+ beos_index_node * out)
1487+{
1488+ switch (fstype)
1489+ {
1490+ case BEOS_X86:
1491+ out->left = le64_to_cpu (node->left);
1492+ out->right = le64_to_cpu (node->right);
1493+ out->overflow = le64_to_cpu (node->overflow);
1494+ out->all_key_count = le16_to_cpu (node->all_key_count);
1495+ out->all_key_length = le16_to_cpu (node->all_key_length);
1496+ break;
1497+
1498+ case BEOS_PPC:
1499+ out->left = be64_to_cpu (node->left);
1500+ out->right = be64_to_cpu (node->right);
1501+ out->overflow = be64_to_cpu (node->overflow);
1502+ out->all_key_count = be16_to_cpu (node->all_key_count);
1503+ out->all_key_length = be16_to_cpu (node->all_key_length);
1504+ break;
1505+ }
1506+}
1507+
1508+
1509+/*
1510+ * beos_read_index_node
1511+ *
1512+ * description:
1513+ * read index node from inode.
1514+ *
1515+ * parameter:
1516+ * inode ... address of index node
1517+ * sb ... super block
1518+ * flags ... 0 ... inode is index entry
1519+ * 1 ... inode is index node
1520+ * offset ... offset into index address
1521+ */
1522+
1523+struct buffer_head * beos_read_index_node (beos_inode_addr inode,
1524+ struct super_block * sb, int flags, beos_off_t * offset)
1525+{
1526+ struct buffer_head * bh;
1527+ beos_inode_addr iaddr;
1528+ beos_index_entry * entry;
1529+
1530+ BEOS_OUTPUT (("---> beos_read_index_node() "
1531+ "index [%lu, %u, %u]\n",
1532+ inode.allocation_group, inode.start, inode.len));
1533+
1534+ if (!flags) {
1535+
1536+ /*
1537+ * read index entry
1538+ */
1539+
1540+ bh = beos_bread2 (sb, inode);
1541+ if (!bh) {
1542+ printk (KERN_ERR "BEOS: cannot read index entry.\n");
1543+ return NULL;
1544+ }
1545+#ifndef CONFIG_BEOS_CONV
1546+ entry = (beos_index_entry *) bh->b_data;
1547+#else
1548+ entry = (beos_index_entry *) __getname();;
1549+ if (!entry) {
1550+ printk (KERN_ERR "BEOS: cannot allocate memory\n");
1551+ return NULL;
1552+ }
1553+
1554+ /*
1555+ * Convert little-edian and big-edian.
1556+ */
1557+
1558+ beos_convert_index_entry (sb->u.beos_sb.mount_opts.beos_type,
1559+ (beos_index_entry *) bh->b_data, entry);
1560+#endif
1561+ BEOS_DUMP_INDEX_ENTRY (entry);
1562+
1563+ /*
1564+ * check magic header
1565+ */
1566+
1567+ if (entry->magic != BEOS_INDEX_MAGIC) {
1568+
1569+ /*
1570+ * bad magic header
1571+ */
1572+
1573+ printk (KERN_ERR "BEOS: "
1574+ "magic header of index entry is bad value.\n");
1575+#ifdef CONFIG_BEOS_CONV
1576+ putname (entry);
1577+#endif
1578+ brelse(bh);
1579+
1580+ return NULL;
1581+ }
1582+
1583+ /*
1584+ * set index entry postion
1585+ */
1586+
1587+ *offset = 0;
1588+ iaddr = inode;
1589+ if (entry->node_size < sb->u.beos_sb.block_size) {
1590+
1591+ /*
1592+ * exist index node into index entry's block
1593+ */
1594+
1595+ *offset = entry->node_size;
1596+
1597+ } else {
1598+
1599+ iaddr.start += entry->node_size / sb->u.beos_sb.block_size;
1600+ iaddr.len -= entry->node_size / sb->u.beos_sb.block_size;
1601+ *offset = entry->node_size % sb->u.beos_sb.block_size;
1602+
1603+ }
1604+
1605+#ifdef CONFIG_BEOS_CONV
1606+ putname (entry);
1607+#endif
1608+ brelse(bh);
1609+
1610+ } else {
1611+ BEOS_OUTPUT ((" skip index node\n"));
1612+ iaddr = inode;
1613+ }
1614+
1615+ BEOS_OUTPUT ((" inode of index node\n"));
1616+ BEOS_DUMP_INODE_ADDR (iaddr);
1617+
1618+ bh = beos_bread2 (sb, iaddr);
1619+ if (!bh) {
1620+ return NULL;
1621+ }
1622+
1623+ BEOS_OUTPUT (("<--- beos_read_index_node() offset = %016x\n", *offset));
1624+
1625+ return bh;
1626+}
1627+
1628+
1629+/*
1630+ * beos_get_key_from_index_node
1631+ *
1632+ * description:
1633+ * Get key form index node
1634+ *
1635+ * parameter:
1636+ * bn ... index node structure
1637+ * pos ... key position
1638+ * fstype ... filesystem type
1639+ * name ... keyname return
1640+ * len ... length of keyname return.
1641+ * iaddr ... key valude return.
1642+ */
1643+
1644+char * beos_get_key_from_index_node (beos_index_node * node, int *pos, int fstype,
1645+ char * name, int * len, beos_off_t * iaddr)
1646+{
1647+ char * key;
1648+ __u16 * key_array;
1649+ beos_off_t * key_value;
1650+ int key_offset;
1651+ char * namep = NULL;
1652+ beos_index_node * bn;
1653+
1654+ BEOS_OUTPUT (("---> beos_get_key_from_index_node() "
1655+ "pos %d\n", *pos));
1656+
1657+ /*
1658+ * Convert little-edian and big-edian.
1659+ */
1660+#ifndef CONFIG_BEOS_CONV
1661+ bn = node;
1662+#else
1663+ bn = (beos_index_node *) __getname();
1664+ beos_convert_index_node (fstype, node, bn);
1665+#endif
1666+
1667+ if (*pos < 0 || bn->all_key_count <= *pos) {
1668+ *pos = -1;
1669+ return NULL;
1670+ }
1671+
1672+ /*
1673+ * Only key_array, byte is 8byte...
1674+ */
1675+
1676+ key = (char*) node + sizeof(beos_index_node);
1677+ key_offset = (bn->all_key_length + sizeof(beos_index_node)) % 8;
1678+ key_array = (__u16 *) (key + bn->all_key_length
1679+ + (!key_offset ? 0 : 8 - key_offset));
1680+ key_value = (beos_inode_addr *) (((char *) key_array) + sizeof(__u16)
1681+ * bn->all_key_count);
1682+#ifdef BEOS_DEBUG
1683+ {
1684+ int j;
1685+ char key_test[4096];
1686+
1687+ memcpy (key_test, key, bn->all_key_length);
1688+ key_test[bn->all_key_length] = '\0';
1689+
1690+ BEOS_OUTPUT ((" key %08x key_array %08x key_value %08x\n",
1691+ (long) key, (long) key_array, (long) key_value));
1692+
1693+ BEOS_OUTPUT ((" key content %s\n", key_test));
1694+
1695+ for (j = 0; j < *pos; j++) {
1696+ BEOS_OUTPUT ((" key_array[%d] = %Ld ",
1697+ j, key_array[j]));
1698+ BEOS_OUTPUT (("key_value[%d] = %Ld\n", j, key_value[j]));
1699+ }
1700+ }
1701+#endif
1702+ switch (fstype)
1703+ {
1704+ case BEOS_X86:
1705+ if (*pos == 0) {
1706+ namep = key;
1707+ *len = le16_to_cpu(key_array[*pos]);
1708+ } else {
1709+ namep = key + le16_to_cpu(key_array[*pos - 1]);
1710+ *len = le16_to_cpu(key_array[*pos])
1711+ - le16_to_cpu(key_array[*pos - 1]);
1712+ }
1713+ *iaddr = le64_to_cpu(key_value[*pos]);
1714+ break;
1715+
1716+ case BEOS_PPC:
1717+ if (*pos == 0) {
1718+ namep = key;
1719+ *len = be16_to_cpu(key_array[*pos]);
1720+ } else {
1721+ namep = key + be16_to_cpu(key_array[*pos - 1]);
1722+ *len = be16_to_cpu(key_array[*pos])
1723+ - be16_to_cpu(key_array[*pos - 1]);
1724+ }
1725+ *iaddr = be64_to_cpu(key_value[*pos]);
1726+ break;
1727+ }
1728+
1729+ /*
1730+ * copy from namep to name
1731+ */
1732+
1733+ memcpy (name, namep, *len);
1734+ name[*len] = '\0';
1735+ (*pos)++;
1736+
1737+#ifdef CONFIG_BEOS_CONV
1738+ putname (bn);
1739+#endif
1740+
1741+ BEOS_OUTPUT (("<--- beos_get_key_from_index_node() "
1742+ "result key [%s], value %Lu\n", name, *iaddr));
1743+
1744+ return name;
1745+}
1746diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/inode.c linux-2.2.18-pre2-beos/fs/beos/inode.c
1747--- linux-2.2.18-pre2-clean/fs/beos/inode.c Wed Dec 31 18:00:00 1969
1748+++ linux-2.2.18-pre2-beos/fs/beos/inode.c Sun Aug 27 21:36:39 2000
1749@@ -0,0 +1,464 @@
1750+/*
1751+ * linux/fs/beos/inode.c
1752+ *
1753+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
1754+ *
1755+ * from
1756+ *
1757+ * linux/fs/minix/inode.c
1758+ *
1759+ * Copyright (C) 1991, 1992 Linus Torvalds
1760+ */
1761+
1762+#include <asm/uaccess.h>
1763+#include <asm/system.h>
1764+
1765+#include <linux/errno.h>
1766+#include <linux/fs.h>
1767+//#include <linux/beos_fs.h>
1768+#include <linux/beos_fs_sb.h>
1769+#include <linux/beos_fs_i.h>
1770+#include <linux/sched.h>
1771+#include <linux/stat.h>
1772+#include <linux/string.h>
1773+#include <linux/locks.h>
1774+#include <linux/mm.h>
1775+
1776+
1777+//static int beos_update_inode(struct inode *, int);
1778+
1779+/*
1780+ * return blocknumber
1781+ */
1782+
1783+int beos_bmap (struct inode * inode, int block)
1784+{
1785+ struct beos_sb_info bs = inode->i_sb->u.beos_sb;
1786+ struct beos_inode_info bi = inode->u.beos_i;
1787+
1788+ BEOS_OUTPUT (("---> Enter beos_bmap\n"));
1789+
1790+ BEOS_OUTPUT (("<--- Enter beos_bmap\n"));
1791+
1792+ return (bi.i_inode_num.allocation_group << bs.ag_shift)
1793+ + bi.i_inode_num.start;
1794+}
1795+
1796+
1797+/*
1798+ * beos_bread function
1799+ *
1800+ * get buffer_header for inode.
1801+ */
1802+
1803+struct buffer_head * beos_bread (struct inode * inode)
1804+{
1805+ beos_off_t offset;
1806+ struct super_block * sb = inode->i_sb;
1807+ dev_t dev = sb->s_dev;
1808+
1809+ BEOS_OUTPUT (("---> Enter beos_read "
1810+ "[%lu, %u, %u]\n",
1811+ inode->u.beos_i.i_inode_num.allocation_group,
1812+ inode->u.beos_i.i_inode_num.start,
1813+ inode->u.beos_i.i_inode_num.len));
1814+
1815+ offset = (inode->u.beos_i.i_inode_num.allocation_group
1816+ << sb->u.beos_sb.ag_shift) + inode->u.beos_i.i_inode_num.start;
1817+
1818+ BEOS_OUTPUT (("<--- Enter beos_read\n"));
1819+
1820+ return bread (dev, offset, sb->s_blocksize);
1821+}
1822+
1823+
1824+struct buffer_head * beos_bread2 (struct super_block * sb, beos_inode_addr inode)
1825+{
1826+ dev_t dev = sb->s_dev;
1827+ beos_off_t offset;
1828+
1829+ BEOS_OUTPUT (("---> Enter beos_read2 "
1830+ "[%lu, %u, %u]\n",
1831+ inode.allocation_group, inode.start, inode.len));
1832+
1833+ offset = (inode.allocation_group << sb->u.beos_sb.ag_shift)
1834+ + inode.start;
1835+
1836+ BEOS_OUTPUT (("<--- Enter beos_read2\n"));
1837+
1838+ return bread (dev, offset, sb->s_blocksize);
1839+}
1840+
1841+
1842+/*
1843+ * Convert little-endian and big-endian
1844+ */
1845+
1846+void beos_convert_inodeaddr (int fstype, beos_inode_addr * iaddr,
1847+ beos_inode_addr * out)
1848+{
1849+ switch (fstype)
1850+ {
1851+ case BEOS_X86:
1852+ out->allocation_group = le32_to_cpu(iaddr->allocation_group);
1853+ out->start = le16_to_cpu(iaddr->start);
1854+ out->len = le16_to_cpu(iaddr->len);
1855+ break;
1856+
1857+ case BEOS_PPC:
1858+ out->allocation_group = be32_to_cpu(iaddr->allocation_group);
1859+ out->start = be16_to_cpu(iaddr->start);
1860+ out->len = be16_to_cpu(iaddr->len);
1861+ break;
1862+ }
1863+}
1864+
1865+static void beos_convert_inode (int fstype, beos_inode *inode, beos_inode * out)
1866+{
1867+ int i;
1868+
1869+ /*
1870+ * Convert data stream.
1871+ */
1872+
1873+ switch (fstype)
1874+ {
1875+ case BEOS_X86:
1876+ out->magic1 = le32_to_cpu(inode->magic1);
1877+ beos_convert_inodeaddr (fstype, &inode->inode_num,
1878+ &out->inode_num);
1879+ out->uid = le32_to_cpu(inode->uid);
1880+ out->gid = le32_to_cpu(inode->gid);
1881+ out->mode = le32_to_cpu(inode->mode);
1882+ out->flags = le32_to_cpu(inode->flags);
1883+ out->create_time = le64_to_cpu(inode->create_time);
1884+ out->last_modified_time =
1885+ le64_to_cpu(inode->last_modified_time);
1886+ inode->type = le32_to_cpu(inode->type);
1887+ beos_convert_inodeaddr (fstype, &inode->parent, &out->parent);
1888+ beos_convert_inodeaddr (fstype, &inode->attributes, &out->attributes);
1889+ out->inode_size = le32_to_cpu(inode->inode_size);
1890+
1891+ if (!S_ISLNK((umode_t) out->mode)) {
1892+ /*
1893+ * Convert data stream.
1894+ */
1895+
1896+ for ( i = 0; i < BEOS_NUM_DIRECT_BLOCKS; i++) {
1897+ beos_convert_inodeaddr (fstype,
1898+ &inode->data.datastream.direct[i],
1899+ &out->data.datastream.direct[i]);
1900+ }
1901+ beos_convert_inodeaddr (fstype,
1902+ &inode->data.datastream.indirect,
1903+ &out->data.datastream.indirect);
1904+ beos_convert_inodeaddr (fstype,
1905+ &inode->data.datastream.double_indirect,
1906+ &out->data.datastream.double_indirect);
1907+
1908+ out->data.datastream.max_direct_range =
1909+ le64_to_cpu(inode->data.datastream.max_direct_range);
1910+ out->data.datastream.max_indirect_range =
1911+ le64_to_cpu(inode->data.datastream.max_indirect_range);
1912+ out->data.datastream.max_double_indirect_range =
1913+ le64_to_cpu(inode->data.datastream.max_double_indirect_range);
1914+ out->data.datastream.size =
1915+ le64_to_cpu(inode->data.datastream.size);
1916+ }
1917+ break;
1918+
1919+ case BEOS_PPC:
1920+ out->magic1 = be32_to_cpu(inode->magic1);
1921+ beos_convert_inodeaddr (fstype, &inode->inode_num, &out->inode_num);
1922+ out->uid = be32_to_cpu(inode->uid);
1923+ out->gid = be32_to_cpu(inode->gid);
1924+ out->mode = be32_to_cpu(inode->mode);
1925+ out->flags = be32_to_cpu(inode->flags);
1926+ out->create_time = be64_to_cpu(inode->create_time);
1927+ out->last_modified_time =
1928+ be64_to_cpu(inode->last_modified_time);
1929+ out->type = be32_to_cpu(inode->type);
1930+ beos_convert_inodeaddr (fstype, &inode->parent, &out->parent);
1931+ beos_convert_inodeaddr (fstype, &inode->attributes, &out->attributes);
1932+ out->inode_size = be32_to_cpu(inode->inode_size);
1933+
1934+ if (!S_ISLNK((umode_t) out->mode)) {
1935+
1936+ /*
1937+ * Convert data stream.
1938+ */
1939+
1940+ for ( i = 0; i < BEOS_NUM_DIRECT_BLOCKS; i++) {
1941+ beos_convert_inodeaddr (fstype,
1942+ &inode->data.datastream.direct[i],
1943+ &out->data.datastream.direct[i]);
1944+ }
1945+ beos_convert_inodeaddr (fstype,
1946+ &inode->data.datastream.indirect,
1947+ &out->data.datastream.indirect);
1948+ beos_convert_inodeaddr (fstype,
1949+ &inode->data.datastream.double_indirect,
1950+ &out->data.datastream.double_indirect);
1951+
1952+ out->data.datastream.max_direct_range =
1953+ be64_to_cpu(inode->data.datastream.max_direct_range);
1954+ out->data.datastream.max_indirect_range =
1955+ be64_to_cpu(inode->data.datastream.max_indirect_range);
1956+ out->data.datastream.max_double_indirect_range =
1957+ be64_to_cpu(inode->data.datastream.max_double_indirect_range);
1958+ out->data.datastream.size =
1959+ be64_to_cpu(inode->data.datastream.size);
1960+ }
1961+ break;
1962+ }
1963+}
1964+
1965+
1966+void beos_read_inode (struct inode * inode)
1967+{
1968+ struct buffer_head * bh = NULL;
1969+ beos_inode * raw_inode = NULL;
1970+ beos_inode * disk_inode;
1971+
1972+ int event = 0;
1973+
1974+ BEOS_OUTPUT (("---> beos_read_inode() "
1975+ "inode = %lu[%lu, %u, %u]\n",
1976+ inode->i_ino,
1977+ inode->u.beos_i.i_inode_num.allocation_group,
1978+ inode->u.beos_i.i_inode_num.start,
1979+ inode->u.beos_i.i_inode_num.len));
1980+
1981+ /*
1982+ * convert from vfs's inode number to beos's inode number
1983+ */
1984+
1985+ if (inode->i_ino != BEOS_INODE2INO(inode))
1986+ {
1987+ inode->u.beos_i.i_inode_num.allocation_group =
1988+ inode->i_ino >> inode->i_sb->u.beos_sb.ag_shift;
1989+ inode->u.beos_i.i_inode_num.start = inode->i_ino
1990+ & ((2 << inode->i_sb->u.beos_sb.ag_shift) - 1);
1991+ inode->u.beos_i.i_inode_num.len = 1; /* dummy */
1992+
1993+ BEOS_OUTPUT ((" real inode number [%lu, %u, %u]\n",
1994+ inode->u.beos_i.i_inode_num.allocation_group,
1995+ inode->u.beos_i.i_inode_num.start,
1996+ inode->u.beos_i.i_inode_num.len));
1997+ }
1998+
1999+ bh = beos_bread (inode);
2000+ if (!bh) {
2001+ printk (KERN_ERR "BEOS: unable to read inode block - inode = %lu",
2002+ inode->i_ino);
2003+ goto bad_inode;
2004+ }
2005+
2006+ disk_inode = (beos_inode *) bh->b_data;
2007+
2008+ /*
2009+ * Convert little-endian or big-endian from beos type.
2010+ */
2011+#ifdef CONFIG_BEOS_CONV
2012+ raw_inode = (beos_inode *) __getname();
2013+ if (!raw_inode) {
2014+ printk (KERN_ERR "BEOS: not allocate memory - inode = %lu",
2015+ inode->i_ino);
2016+ goto bad_inode;
2017+ }
2018+ beos_convert_inode (inode->i_sb->u.beos_sb.mount_opts.beos_type,
2019+ disk_inode, raw_inode);
2020+#else
2021+ raw_inode = disk_inode;
2022+#endif
2023+
2024+ BEOS_DUMP_INODE (raw_inode);
2025+
2026+ /*
2027+ * inode is current?
2028+ */
2029+ if (raw_inode->magic1 != BEOS_INODE_MAGIC1) {
2030+ printk (KERN_ERR
2031+ "BEOS: this inode is bad magic header - inode = %lu\n",
2032+ inode->i_ino);
2033+ goto bad_inode;
2034+ }
2035+#if 0
2036+ if (raw_inode->inode_num != inode->u.beos_i.i_inode_num) {
2037+ printk ("BEOS: huum... there is no inode.\n");
2038+ goto bad_inode;
2039+ }
2040+#endif
2041+
2042+ /*
2043+ * check flag
2044+ */
2045+
2046+ if (!(raw_inode->flags & BEOS_INODE_IN_USE)) {
2047+ printk (KERN_ERR "BEOS: inode is not used.\n");
2048+ goto bad_inode;
2049+ }
2050+
2051+ inode->i_mode = (umode_t) raw_inode->mode;
2052+
2053+ /*
2054+ * set uid and gid. But since current BeOS is single user OS, so
2055+ * you can change by "uid" or "gid" options.
2056+ */
2057+
2058+ inode->i_uid = inode->i_sb->u.beos_sb.mount_opts.uid ?
2059+ inode->i_sb->u.beos_sb.mount_opts.uid : (uid_t) raw_inode->uid;
2060+ inode->i_gid = inode->i_sb->u.beos_sb.mount_opts.gid ?
2061+ inode->i_sb->u.beos_sb.mount_opts.gid : (gid_t) raw_inode->gid;
2062+
2063+ inode->i_nlink = 1;
2064+
2065+ /*
2066+ * BEOS don't have access time. So use last modified time.
2067+ */
2068+
2069+ inode->i_atime = (time_t) (raw_inode->last_modified_time >> 16);
2070+
2071+ /*
2072+ * BEOS's time is 64 bits, but current VFS is 32 bits...
2073+ */
2074+
2075+ inode->i_ctime = (time_t) (raw_inode->create_time >> 16);
2076+ inode->i_mtime = (time_t) (raw_inode->last_modified_time >> 16);
2077+
2078+ inode->i_blksize = raw_inode->inode_size;
2079+
2080+ inode->i_blocks = raw_inode->inode_size / inode->i_sb->s_blocksize;
2081+ inode->i_version = ++event;
2082+ inode->u.beos_i.i_inode_num = (beos_inode_addr) raw_inode->inode_num;
2083+ inode->u.beos_i.i_mode = raw_inode->mode;
2084+ inode->u.beos_i.i_flags = raw_inode->flags;
2085+ inode->u.beos_i.i_create_time = raw_inode->create_time;
2086+ inode->u.beos_i.i_last_modified_time = raw_inode->last_modified_time;
2087+
2088+ inode->u.beos_i.i_parent = (beos_inode_addr) raw_inode->parent;
2089+ inode->u.beos_i.i_attribute = (beos_inode_addr) raw_inode->attributes;
2090+
2091+ /*
2092+ * Symbolic link have no data stream.
2093+ * This position is original filename.
2094+ */
2095+
2096+ if (!S_ISLNK(inode->i_mode)) {
2097+ inode->i_size = raw_inode->data.datastream.size;
2098+ inode->u.beos_i.i_data.ds = raw_inode->data.datastream;
2099+ } else {
2100+ inode->i_size = 0;
2101+ memcpy (inode->u.beos_i.i_data.symlink, disk_inode->data.symlink,
2102+ BEOS_SYMLINK_LEN);
2103+ }
2104+
2105+ if (S_ISREG(inode->i_mode))
2106+ inode->i_op = &beos_file_inode_operations;
2107+ else if (S_ISDIR(inode->i_mode))
2108+ inode->i_op = &beos_dir_inode_operations;
2109+ else if (S_ISLNK(inode->i_mode))
2110+ inode->i_op = &beos_symlink_inode_operations;
2111+ else if (S_ISCHR(inode->i_mode))
2112+ inode->i_op = &chrdev_inode_operations;
2113+ else if (S_ISBLK(inode->i_mode))
2114+ inode->i_op = &blkdev_inode_operations;
2115+ else if (S_ISFIFO(inode->i_mode))
2116+ init_fifo(inode);
2117+
2118+#ifdef CONFIG_BEOS_CONV
2119+ putname (raw_inode);
2120+#endif
2121+ brelse(bh);
2122+
2123+ return;
2124+
2125+bad_inode:
2126+ make_bad_inode(inode);
2127+#ifdef CONFIG_BEOS_CONV
2128+ if (raw_inode) {
2129+ putname (raw_inode);
2130+ }
2131+#endif
2132+ if (bh) {
2133+ brelse(bh);
2134+ }
2135+
2136+ return;
2137+}
2138+
2139+#ifdef CONFIG_BEOS_RW
2140+static int beos_update_inode(struct inode * inode, int do_sync)
2141+{
2142+ struct buffer_head * bh;
2143+ beos_inode * raw_inode;
2144+ int err = 0;
2145+
2146+ bh = beos_bread (inode);
2147+ if (!bh) {
2148+ printk(KERN_ERR "BEOS: "
2149+ "bad inode number on dev %s: %ld is out of range\n",
2150+ bdevname(inode->i_dev), inode->i_ino);
2151+ return -EIO;
2152+ }
2153+
2154+ raw_inode = (beos_inode *) bh->b_data;
2155+
2156+ /*
2157+ * fill raw_inode
2158+ */
2159+
2160+ raw_inode->magic1 = BEOS_INODE_MAGIC1;
2161+ raw_inode->inode_num = !IS_EMPTY_IADDR(&inode->u.beos_i.i_inode_num)
2162+ ? inode->u.beos_i.i_inode_num : 0;
2163+
2164+ raw_inode->uid = BEOS_DEFAULT_UID;
2165+ raw_inode->gid = BEOS_DEFAULT_GID;
2166+
2167+ raw_inode->mode = inode->i_mode;
2168+ raw_inode->flags = inode->u.beos_i.i_flags;
2169+
2170+ raw_inode->create_time = ((__u64) inode->i_ctime) << 16;
2171+ raw_inode->last_modified_time = ((__u64) inode->i_mtime) << 16;
2172+
2173+ raw_inode->parent = inode->u.beos_i.i_parent;
2174+ raw_inode->attributes = inode->u.beos_i.i_attribute;
2175+
2176+ raw_inode->type = inode->u.beos_i.i_type;
2177+
2178+ raw_inode->inode_size = inode->i_blksize;
2179+
2180+ if (!S_ISLNK(inode->i_mode))
2181+ raw_inode->data.datastream = inode->u.beos_i.i_data.ds;
2182+ else
2183+ memcpy (raw_inode->data.symlink, inode->u.beos_i.i_data.symlink,
2184+ BEOS_SYMLINK_LEN);
2185+
2186+ mark_buffer_dirty (bh, 1);
2187+
2188+ if (do_sync) {
2189+ ll_rw_block (WRITE, 1, &bh);
2190+ wait_on_buffer (bh);
2191+ if (buffer_req (bh) && !buffer_uptodate (bh)) {
2192+ printk (KERN_ERR "BEOS: "
2193+ "IO error syncing inode [%s: %08lx]\n",
2194+ bdevname(inode->i_dev), inode->i_ino);
2195+ err = -EIO;
2196+ }
2197+ }
2198+ brelse (bh);
2199+
2200+ return err;
2201+}
2202+
2203+
2204+void beos_write_inode (struct inode * inode)
2205+{
2206+ beos_update_inode (inode, 0);
2207+}
2208+
2209+int beos_sync_inode (struct inode *inode)
2210+{
2211+ return beos_update_inode (inode, 1);
2212+}
2213+#endif
2214diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/namei.c linux-2.2.18-pre2-beos/fs/beos/namei.c
2215--- linux-2.2.18-pre2-clean/fs/beos/namei.c Wed Dec 31 18:00:00 1969
2216+++ linux-2.2.18-pre2-beos/fs/beos/namei.c Sat Sep 2 12:26:55 2000
2217@@ -0,0 +1,301 @@
2218+/*
2219+ * linux/fs/beos/namei.c
2220+ *
2221+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
2222+ *
2223+ * from
2224+ *
2225+ * linux/fs/minix/namei.c
2226+ *
2227+ * Copyright (C) 1991, 1992 Linus Torvalds
2228+ */
2229+
2230+#include <asm/uaccess.h>
2231+
2232+#include <linux/errno.h>
2233+#include <linux/fs.h>
2234+#include <linux/fcntl.h>
2235+#include <linux/sched.h>
2236+#include <linux/stat.h>
2237+#include <linux/string.h>
2238+#include <linux/locks.h>
2239+#include <linux/quotaops.h>
2240+
2241+
2242+/*
2243+ * beos_find_entry
2244+ *
2245+ * description:
2246+ * find file or directory entry
2247+ *
2248+ * parameter:
2249+ * dir ... parent's inode
2250+ * name ... file or directry name
2251+ * namelen ... length of name
2252+ */
2253+
2254+static beos_off_t beos_find_entry (struct inode * dir, const char * const name,
2255+ int namelen)
2256+{
2257+ struct buffer_head * bh;
2258+ beos_index_node * bn;
2259+ struct super_block * sb = dir->i_sb;
2260+ int sd_pos = 0;
2261+ int key_pos;
2262+ char key[BEOS_NAME_LEN + 1];
2263+ int key_len;
2264+ beos_off_t value;
2265+
2266+ // BEOS_OUTPUT (
2267+ printk("BEOS ---> beos_find_entry()\n");
2268+
2269+ while (sd_pos >= 0)
2270+ {
2271+ beos_data_stream * ds = &dir->u.beos_i.i_data.ds;
2272+ beos_inode_addr iaddr;
2273+ int flags;
2274+ beos_off_t offset;
2275+
2276+ /*
2277+ * get index node from small_data.
2278+ *
2279+ * First data stream has index entry, but other than it,
2280+ * doesn't have it.
2281+ */
2282+
2283+ if (sd_pos)
2284+ flags = 1;
2285+ else
2286+ flags = 0;
2287+
2288+ iaddr = beos_read_data_stream (sb, ds, &sd_pos);
2289+ if (sd_pos <= 0)
2290+ {
2291+ /*
2292+ * cannot read next data stream
2293+ */
2294+
2295+ //BEOS_OUTPUT (
2296+ printk(
2297+ "BEOS <--- beos_find_entry() cannot read next data stream\n");
2298+ return 0;
2299+ }
2300+
2301+ bh = beos_read_index_node (iaddr, sb, flags, &offset);
2302+ if (!bh)
2303+ {
2304+ /*
2305+ * cannot read index node
2306+ */
2307+
2308+ //BEOS_OUTPUT (
2309+ printk(
2310+ "BEOS <--- beos_find_entry() cannot read index node\n");
2311+ return 0;
2312+ }
2313+
2314+ bn = (beos_index_node *) (bh->b_data + offset);
2315+
2316+ /*
2317+ * explore in this block
2318+ */
2319+
2320+ key_pos = 0;
2321+ while (key_pos >= 0)
2322+ {
2323+ beos_get_key_from_index_node (bn, &key_pos,
2324+ sb->u.beos_sb.mount_opts.beos_type, key,
2325+ &key_len, &value);
2326+ if (key_pos < 0)
2327+ {
2328+ //BEOS_OUTPUT (
2329+ printk("BEOS: key not exist in this block\n");
2330+ break;
2331+ }
2332+
2333+ if (!strcmp (key, name))
2334+ {
2335+ brelse (bh);
2336+ //BEOS_OUTPUT (
2337+ printk(
2338+ "BEOS <--- beos_find_entry() value = %Lu\n", value);
2339+ return value;
2340+ }
2341+ }
2342+
2343+ brelse (bh);
2344+ }
2345+
2346+ //BEOS_OUTPUT (
2347+ printk("BEOS <--- beos_find_entry() not found\n");
2348+ return 0;
2349+}
2350+
2351+
2352+#if 0
2353+struct dentry *beos_lookup(struct inode * dir, struct dentry *dentry)
2354+{
2355+ struct inode * inode = NULL;
2356+ beos_off_t offset;
2357+ unsigned int len = dentry->d_name.len;
2358+ int olen;
2359+ const unsigned char * tmpname = dentry->d_name.name;
2360+ //char tmpname2;
2361+ char * tmpname2;
2362+ struct super_block * sb = dir->i_sb;
2363+
2364+ //BEOS_OUTPUT (
2365+ printk(
2366+ "BEOS ---> beos_lookup() name '%s' index inode '%ld'\n", tmpname, dir->i_ino);
2367+
2368+ /*
2369+ * Convert to UTF-8
2370+ */
2371+ // char * beos_nls2utf (unsigned char * src, int srclen, char ** dist,
2372+ // int * len, struct super_block * sb)
2373+
2374+ if (!beos_nls2utf (*tmpname, len, &tmpname2, &olen, sb))
2375+ {
2376+ printk(
2377+ KERN_ERR "BEOS beos_lookup() unable to allocate memory\n");
2378+ return ERR_PTR(-ENOMEM);
2379+ }
2380+
2381+ if (olen > BEOS_NAME_LEN)
2382+ {
2383+ printk(
2384+ KERN_ERR "BEOS beos_lookup() name too long: '\"%s\"'",tmpname2);
2385+ putname (tmpname2);
2386+ return ERR_PTR(-ENAMETOOLONG);
2387+ }
2388+
2389+ offset = beos_find_entry (dir, tmpname2, olen);
2390+ putname (tmpname2);
2391+
2392+ if (offset)
2393+ {
2394+ inode = iget (sb, (ino_t) offset);
2395+ if (!inode)
2396+ {
2397+ return ERR_PTR(-EACCES);
2398+ }
2399+ }
2400+
2401+ d_add (dentry, inode);
2402+
2403+ //BEOS_OUTPUT (
2404+ printk("BEOS <--- beos_lookup()\n");
2405+
2406+ return;
2407+}
2408+#endif
2409+
2410+
2411+struct dentry *beos_lookup (struct inode * dir, struct dentry *dentry)
2412+{
2413+ struct inode * inode = NULL;
2414+ beos_off_t offset;
2415+ unsigned int len = dentry->d_name.len;
2416+ int olen;
2417+ //const unsigned char * tmpname = dentry->d_name.name;
2418+ char * tmpname = dentry->d_name.name;
2419+ char * tmpname2;
2420+ struct super_block * sb = dir->i_sb;
2421+
2422+ //BEOS_OUTPUT (
2423+ printk(
2424+ "BEOS ---> beos_lookup() name '%s' index inode '%ld'\n", tmpname, dir->i_ino);
2425+
2426+ /*
2427+ * Convert to UTF-8
2428+ */
2429+
2430+ if (!beos_nls2utf (tmpname, len, &tmpname2, &olen, sb))
2431+ {
2432+ return ERR_PTR(-ENOMEM);
2433+ }
2434+
2435+ if (olen > BEOS_NAME_LEN)
2436+ {
2437+ printk("BEOS beos_lookup() name too long: '\"%s\"'",tmpname2);
2438+ putname (tmpname2);
2439+ return ERR_PTR(-ENAMETOOLONG);
2440+ }
2441+
2442+ printk("BEOS beos_lookup() name len %i\n",olen);
2443+
2444+ offset = beos_find_entry (dir, tmpname2, olen);
2445+ putname (tmpname2);
2446+
2447+ if (offset)
2448+ {
2449+ inode = iget (sb, (ino_t) offset);
2450+ if (!inode)
2451+ {
2452+ return ERR_PTR(-EACCES);
2453+ }
2454+ }
2455+
2456+ d_add (dentry, inode);
2457+
2458+ //BEOS_OUTPUT (
2459+ printk("BEOS <--- beos_lookup()\n");
2460+
2461+ return NULL;
2462+}
2463+
2464+
2465+#if 0
2466+int beos_lookup (struct inode * dir, struct dentry *dentry)
2467+{
2468+ struct inode * inode = NULL;
2469+ beos_off_t offset;
2470+ unsigned int len = dentry->d_name.len;
2471+ int olen;
2472+ //const unsigned char * tmpname = dentry->d_name.name;
2473+ char * tmpname = dentry->d_name.name;
2474+ char * tmpname2;
2475+ struct super_block * sb = dir->i_sb;
2476+
2477+ //BEOS_OUTPUT (
2478+ printk(
2479+ "BEOS ---> beos_lookup() name '%s' index inode '%ld'\n", tmpname, dir->i_ino);
2480+
2481+ /*
2482+ * Convert to UTF-8
2483+ */
2484+
2485+ if (!beos_nls2utf (tmpname, len, &tmpname2, &olen, sb))
2486+ {
2487+ return -ENOMEM;
2488+ }
2489+
2490+ if (olen > BEOS_NAME_LEN)
2491+ {
2492+ printk("BEOS beos_lookup() name too long: '\"%s\"'",tmpname2);
2493+ putname (tmpname2);
2494+ return -ENAMETOOLONG;
2495+ }
2496+
2497+ printk("BEOS beos_lookup() name len %i\n",olen);
2498+
2499+ offset = beos_find_entry (dir, tmpname2, olen);
2500+ putname (tmpname2);
2501+
2502+ if (offset)
2503+ {
2504+ inode = iget (sb, (ino_t) offset);
2505+ if (!inode)
2506+ {
2507+ return -EACCES;
2508+ }
2509+ }
2510+
2511+ d_add (dentry, inode);
2512+
2513+ //BEOS_OUTPUT (
2514+ printk("BEOS <--- beos_lookup()\n");
2515+
2516+ return 0;
2517+}
2518+#endif
2519diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/super.c linux-2.2.18-pre2-beos/fs/beos/super.c
2520--- linux-2.2.18-pre2-clean/fs/beos/super.c Wed Dec 31 18:00:00 1969
2521+++ linux-2.2.18-pre2-beos/fs/beos/super.c Mon Aug 28 18:02:08 2000
2522@@ -0,0 +1,474 @@
2523+/*
2524+ * linux/fs/beos/super.c
2525+ *
2526+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
2527+ *
2528+ * from
2529+ *
2530+ * linux/fs/minix/inode.c
2531+ *
2532+ * Copyright (C) 1991, 1992 Linus Torvalds
2533+ */
2534+
2535+#include <linux/module.h>
2536+
2537+#include <stdarg.h>
2538+
2539+#include <asm/bitops.h>
2540+#include <asm/uaccess.h>
2541+#include <asm/system.h>
2542+
2543+#include <linux/errno.h>
2544+#include <linux/fs.h>
2545+//#include <linux/beos_fs.h>
2546+#include <linux/malloc.h>
2547+#include <linux/sched.h>
2548+#include <linux/stat.h>
2549+#include <linux/string.h>
2550+#include <linux/locks.h>
2551+#include <linux/blkdev.h>
2552+#include <linux/init.h>
2553+#include <linux/nls.h>
2554+
2555+
2556+void beos_put_super (struct super_block * sb)
2557+{
2558+ if (sb->u.beos_sb.mount_opts.iocharset) {
2559+ kfree (sb->u.beos_sb.mount_opts.iocharset);
2560+ sb->u.beos_sb.mount_opts.iocharset = NULL;
2561+ }
2562+
2563+ if (sb->u.beos_sb.nls) {
2564+ unload_nls (sb->u.beos_sb.nls);
2565+ sb->u.beos_sb.nls = NULL;
2566+ }
2567+
2568+ MOD_DEC_USE_COUNT;
2569+ return;
2570+}
2571+
2572+
2573+static const struct super_operations beos_sops =
2574+{
2575+ beos_read_inode,
2576+#ifdef CONFIG_BEOS_FS_RW
2577+ beos_write_inode,
2578+#else
2579+ NULL,
2580+#endif
2581+ NULL, /* put */
2582+ NULL, /* delete */
2583+ NULL, /* notify */
2584+ beos_put_super, /* put_super */
2585+#ifdef CONFIG_BEOS_FS_RW
2586+ NULL, /* write_super */
2587+#else
2588+ NULL,
2589+#endif
2590+ beos_statfs, /* stat_fs */
2591+ beos_remount /* remount_fs */
2592+};
2593+
2594+
2595+static int parse_options (char *, beos_mount_options *);
2596+static void beos_convert_super_block (int, beos_super_block *, beos_super_block *);
2597+
2598+static int parse_options (char *options, beos_mount_options * opts)
2599+{
2600+ char * this_char;
2601+ char * value;
2602+ int ret = 1;
2603+
2604+ /*
2605+ * Initialize option.
2606+ */
2607+ opts->uid = 0;
2608+ opts->gid = 0;
2609+#ifdef CONFIG_PPC
2610+ opts->beos_type = BEOS_PPC;
2611+#else
2612+ opts->beos_type = BEOS_X86;
2613+#endif
2614+
2615+ if (!options)
2616+ return ret;
2617+
2618+ for (this_char = strtok (options, ","); this_char != NULL;
2619+ this_char = strtok (NULL, ",")) {
2620+
2621+ if ((value = strchr (this_char, '=')) != NULL)
2622+ *value++ = 0;
2623+
2624+ if (!strcmp (this_char, "uid")) {
2625+ if (!value || !*value) {
2626+ ret = 0;
2627+ } else {
2628+ opts->uid = simple_strtoul (value, &value, 0);
2629+ if (*value) {
2630+ printk (KERN_ERR "BEOS: Invalid uid option: "
2631+ "%s\n", value);
2632+ ret = 0;
2633+ }
2634+ }
2635+ } else if (!strcmp (this_char, "gid")) {
2636+ if (!value || !*value)
2637+ ret= 0;
2638+ else {
2639+ opts->gid = simple_strtoul(value, &value, 0);
2640+ if (*value) {
2641+ printk (KERN_ERR
2642+ "BEOS: Invalid gid option: "
2643+ "%s\n", value);
2644+ ret = 0;
2645+ }
2646+ }
2647+#ifdef CONFIG_BEOS_CONV
2648+ } else if (!strcmp (this_char, "type")) {
2649+ if (!value || !*value)
2650+ return 0;
2651+ else {
2652+ if (!strcmp (value, "x86")) {
2653+ opts->beos_type = BEOS_X86;
2654+ } else if (!strcmp (value, "ppc")) {
2655+ opts->beos_type = BEOS_PPC;
2656+ } else {
2657+ printk (KERN_ERR
2658+ "BEOS: unknown filesystem"
2659+ " type: %s\n", value);
2660+ ret = 0;
2661+ }
2662+ }
2663+#endif
2664+ } else if (!strcmp (this_char,"iocharset") && value) {
2665+ char * p = value;
2666+ int len;
2667+
2668+ while (*value && *value != ',')
2669+ value++;
2670+ len = value - p;
2671+ if (len) {
2672+ char * buffer = kmalloc (len+1, GFP_KERNEL);
2673+ if (buffer) {
2674+ opts->iocharset = buffer;
2675+ memcpy (buffer, p, len);
2676+ buffer[len] = 0;
2677+
2678+ printk (KERN_INFO
2679+ "BEOS: IO charset %s\n", buffer);
2680+ } else {
2681+ printk (KERN_ERR
2682+ "BEOS: cannot allocate memory\n");
2683+ ret = 0;
2684+ }
2685+ }
2686+ }
2687+ }
2688+
2689+ return ret;
2690+}
2691+
2692+
2693+/*
2694+ * Convert big-endian <-> little-endian
2695+ */
2696+
2697+static void beos_convert_super_block (int fstype, beos_super_block * bs,
2698+ beos_super_block * out)
2699+{
2700+ switch (fstype)
2701+ {
2702+ case BEOS_X86:
2703+ out->magic1 = le32_to_cpu(bs->magic1);
2704+ out->block_size = le32_to_cpu(bs->block_size);
2705+ out->block_shift = le32_to_cpu(bs->block_shift);
2706+ out->num_blocks = le64_to_cpu(bs->num_blocks);
2707+ out->used_blocks = le64_to_cpu(bs->used_blocks);
2708+ out->inode_size = le32_to_cpu(bs->inode_size);
2709+ out->magic2 = le32_to_cpu(bs->magic2);
2710+ out->blocks_per_ag = le32_to_cpu(bs->blocks_per_ag);
2711+ out->ag_shift = le32_to_cpu(bs->ag_shift);
2712+ out->num_ags = le32_to_cpu(bs->num_ags);
2713+ out->flags = le32_to_cpu(bs->flags);
2714+ beos_convert_inodeaddr (fstype, &(bs->log_blocks),
2715+ &(out->log_blocks));
2716+ out->log_start = le64_to_cpu(bs->log_start);
2717+ out->log_end = le64_to_cpu(bs->log_end);
2718+ out->magic3 = le32_to_cpu(bs->magic3);
2719+ beos_convert_inodeaddr (fstype, &(bs->root_dir),
2720+ &(out->root_dir));
2721+ beos_convert_inodeaddr (fstype, &(bs->indices),
2722+ &(out->indices));
2723+ break;
2724+
2725+ case BEOS_PPC:
2726+ out->magic1 = be32_to_cpu(bs->magic1);
2727+ out->block_size = be32_to_cpu(bs->block_size);
2728+ out->block_shift = be32_to_cpu(bs->block_shift);
2729+ out->num_blocks = be64_to_cpu(bs->num_blocks);
2730+ out->used_blocks = be64_to_cpu(bs->used_blocks);
2731+ out->inode_size = be32_to_cpu(bs->inode_size);
2732+ out->magic2 = be32_to_cpu(bs->magic2);
2733+ out->blocks_per_ag = be32_to_cpu(bs->blocks_per_ag);
2734+ out->ag_shift = be32_to_cpu(bs->ag_shift);
2735+ out->num_ags = be32_to_cpu(bs->num_ags);
2736+ out->flags = be32_to_cpu(bs->flags);
2737+ beos_convert_inodeaddr (fstype, &(bs->log_blocks),
2738+ &(out->log_blocks));
2739+ out->log_start = be64_to_cpu(bs->log_start);
2740+ out->log_end = be64_to_cpu(bs->log_end);
2741+ out->magic3 = be32_to_cpu(bs->magic3);
2742+ beos_convert_inodeaddr (fstype, &(bs->root_dir),
2743+ &(out->root_dir));
2744+ beos_convert_inodeaddr (fstype, &(bs->indices),
2745+ &(out->indices));
2746+ break;
2747+ }
2748+}
2749+
2750+
2751+struct super_block * beos_read_super (struct super_block *sb, void *data,
2752+ int silent )
2753+{
2754+ beos_super_block * bs = NULL;
2755+ kdev_t dev = sb->s_dev;
2756+ int blocksize;
2757+ unsigned long logic_sb_block;
2758+ struct buffer_head * bh;
2759+
2760+ BEOS_OUTPUT (("---> beos_read_super()\n"));
2761+
2762+ /*
2763+ * Parse options
2764+ */
2765+
2766+ if (!parse_options ((char*) data, &sb->u.beos_sb.mount_opts)) {
2767+ printk (KERN_ERR "BEOS: cannot parse mount options\n");
2768+ return NULL;
2769+ }
2770+
2771+ /*
2772+ * Set dummy blocksize to read super block.
2773+ */
2774+
2775+ switch (BEOS_TYPE(sb))
2776+ {
2777+ case BEOS_X86:
2778+ blocksize = 512;
2779+ logic_sb_block = 1;
2780+ break;
2781+
2782+ case BEOS_PPC:
2783+ blocksize = 1024;
2784+ logic_sb_block = 0;
2785+ break;
2786+
2787+ default:
2788+ printk (KERN_ERR "BEOS: cannot parse filesystem type\n");
2789+ return NULL;
2790+ }
2791+
2792+ MOD_INC_USE_COUNT;
2793+ lock_super (sb);
2794+ set_blocksize (dev, blocksize);
2795+
2796+ /*
2797+ * Get BEOS super block.
2798+ */
2799+
2800+ if (!(bh = bread (dev, logic_sb_block, blocksize))) {
2801+ printk (KERN_ERR "BEOS: unable to read superblock\n");
2802+ goto bad_beos_read_super;
2803+ }
2804+
2805+ bs = (beos_super_block *) bh->b_data;
2806+
2807+#ifdef CONFIG_BEOS_CONV
2808+ /*
2809+ * Convert byte order
2810+ */
2811+
2812+ bs = (beos_super_block *) __getname();
2813+ if (!bs) {
2814+ brelse(bh);
2815+ goto bad_beos_read_super;
2816+ }
2817+ beos_convert_super_block (BEOS_TYPE(sb),
2818+ (beos_super_block *) bh->b_data, bs);
2819+#endif
2820+ BEOS_DUMP_SUPER_BLOCK (bs);
2821+
2822+ /*
2823+ * Check magic headers of super block
2824+ */
2825+
2826+ if ((bs->magic1 != BEOS_SUPER_BLOCK_MAGIC1)
2827+ || (bs->magic2 != BEOS_SUPER_BLOCK_MAGIC2)
2828+ || (bs->magic3 != BEOS_SUPER_BLOCK_MAGIC3)) {
2829+
2830+ brelse (bh);
2831+ printk (KERN_ERR "BEOS: different magic header\n");
2832+ goto bad_beos_read_super;
2833+ }
2834+
2835+ /*
2836+ * Check blocksize of BEOS.
2837+ *
2838+ * Blocksize of BEOS is 1024, 2048, 4096 or 8192.
2839+ */
2840+
2841+ if( (bs->block_size != 1024)
2842+ && (bs->block_size != 2048)
2843+ && (bs->block_size != 4096)
2844+ && (bs->block_size != 8192)) {
2845+
2846+ brelse (bh);
2847+ printk (KERN_ERR "BEOS: different blocksize\n");
2848+ goto bad_beos_read_super;
2849+ }
2850+
2851+ set_blocksize (dev, (int) bs->block_size);
2852+
2853+ /*
2854+ * fill in standard stuff
2855+ */
2856+
2857+ sb->s_magic = BEOS_SUPER_MAGIC;
2858+ sb->s_blocksize = (int) bs->block_size;
2859+
2860+ sb->u.beos_sb.block_size = bs->block_size;
2861+ sb->u.beos_sb.block_shift = bs->block_shift;
2862+ sb->u.beos_sb.num_blocks = bs->num_blocks;
2863+ sb->u.beos_sb.used_blocks = bs->used_blocks;
2864+ sb->u.beos_sb.inode_size = bs->inode_size;
2865+
2866+ sb->u.beos_sb.blocks_per_ag = bs->blocks_per_ag;
2867+ sb->u.beos_sb.ag_shift = bs->ag_shift;
2868+ sb->u.beos_sb.num_ags = bs->num_ags;
2869+
2870+ sb->u.beos_sb.log_blocks = bs->log_blocks;
2871+ sb->u.beos_sb.log_start = bs->log_start;
2872+ sb->u.beos_sb.log_end = bs->log_end;
2873+
2874+ sb->u.beos_sb.root_dir = bs->root_dir;
2875+ sb->u.beos_sb.indices = bs->indices;
2876+
2877+ unlock_super (sb);
2878+
2879+ /*
2880+ * set up enough so that it can read an inode
2881+ */
2882+
2883+ sb->s_dev = dev;
2884+ sb->s_op = (struct super_operations *) &beos_sops;
2885+ sb->s_root = d_alloc_root (iget (sb,
2886+ BEOS_IADDR2INO(&(bs->root_dir),bs)), NULL);
2887+
2888+ if (!sb->s_root) {
2889+ sb->s_dev = 0;
2890+ brelse (bh);
2891+ printk (KERN_ERR "BEOS: get root inode failed\n");
2892+
2893+ goto uninit_last_beos_read_super;
2894+ }
2895+
2896+ /*
2897+ * load nls library
2898+ */
2899+
2900+ if (sb->u.beos_sb.mount_opts.iocharset) {
2901+ sb->u.beos_sb.nls =
2902+ load_nls (sb->u.beos_sb.mount_opts.iocharset);
2903+ if (!sb->u.beos_sb.nls) {
2904+ printk (KERN_WARNING "BEOS: cannot load nls/iocharset '%s.' Loading default nls\n",sb->u.beos_sb.mount_opts.iocharset);
2905+ sb->u.beos_sb.nls = load_nls_default ();
2906+ }
2907+ else
2908+ {
2909+ printk (KERN_INFO "BEOS: loaded nls/iocharset '%s'\n",
2910+ sb->u.beos_sb.mount_opts.iocharset);
2911+ }
2912+ }
2913+ //else {
2914+ //}
2915+
2916+ brelse (bh);
2917+#ifdef CONFIG_BEOS_CONV
2918+ putname (bs);
2919+#endif
2920+
2921+ return sb;
2922+
2923+bad_beos_read_super:
2924+ sb->s_dev = 0;
2925+ unlock_super (sb);
2926+
2927+uninit_last_beos_read_super:
2928+#ifdef CONFIG_BEOS_CONV
2929+ if (bs)
2930+ putname (bs);
2931+#endif
2932+ MOD_DEC_USE_COUNT;
2933+
2934+ return NULL;
2935+}
2936+
2937+
2938+int beos_remount (struct super_block * sb, int * flags, char * data)
2939+{
2940+ if (!(*flags & MS_RDONLY))
2941+ return -EINVAL;
2942+ return 0;
2943+}
2944+
2945+
2946+static struct file_system_type beos_fs_type = {
2947+ "beos",
2948+ FS_REQUIRES_DEV,
2949+ beos_read_super,
2950+ NULL
2951+};
2952+
2953+
2954+__initfunc(int init_beos_fs(void))
2955+{
2956+ return register_filesystem(&beos_fs_type);
2957+}
2958+
2959+#ifdef MODULE
2960+MODULE_AUTHOR ("Miles Lott, milos@insync.net");
2961+MODULE_DESCRIPTION ("BeOS FS Driver for Linux (c)2000");
2962+EXPORT_NO_SYMBOLS;
2963+
2964+int init_module(void)
2965+{
2966+ printk(KERN_INFO "BEOS: BeOS FS support - http://milosch.net/beos\n");
2967+ return init_beos_fs();
2968+}
2969+
2970+
2971+void cleanup_module(void)
2972+{
2973+ unregister_filesystem(&beos_fs_type);
2974+ printk(KERN_INFO "BEOS: BeOS FS support unregistered\n");
2975+}
2976+
2977+#endif
2978+
2979+
2980+int beos_statfs (struct super_block * sb, struct statfs * buf, int bufsiz)
2981+{
2982+ struct statfs tmp;
2983+
2984+ BEOS_OUTPUT (("---> beos_statfs()\n"));
2985+
2986+ tmp.f_type = BEOS_SUPER_MAGIC;
2987+ tmp.f_bsize = sb->s_blocksize;
2988+ tmp.f_blocks = sb->u.beos_sb.num_blocks;
2989+ tmp.f_bfree = sb->u.beos_sb.num_blocks - sb->u.beos_sb.used_blocks;
2990+ tmp.f_bavail = sb->u.beos_sb.num_blocks - sb->u.beos_sb.used_blocks;
2991+ tmp.f_files = 0;
2992+ tmp.f_ffree = 0;
2993+ tmp.f_namelen = BEOS_NAME_LEN;
2994+
2995+ return copy_to_user (buf, &tmp, bufsiz) ? -EFAULT : 0;
2996+}
2997diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/symlink.c linux-2.2.18-pre2-beos/fs/beos/symlink.c
2998--- linux-2.2.18-pre2-clean/fs/beos/symlink.c Wed Dec 31 18:00:00 1969
2999+++ linux-2.2.18-pre2-beos/fs/beos/symlink.c Sun Aug 27 08:49:32 2000
3000@@ -0,0 +1,95 @@
3001+/*
3002+ * linux/fs/beos/symlink.c
3003+ *
3004+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
3005+ *
3006+ * from
3007+ *
3008+ * linux/fs/minix/symlink.c
3009+ *
3010+ * Copyright (C) 1991, 1992 Linus Torvalds
3011+ */
3012+
3013+#include <asm/uaccess.h>
3014+
3015+#include <linux/errno.h>
3016+#include <linux/fs.h>
3017+#include <linux/beos_fs.h>
3018+#include <linux/sched.h>
3019+#include <linux/mm.h>
3020+#include <linux/stat.h>
3021+
3022+static int beos_readlink (struct dentry *, char *, int);
3023+static struct dentry * beos_follow_link(struct dentry *, struct dentry *,
3024+ unsigned int);
3025+
3026+/*
3027+ * symlinks can't do much...
3028+ */
3029+struct inode_operations beos_symlink_inode_operations = {
3030+ NULL, /* no file-operations */
3031+ NULL, /* create */
3032+ NULL, /* lookup */
3033+ NULL, /* link */
3034+ NULL, /* unlink */
3035+ NULL, /* symlink */
3036+ NULL, /* mkdir */
3037+ NULL, /* rmdir */
3038+ NULL, /* mknod */
3039+ NULL, /* rename */
3040+ beos_readlink, /* readlink */
3041+ beos_follow_link, /* follow_link */
3042+ NULL, /* readpage */
3043+ NULL, /* writepage */
3044+ NULL, /* bmap */
3045+ NULL, /* truncate */
3046+ NULL, /* permission */
3047+ NULL /* smap */
3048+};
3049+
3050+
3051+/*
3052+ * The inode of symbolic link is different to data stream.
3053+ * The data stream become link name.
3054+ */
3055+static struct dentry * beos_follow_link(struct dentry * dentry,
3056+ struct dentry * base, unsigned int follow)
3057+{
3058+ struct inode * inode = dentry->d_inode;
3059+ char * link = inode->u.beos_i.i_data.symlink;
3060+
3061+ UPDATE_ATIME(inode);
3062+
3063+ base = lookup_dentry (link, base, follow);
3064+
3065+ return base;
3066+}
3067+
3068+
3069+static int beos_readlink (struct dentry * dentry, char * buffer, int buflen)
3070+{
3071+ struct inode * inode = dentry->d_inode;
3072+ char * link = inode->u.beos_i.i_data.symlink;
3073+ int len = 0;
3074+ int len_dist;
3075+ char * tmpname;
3076+
3077+ if (buflen > BEOS_SYMLINK_LEN)
3078+ buflen = BEOS_SYMLINK_LEN;
3079+
3080+ while (len < buflen && link[len])
3081+ len++;
3082+
3083+ if (!beos_utf2nls (link, len, &tmpname, &len_dist, inode->i_sb)) {
3084+ return -ENOMEM;
3085+ }
3086+
3087+ if (copy_to_user(buffer, tmpname, len_dist))
3088+ len = -EFAULT;
3089+
3090+ putname (tmpname);
3091+
3092+ UPDATE_ATIME(inode);
3093+
3094+ return len;
3095+}
3096diff -aur --new-file linux-2.2.18-pre2-clean/fs/beos/util.c linux-2.2.18-pre2-beos/fs/beos/util.c
3097--- linux-2.2.18-pre2-clean/fs/beos/util.c Wed Dec 31 18:00:00 1969
3098+++ linux-2.2.18-pre2-beos/fs/beos/util.c Sat Sep 2 12:37:55 2000
3099@@ -0,0 +1,162 @@
3100+/*
3101+ * linux/fs/beos/util.c
3102+ *
3103+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
3104+ */
3105+
3106+#include <linux/mm.h>
3107+#include <linux/fs.h>
3108+#include <linux/nls.h>
3109+
3110+#define BEOS_UNKNOWN_CHAR '?'
3111+
3112+
3113+/*
3114+ * UTF-8 to NLS charset convert routine
3115+ */
3116+char * beos_utf2nls (char * src, int srclen, char ** dist,
3117+ int * len, struct super_block * sb)
3118+{
3119+ char * out;
3120+ struct nls_table * nls = sb->u.beos_sb.nls;
3121+ char * orig = src;
3122+ int olen = 0;
3123+
3124+ BEOS_OUTPUT (("---> utf2nls()\n"));
3125+
3126+ *dist = out = (char *) __getname();
3127+
3128+ if (!out)
3129+ {
3130+ printk(KERN_ERR "BEOS utf2nls: cannot allocate memory\n");
3131+ return NULL;
3132+ }
3133+
3134+ if (!nls)
3135+ {
3136+ printk(KERN_INFO "BEOS utf2nls: '%s' not nls\n", src);
3137+ while (*src && srclen-- > 0) { *out++ = *src++; }
3138+ }
3139+ else
3140+ {
3141+ printk(KERN_INFO "BEOS utf2nls: processing nls\n");
3142+ while (*src && srclen > 0)
3143+ {
3144+ int n;
3145+ unsigned char page;
3146+ __u16 w;
3147+
3148+ /*
3149+ * convert from UTF-8 to Unicode
3150+ */
3151+ // int utf8_mbtowc(__u16 *, const __u8 *, int)
3152+ n = utf8_mbtowc(&w, src, srclen);
3153+ if (n <= 0)
3154+ {
3155+ /*
3156+ * cannot convert from UTF-8 to unicode
3157+ */
3158+ *out++ = BEOS_UNKNOWN_CHAR;
3159+ src++;
3160+ srclen--;
3161+ continue;
3162+ }
3163+ //else
3164+ //{
3165+ // printk(KERN_INFO "BEOS utf8_mbtowc: %d\n",w);
3166+ //}
3167+ src += n;
3168+ srclen -= n;
3169+
3170+ // printk(KERN_INFO "BEOS uni2char: working on %d\n",w);
3171+ nls->uni2char(0x00, w, &page, 20, &olen);
3172+ // printk(KERN_INFO "BEOS uni2char: returned %d\n",page);
3173+
3174+ if (!page)
3175+ *out++ = BEOS_UNKNOWN_CHAR;
3176+ else
3177+ //*out++ = page[w & 0xff];
3178+ *out++ = page;
3179+ }
3180+ }
3181+ *out = '\0';
3182+ *len = out - (*dist);
3183+
3184+ BEOS_OUTPUT (("<--- utf2nls()\n"));
3185+ if (nls)
3186+ {
3187+ printk(KERN_INFO "BEOS utf2nls in '%s'\tout '%s' length '%d'\n", orig, *dist, *len);
3188+ }
3189+ return *dist;
3190+}
3191+
3192+
3193+char * beos_nls2utf (unsigned char * src, int srclen, char ** dist,
3194+ int * len, struct super_block * sb)
3195+{
3196+ char * out;
3197+ struct nls_table * nls = sb->u.beos_sb.nls;
3198+ char * orig = src;
3199+
3200+ //BEOS_OUTPUT (
3201+ printk(KERN_INFO "BEOS ---> nls2utf()\n");
3202+
3203+ *dist = out = (char *) __getname();
3204+ if (!out)
3205+ {
3206+ //BEOS_OUTPUT (
3207+ printk(KERN_WARNING "BEOS: cannot allocate memory\n");
3208+ return NULL;
3209+ }
3210+
3211+ if (!nls)
3212+ {
3213+ printk(KERN_INFO "BEOS nls2utf: not nls\n");
3214+ while (*src && srclen-- > 0) { *out++ = *src++; }
3215+ }
3216+ else
3217+ {
3218+ printk(KERN_INFO "BEOS nls2utf: processing nls\n");
3219+ while (*src && srclen > 0)
3220+ {
3221+ int n,offset=0;
3222+ __u16 w=0;
3223+ __u8 wl,wh;
3224+
3225+ /*
3226+ * convert from nls to unicode
3227+ */
3228+ // printk(KERN_INFO "BEOS char2uni: working on %d\n",*src);
3229+ nls->char2uni(src, &offset, &wh, &wl);
3230+ // printk(KERN_INFO "BEOS char2uni: returned %d\n",wh);
3231+
3232+ src++;
3233+ srclen--;
3234+ //w = wh >> 8 << wl;
3235+ w = wh;
3236+ //printk(KERN_INFO "BEOS char2uni: %d\n",w);
3237+ /*
3238+ * convert from unicode to UTF-8
3239+ */
3240+ n = utf8_wctomb(out, w, 6);
3241+ if (n <= 0)
3242+ {
3243+ *out++ = BEOS_UNKNOWN_CHAR;
3244+ continue;
3245+ }
3246+ out += n;
3247+ }
3248+ }
3249+
3250+ *out = '\0';
3251+ *len = out - (*dist);
3252+
3253+ //BEOS_OUTPUT (
3254+ printk(KERN_INFO "BEOS <--- nls2utf()\n");
3255+ if (nls)
3256+ {
3257+ printk(
3258+ KERN_INFO "BEOS nls2utf in '%s'\tout '%s' length '%d'\n", orig, *dist,*len);
3259+ }
3260+ return *dist;
3261+}
3262diff -aur --new-file linux-2.2.18-pre2-clean/fs/filesystems.c linux-2.2.18-pre2-beos/fs/filesystems.c
3263--- linux-2.2.18-pre2-clean/fs/filesystems.c Thu Aug 24 01:54:28 2000
3264+++ linux-2.2.18-pre2-beos/fs/filesystems.c Sat Sep 2 12:52:02 2000
3265@@ -59,6 +59,10 @@
3266 init_minix_fs();
3267 #endif
3268
3269+#ifdef CONFIG_BEOS_FS
3270+ init_beos_fs();
3271+#endif
3272+
3273 #ifdef CONFIG_ROMFS_FS
3274 init_romfs_fs();
3275 #endif
3276diff -aur --new-file linux-2.2.18-pre2-clean/include/linux/beos_fs.h linux-2.2.18-pre2-beos/include/linux/beos_fs.h
3277--- linux-2.2.18-pre2-clean/include/linux/beos_fs.h Wed Dec 31 18:00:00 1969
3278+++ linux-2.2.18-pre2-beos/include/linux/beos_fs.h Sat Sep 2 12:26:25 2000
3279@@ -0,0 +1,305 @@
3280+/*
3281+ * linux/include/linux/beos_fs.h
3282+ *
3283+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
3284+ */
3285+
3286+#ifndef _LINUX_BEOS_FS
3287+#define _LINUX_BEOS_FS
3288+
3289+#include <linux/types.h>
3290+//#include <linux/fs.h>
3291+
3292+/*
3293+ * for debug
3294+ */
3295+/* #define BEOS_DEBUG */
3296+
3297+#ifdef BEOS_DEBUG
3298+#define BEOS_OUTPUT(x) printk x
3299+#define BEOS_DUMP_SUPER_BLOCK beos_dump_super_block
3300+#define BEOS_DUMP_INODE beos_dump_inode
3301+#define BEOS_DUMP_INDEX_ENTRY beos_dump_index_entry
3302+#define BEOS_DUMP_INDEX_NODE beos_dump_index_node
3303+#define BEOS_DUMP_INODE_ADDR beos_dump_inode_addr
3304+#else
3305+#define BEOS_OUTPUT(x)
3306+#define BEOS_DUMP_SUPER_BLOCK(x)
3307+#define BEOS_DUMP_INODE(x)
3308+#define BEOS_DUMP_INDEX_ENTRY(x)
3309+#define BEOS_DUMP_INDEX_NODE(x)
3310+#define BEOS_DUMP_INODE_ADDR(x)
3311+#endif
3312+
3313+
3314+/*
3315+ * Flags of superblock
3316+ */
3317+
3318+#define BEOS_CLEAN 0x434c454e
3319+#define BEOS_DIRTY 0x44495254
3320+
3321+/*
3322+ * Max name length of BEOS
3323+ */
3324+
3325+#define BEOS_NAME_LEN 255
3326+#define BEOS_SYMLINK_LEN 160
3327+
3328+/*
3329+ * Magic headers of BEOS's superblock, inode and index
3330+ */
3331+
3332+#define BEOS_SUPER_BLOCK_MAGIC1 0x42465331 /* BEOS1 */
3333+#define BEOS_SUPER_BLOCK_MAGIC2 0xdd121031
3334+#define BEOS_SUPER_BLOCK_MAGIC3 0x15b6830e
3335+
3336+#define BEOS_INODE_MAGIC1 0x3bbe0ad9
3337+
3338+#define BEOS_INDEX_MAGIC 0x69f6c2e8
3339+
3340+#define BEOS_SUPER_MAGIC BEOS_SUPER_BLOCK_MAGIC1
3341+
3342+
3343+#define BEOS_NUM_DIRECT_BLOCKS 12
3344+#define BEOS_NAME_LENGTH 32
3345+
3346+/*
3347+ * BEOS filesystem type
3348+ */
3349+
3350+#define BEOS_PPC 1
3351+#define BEOS_X86 2
3352+
3353+/*
3354+ * default gid and uid
3355+ */
3356+
3357+#define BEOS_DEFAULT_GID 0
3358+#define BEOS_DEFAULT_UID 0
3359+
3360+/*
3361+ * Flags of inode
3362+ */
3363+
3364+#define BEOS_INODE_IN_USE 0x00000001
3365+#define BEOS_ATTR_INODE 0x00000004
3366+#define BEOS_INODE_LOGGED 0x00000008
3367+#define BEOS_INODE_DELETED 0x00000010
3368+
3369+#define BEOS_PERMANENT_FLAG 0x0000ffff
3370+
3371+#define BEOS_INODE_NO_CREATE 0x00010000
3372+#define BEOS_INODE_WAS_WRITTEN 0x00020000
3373+#define BEOS_NO_TRANSACTION 0x00040000
3374+
3375+
3376+#define BEOS_IADDR2INO(iaddr,sb) \
3377+ (((iaddr)->allocation_group << (sb)->ag_shift) + (iaddr)->start)
3378+#define BEOS_INODE2INO(inode) \
3379+ (((inode)->u.beos_i.i_inode_num.allocation_group << \
3380+ (inode)->i_sb->u.beos_sb.ag_shift) \
3381+ + (inode)->u.beos_i.i_inode_num.start)
3382+
3383+#define BEOS_BLOCK_PER_INODE(sb) \
3384+ ((sb)->u.beos_sb.block_size / sizeof(beos_inode_addr))
3385+
3386+#define BEOS_IS_EMPTY_IADDR(iaddr) \
3387+ ((!(iaddr)->allocation_group) && (!(iaddr)->start) && (!(iaddr)->len))
3388+
3389+#define BEOS_TYPE(sb) \
3390+ ((sb)->u.beos_sb.mount_opts.beos_type)
3391+
3392+/*
3393+ * special type of BEOS
3394+ */
3395+
3396+typedef long long beos_off_t;
3397+typedef long long beos_bigtime_t;
3398+typedef void beos_binode_etc;
3399+
3400+
3401+/* Block runs */
3402+typedef struct _beos_block_run {
3403+ __u32 allocation_group;
3404+ __u16 start;
3405+ __u16 len;
3406+} beos_block_run;
3407+
3408+
3409+typedef beos_block_run beos_inode_addr;
3410+
3411+
3412+/*
3413+ * The Superblock Structure
3414+ */
3415+
3416+typedef struct _beos_super_block {
3417+ char name[BEOS_NAME_LENGTH];
3418+ __u32 magic1;
3419+ __u32 fs_byte_order;
3420+
3421+ __u32 block_size;
3422+ __u32 block_shift;
3423+
3424+ beos_off_t num_blocks;
3425+ beos_off_t used_blocks;
3426+
3427+ __u32 inode_size;
3428+
3429+ __u32 magic2;
3430+ __u32 blocks_per_ag;
3431+ __u32 ag_shift;
3432+ __u32 num_ags;
3433+
3434+ __u32 flags;
3435+
3436+ beos_block_run log_blocks;
3437+ beos_off_t log_start;
3438+ beos_off_t log_end;
3439+
3440+ __u32 magic3;
3441+ beos_inode_addr root_dir;
3442+ beos_inode_addr indices;
3443+
3444+ __u32 pad[8];
3445+} __attribute__ ((packed)) beos_super_block;
3446+
3447+
3448+typedef struct _beos_data_stream {
3449+ beos_block_run direct[BEOS_NUM_DIRECT_BLOCKS];
3450+ beos_off_t max_direct_range;
3451+ beos_block_run indirect;
3452+ beos_off_t max_indirect_range;
3453+ beos_block_run double_indirect;
3454+ beos_off_t max_double_indirect_range;
3455+ beos_off_t size;
3456+} __attribute__ ((packed)) beos_data_stream;
3457+
3458+
3459+/* Attribute */
3460+typedef struct _beos_small_data {
3461+ __u32 type;
3462+ __u16 name_size;
3463+ __u16 data_size;
3464+ char name[1];
3465+} __attribute__ ((packed)) beos_small_data;
3466+
3467+
3468+/* Inode structure */
3469+typedef struct _beos_inode {
3470+ __u32 magic1;
3471+ beos_inode_addr inode_num;
3472+ __u32 uid;
3473+ __u32 gid;
3474+ __u32 mode;
3475+ __u32 flags;
3476+ beos_bigtime_t create_time;
3477+ beos_bigtime_t last_modified_time;
3478+ beos_inode_addr parent;
3479+ beos_inode_addr attributes;
3480+ __u32 type;
3481+
3482+ __u32 inode_size;
3483+ __u32 etc; /* not use */
3484+
3485+ union {
3486+ beos_data_stream datastream;
3487+ char symlink[BEOS_SYMLINK_LEN];
3488+ } data;
3489+ __u32 pad[4]; /* not use */
3490+} __attribute__ ((packed)) beos_inode;
3491+
3492+
3493+typedef struct _beos_index_entry {
3494+ __u32 magic;
3495+ __u32 node_size;
3496+ __u32 max_number_of_levels;
3497+ __u32 data_type;
3498+ beos_off_t root_node_pointer;
3499+ beos_off_t free_node_pointer;
3500+ beos_off_t maximum_size;
3501+} __attribute__ ((packed)) beos_index_entry;
3502+
3503+
3504+typedef struct _beos_index_node {
3505+ beos_off_t left;
3506+ beos_off_t right;
3507+ beos_off_t overflow;
3508+ __u16 all_key_count;
3509+ __u16 all_key_length;
3510+} __attribute__ ((packed)) beos_index_node;
3511+
3512+
3513+typedef struct _beos_mount_options {
3514+ gid_t gid;
3515+ uid_t uid;
3516+ int beos_type;
3517+ char * iocharset;
3518+} beos_mount_options;
3519+
3520+
3521+#ifdef __KERNEL__
3522+/*
3523+ * Function prototypes
3524+ */
3525+
3526+/* file.c */
3527+extern int beos_read (struct inode *, struct file *, char *, int);
3528+extern beos_inode_addr beos_read_data_stream (struct super_block *,
3529+ beos_data_stream *, int *);
3530+
3531+/* inode.c */
3532+extern int beos_bmap (struct inode *, int);
3533+extern void beos_read_inode (struct inode *);
3534+extern struct buffer_head * beos_bread (struct inode *);
3535+extern struct buffer_head * beos_bread2 (struct super_block *, beos_inode_addr);
3536+extern void beos_write_inode (struct inode *);
3537+extern int beos_sync_inode (struct inode *);
3538+extern void beos_convert_inodeaddr (
3539+ int fstype, beos_inode_addr * iaddr, beos_inode_addr * out);
3540+
3541+/* namei.c */
3542+extern void beos_release (struct inode *, struct file *);
3543+//extern int beos_lookup (struct inode *, struct dentry *);
3544+extern struct dentry * beos_lookup (struct inode *, struct dentry *);
3545+
3546+/* super.c */
3547+extern void beos_put_super (struct super_block *);
3548+extern int beos_remount (struct super_block *, int *, char *);
3549+extern struct super_block * beos_read_super (struct super_block *,void *,int);
3550+extern int init_beos_fs(void);
3551+extern int beos_statfs (struct super_block *, struct statfs *, int);
3552+
3553+/* index.c */
3554+extern char * beos_get_key_from_index_node (beos_index_node *, int *, int,
3555+ char *, int *, beos_off_t *);
3556+extern struct buffer_head * beos_read_index_node (beos_inode_addr,
3557+ struct super_block *, int, beos_off_t *);
3558+
3559+/* debug.c */
3560+extern void beos_dump_super_block (beos_super_block *);
3561+extern void beos_dump_inode (beos_inode *);
3562+extern void beos_dump_index_entry (beos_index_entry *);
3563+extern void beos_dump_index_node (beos_index_node *);
3564+
3565+/* util.c */
3566+extern char * beos_utf2nls (char *, int, char **, int *, struct super_block *);
3567+extern char * beos_nls2utf (unsigned char *, int, char **, int *, struct super_block *);
3568+
3569+/*
3570+ * Inodes and files operations
3571+ */
3572+
3573+/* dir.c */
3574+extern struct inode_operations beos_dir_inode_operations;
3575+
3576+/* file.c */
3577+extern struct inode_operations beos_file_inode_operations;
3578+
3579+/* symlink.c */
3580+extern struct inode_operations beos_symlink_inode_operations;
3581+
3582+#endif /* __KERNEL__ */
3583+
3584+#endif
3585diff -aur --new-file linux-2.2.18-pre2-clean/include/linux/beos_fs_i.h linux-2.2.18-pre2-beos/include/linux/beos_fs_i.h
3586--- linux-2.2.18-pre2-clean/include/linux/beos_fs_i.h Wed Dec 31 18:00:00 1969
3587+++ linux-2.2.18-pre2-beos/include/linux/beos_fs_i.h Sat Sep 2 12:26:30 2000
3588@@ -0,0 +1,37 @@
3589+/*
3590+ * linux/include/linux/beos_fs_i.h
3591+ *
3592+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
3593+ *
3594+ * from
3595+ *
3596+ * linux/include/linux/ex2_fs_i.h
3597+ */
3598+
3599+#ifndef _LINUX_BEOS_FS_I_
3600+#define _LINUX_BEOS_FS_I_
3601+
3602+#include <linux/beos_fs.h>
3603+
3604+struct beos_inode_info {
3605+ beos_inode_addr i_inode_num;
3606+ __u32 i_uid;
3607+ __u32 i_gid;
3608+ __u32 i_mode;
3609+ __u32 i_flags;
3610+
3611+ beos_bigtime_t i_create_time;
3612+ beos_bigtime_t i_last_modified_time;
3613+
3614+ beos_inode_addr i_parent;
3615+ beos_inode_addr i_attribute;
3616+
3617+ __u32 i_type;
3618+
3619+ union {
3620+ beos_data_stream ds;
3621+ char symlink[BEOS_SYMLINK_LEN];
3622+ } i_data;
3623+};
3624+
3625+#endif /* _LINUX_BEOS_FS_I_ */
3626diff -aur --new-file linux-2.2.18-pre2-clean/include/linux/beos_fs_sb.h linux-2.2.18-pre2-beos/include/linux/beos_fs_sb.h
3627--- linux-2.2.18-pre2-clean/include/linux/beos_fs_sb.h Wed Dec 31 18:00:00 1969
3628+++ linux-2.2.18-pre2-beos/include/linux/beos_fs_sb.h Sat Sep 2 12:26:30 2000
3629@@ -0,0 +1,44 @@
3630+/*
3631+ * linux/include/linux/beos_fs_sb.h
3632+ *
3633+ * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
3634+ */
3635+
3636+#ifndef _LINUX_BEOS_FS_SB
3637+#define _LINUX_BEOS_FS_SB
3638+
3639+#include <linux/types.h>
3640+#include <linux/beos_fs.h>
3641+
3642+
3643+struct beos_sb_info {
3644+ __u32 block_size;
3645+ __u32 block_shift;
3646+ beos_off_t num_blocks;
3647+ beos_off_t used_blocks;
3648+ __u32 inode_size;
3649+
3650+ /*
3651+ * Allocation group information
3652+ */
3653+
3654+ __u32 blocks_per_ag;
3655+ __u32 ag_shift;
3656+ __u32 num_ags;
3657+
3658+ /*
3659+ * jornal log entry
3660+ */
3661+
3662+ beos_block_run log_blocks;
3663+ beos_off_t log_start;
3664+ beos_off_t log_end;
3665+
3666+ beos_inode_addr root_dir;
3667+ beos_inode_addr indices;
3668+
3669+ beos_mount_options mount_opts;
3670+
3671+ struct nls_table * nls;
3672+};
3673+#endif
3674diff -aur --new-file linux-2.2.18-pre2-clean/include/linux/fs.h linux-2.2.18-pre2-beos/include/linux/fs.h
3675--- linux-2.2.18-pre2-clean/include/linux/fs.h.orig Mon Sep 4 20:57:21 2000
3676+++ linux-2.2.18-pre2-clean/include/linux/fs.h Mon Sep 4 21:01:43 2000
3677@@ -280,6 +280,7 @@
3678 #include <linux/adfs_fs_i.h>
3679 #include <linux/qnx4_fs_i.h>
3680 #include <linux/usbdev_fs_i.h>
3681+#include <linux/beos_fs_i.h>
3682
3683 /*
3684 * Attribute flags. These should be or-ed together to figure out what
3685@@ -395,6 +396,7 @@
3686 struct qnx4_inode_info qnx4_i;
3687 struct usbdev_inode_info usbdev_i;
3688 struct socket socket_i;
3689+ struct beos_inode_info beos_i;
3690 void *generic_ip;
3691 } u;
3692 };
3693@@ -517,6 +519,7 @@
3694 #include <linux/adfs_fs_sb.h>
3695 #include <linux/qnx4_fs_sb.h>
3696 #include <linux/usbdev_fs_sb.h>
3697+#include <linux/beos_fs_sb.h>
3698
3699 extern struct list_head super_blocks;
3700
3701@@ -561,6 +564,7 @@
3702 struct adfs_sb_info adfs_sb;
3703 struct qnx4_sb_info qnx4_sb;
3704 struct usbdev_sb_info usbdevfs_sb;
3705+ struct beos_sb_info beos_sb;
3706 void *generic_sbp;
3707 } u;
3708 /*
This page took 0.537385 seconds and 4 git commands to generate.