brintos

brintos / linux-shallow public Read only

0
0
Text · 15.4 KiB · 7e0dd2f Raw
354 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3====================4Read/Write HPFS 2.095====================6 71998-2004, Mikulas Patocka8 9:email: mikulas@artax.karlin.mff.cuni.cz10:homepage: https://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi11 12Credits13=======14Chris Smith, 1993, original read-only HPFS, some code and hpfs structures file15	is taken from it16 17Jacques Gelinas, MSDos mmap, Inspired by fs/nfs/mmap.c (Jon Tombs 15 Aug 1993)18 19Werner Almesberger, 1992, 1993, MSDos option parser & CR/LF conversion20 21Mount options22 23uid=xxx,gid=xxx,umask=xxx (default uid=gid=0 umask=default_system_umask)24	Set owner/group/mode for files that do not have it specified in extended25	attributes. Mode is inverted umask - for example umask 027 gives owner26	all permission, group read permission and anybody else no access. Note27	that for files mode is anded with 0666. If you want files to have 'x'28	rights, you must use extended attributes.29case=lower,asis (default asis)30	File name lowercasing in readdir.31conv=binary,text,auto (default binary)32	CR/LF -> LF conversion, if auto, decision is made according to extension33	- there is a list of text extensions (I thing it's better to not convert34	text file than to damage binary file). If you want to change that list,35	change it in the source. Original readonly HPFS contained some strange36	heuristic algorithm that I removed. I thing it's danger to let the37	computer decide whether file is text or binary. For example, DJGPP38	binaries contain small text message at the beginning and they could be39	misidentified and damaged under some circumstances.40check=none,normal,strict (default normal)41	Check level. Selecting none will cause only little speedup and big42	danger. I tried to write it so that it won't crash if check=normal on43	corrupted filesystems. check=strict means many superfluous checks -44	used for debugging (for example it checks if file is allocated in45	bitmaps when accessing it).46errors=continue,remount-ro,panic (default remount-ro)47	Behaviour when filesystem errors found.48chkdsk=no,errors,always (default errors)49	When to mark filesystem dirty so that OS/2 checks it.50eas=no,ro,rw (default rw)51	What to do with extended attributes. 'no' - ignore them and use always52	values specified in uid/gid/mode options. 'ro' - read extended53	attributes but do not create them. 'rw' - create extended attributes54	when you use chmod/chown/chgrp/mknod/ln -s on the filesystem.55timeshift=(-)nnn (default 0)56	Shifts the time by nnn seconds. For example, if you see under linux57	one hour more, than under os/2, use timeshift=-3600.58 59 60File names61==========62 63As in OS/2, filenames are case insensitive. However, shell thinks that names64are case sensitive, so for example when you create a file FOO, you can use65'cat FOO', 'cat Foo', 'cat foo' or 'cat F*' but not 'cat f*'. Note, that you66also won't be able to compile linux kernel (and maybe other things) on HPFS67because kernel creates different files with names like bootsect.S and68bootsect.s. When searching for file thats name has characters >= 128, codepages69are used - see below.70OS/2 ignores dots and spaces at the end of file name, so this driver does as71well. If you create 'a. ...', the file 'a' will be created, but you can still72access it under names 'a.', 'a..', 'a .  . . ' etc.73 74 75Extended attributes76===================77 78On HPFS partitions, OS/2 can associate to each file a special information called79extended attributes. Extended attributes are pairs of (key,value) where key is80an ascii string identifying that attribute and value is any string of bytes of81variable length. OS/2 stores window and icon positions and file types there. So82why not use it for unix-specific info like file owner or access rights? This83driver can do it. If you chown/chgrp/chmod on a hpfs partition, extended84attributes with keys "UID", "GID" or "MODE" and 2-byte values are created. Only85that extended attributes those value differs from defaults specified in mount86options are created. Once created, the extended attributes are never deleted,87they're just changed. It means that when your default uid=0 and you type88something like 'chown luser file; chown root file' the file will contain89extended attribute UID=0. And when you umount the fs and mount it again with90uid=luser_uid, the file will be still owned by root! If you chmod file to 444,91extended attribute "MODE" will not be set, this special case is done by setting92read-only flag. When you mknod a block or char device, besides "MODE", the93special 4-byte extended attribute "DEV" will be created containing the device94number. Currently this driver cannot resize extended attributes - it means95that if somebody (I don't know who?) has set "UID", "GID", "MODE" or "DEV"96attributes with different sizes, they won't be rewritten and changing these97values doesn't work.98 99 100Symlinks101========102 103You can do symlinks on HPFS partition, symlinks are achieved by setting extended104attribute named "SYMLINK" with symlink value. Like on ext2, you can chown and105chgrp symlinks but I don't know what is it good for. chmoding symlink results106in chmoding file where symlink points. These symlinks are just for Linux use and107incompatible with OS/2. OS/2 PmShell symlinks are not supported because they are108stored in very crazy way. They tried to do it so that link changes when file is109moved ... sometimes it works. But the link is partly stored in directory110extended attributes and partly in OS2SYS.INI. I don't want (and don't know how)111to analyze or change OS2SYS.INI.112 113 114Codepages115=========116 117HPFS can contain several uppercasing tables for several codepages and each118file has a pointer to codepage its name is in. However OS/2 was created in119America where people don't care much about codepages and so multiple codepages120support is quite buggy. I have Czech OS/2 working in codepage 852 on my disk.121Once I booted English OS/2 working in cp 850 and I created a file on my 852122partition. It marked file name codepage as 850 - good. But when I again booted123Czech OS/2, the file was completely inaccessible under any name. It seems that124OS/2 uppercases the search pattern with its system code page (852) and file125name it's comparing to with its code page (850). These could never match. Is it126really what IBM developers wanted? But problems continued. When I created in127Czech OS/2 another file in that directory, that file was inaccessible too. OS/2128probably uses different uppercasing method when searching where to place a file129(note, that files in HPFS directory must be sorted) and when searching for130a file. Finally when I opened this directory in PmShell, PmShell crashed (the131funny thing was that, when rebooted, PmShell tried to reopen this directory132again :-). chkdsk happily ignores these errors and only low-level disk133modification saved me.  Never mix different language versions of OS/2 on one134system although HPFS was designed to allow that.135OK, I could implement complex codepage support to this driver but I think it136would cause more problems than benefit with such buggy implementation in OS/2.137So this driver simply uses first codepage it finds for uppercasing and138lowercasing no matter what's file codepage index. Usually all file names are in139this codepage - if you don't try to do what I described above :-)140 141 142Known bugs143==========144 145HPFS386 on OS/2 server is not supported. HPFS386 installed on normal OS/2 client146should work. If you have OS/2 server, use only read-only mode. I don't know how147to handle some HPFS386 structures like access control list or extended perm148list, I don't know how to delete them when file is deleted and how to not149overwrite them with extended attributes. Send me some info on these structures150and I'll make it. However, this driver should detect presence of HPFS386151structures, remount read-only and not destroy them (I hope).152 153When there's not enough space for extended attributes, they will be truncated154and no error is returned.155 156OS/2 can't access files if the path is longer than about 256 chars but this157driver allows you to do it. chkdsk ignores such errors.158 159Sometimes you won't be able to delete some files on a very full filesystem160(returning error ENOSPC). That's because file in non-leaf node in directory tree161(one directory, if it's large, has dirents in tree on HPFS) must be replaced162with another node when deleted. And that new file might have larger name than163the old one so the new name doesn't fit in directory node (dnode). And that164would result in directory tree splitting, that takes disk space. Workaround is165to delete other files that are leaf (probability that the file is non-leaf is166about 1/50) or to truncate file first to make some space.167You encounter this problem only if you have many directories so that168preallocated directory band is full i.e.::169 170	number_of_directories / size_of_filesystem_in_mb > 4.171 172You can't delete open directories.173 174You can't rename over directories (what is it good for?).175 176Renaming files so that only case changes doesn't work. This driver supports it177but vfs doesn't. Something like 'mv file FILE' won't work.178 179All atimes and directory mtimes are not updated. That's because of performance180reasons. If you extremely wish to update them, let me know, I'll write it (but181it will be slow).182 183When the system is out of memory and swap, it may slightly corrupt filesystem184(lost files, unbalanced directories). (I guess all filesystem may do it).185 186When compiled, you get warning: function declaration isn't a prototype. Does187anybody know what does it mean?188 189 190What does "unbalanced tree" message mean?191=========================================192 193Old versions of this driver created sometimes unbalanced dnode trees. OS/2194chkdsk doesn't scream if the tree is unbalanced (and sometimes creates195unbalanced trees too :-) but both HPFS and HPFS386 contain bug that it rarely196crashes when the tree is not balanced. This driver handles unbalanced trees197correctly and writes warning if it finds them. If you see this message, this is198probably because of directories created with old version of this driver.199Workaround is to move all files from that directory to another and then back200again. Do it in Linux, not OS/2! If you see this message in directory that is201whole created by this driver, it is BUG - let me know about it.202 203 204Bugs in OS/2205============206 207When you have two (or more) lost directories pointing each to other, chkdsk208locks up when repairing filesystem.209 210Sometimes (I think it's random) when you create a file with one-char name under211OS/2, OS/2 marks it as 'long'. chkdsk then removes this flag saying "Minor fs212error corrected".213 214File names like "a .b" are marked as 'long' by OS/2 but chkdsk "corrects" it and215marks them as short (and writes "minor fs error corrected"). This bug is not in216HPFS386.217 218Codepage bugs described above219=============================220 221If you don't install fixpacks, there are many, many more...222 223 224History225=======226 227====== =========================================================================2280.90   First public release2290.91   Fixed bug that caused shooting to memory when write_inode was called on230       open inode (rarely happened)2310.92   Fixed a little memory leak in freeing directory inodes2320.93   Fixed bug that locked up the machine when there were too many filenames233       with first 15 characters same234       Fixed write_file to zero file when writing behind file end2350.94   Fixed a little memory leak when trying to delete busy file or directory2360.95   Fixed a bug that i_hpfs_parent_dir was not updated when moving files2371.90   First version for 2.1.1xx kernels2381.91   Fixed a bug that chk_sectors failed when sectors were at the end of disk239       Fixed a race-condition when write_inode is called while deleting file240       Fixed a bug that could possibly happen (with very low probability) when241       using 0xff in filenames.242 243       Rewritten locking to avoid race-conditions244 245       Mount option 'eas' now works246 247       Fsync no longer returns error248 249       Files beginning with '.' are marked hidden250 251       Remount support added252 253       Alloc is not so slow when filesystem becomes full254 255       Atimes are no more updated because it slows down operation256 257       Code cleanup (removed all commented debug prints)2581.92   Corrected a bug when sync was called just before closing file2591.93   Modified, so that it works with kernels >= 2.1.131, I don't know if it260       works with previous versions261 262       Fixed a possible problem with disks > 64G (but I don't have one, so I can't263       test it)264 265       Fixed a file overflow at 2G266 267       Added new option 'timeshift'268 269       Changed behaviour on HPFS386: It is now possible to operate on HPFS386 in270       read-only mode271 272       Fixed a bug that slowed down alloc and prevented allocating 100% space273       (this bug was not destructive)2741.94   Added workaround for one bug in Linux275 276       Fixed one buffer leak277 278       Fixed some incompatibilities with large extended attributes (but it's still279       not 100% ok, I have no info on it and OS/2 doesn't want to create them)280 281       Rewritten allocation282 283       Fixed a bug with i_blocks (du sometimes didn't display correct values)284 285       Directories have no longer archive attribute set (some programs don't like286       it)287 288       Fixed a bug that it set badly one flag in large anode tree (it was not289       destructive)2901.95   Fixed one buffer leak, that could happen on corrupted filesystem291 292       Fixed one bug in allocation in 1.942931.96   Added workaround for one bug in OS/2 (HPFS locked up, HPFS386 reported294       error sometimes when opening directories in PMSHELL)295 296       Fixed a possible bitmap race297 298       Fixed possible problem on large disks299 300       You can now delete open files301 302       Fixed a nondestructive race in rename3031.97   Support for HPFS v3 (on large partitions)304 305       ZFixed a bug that it didn't allow creation of files > 128M306       (it should be 2G)3071.97.1 Changed names of global symbols308 309       Fixed a bug when chmoding or chowning root directory3101.98   Fixed a deadlock when using old_readdir311       Better directory handling; workaround for "unbalanced tree" bug in OS/23121.99   Corrected a possible problem when there's not enough space while deleting313       file314 315       Now it tries to truncate the file if there's not enough space when316       deleting317 318       Removed a lot of redundant code3192.00   Fixed a bug in rename (it was there since 1.96)320       Better anti-fragmentation strategy3212.01   Fixed problem with directory listing over NFS322 323       Directory lseek now checks for proper parameters324 325       Fixed race-condition in buffer code - it is in all filesystems in Linux;326       when reading device (cat /dev/hda) while creating files on it, files327       could be damaged3282.02   Workaround for bug in breada in Linux. breada could cause accesses beyond329       end of partition3302.03   Char, block devices and pipes are correctly created331 332       Fixed non-crashing race in unlink (Alexander Viro)333 334       Now it works with Japanese version of OS/23352.04   Fixed error when ftruncate used to extend file3362.05   Fixed crash when got mount parameters without =337 338       Fixed crash when allocation of anode failed due to full disk339 340       Fixed some crashes when block io or inode allocation failed3412.06   Fixed some crash on corrupted disk structures342 343       Better allocation strategy344 345       Reschedule points added so that it doesn't lock CPU long time346 347       It should work in read-only mode on Warp Server3482.07   More fixes for Warp Server. Now it really works3492.08   Creating new files is not so slow on large disks350 351       An attempt to sync deleted file does not generate filesystem error3522.09   Fixed error on extremely fragmented files353====== =========================================================================354