Commit Graph

86 Commits

Author SHA1 Message Date
Bart Oldeman
f9f2fe447d Eliminate dos_getftime, dos_getfsize, and dos_getfattr_fd, because we can
now get these properties directly from the SFT.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1399 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 13:59:44 +00:00
Bart Oldeman
e63e5dd125 Eliminate f_count field in fnodes and some no-op functions.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1398 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 13:47:52 +00:00
Bart Oldeman
d7d201a53b This is the main change to eliminate far fnodes.
SFT info is copied from and to the two near fnodes.
Some cleanups still follow.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1397 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 13:24:14 +00:00
Bart Oldeman
affddaaf64 Handle dos_getfattr and dos_setfattr directly at the directory level, instead
of opening the file, to avoid needing to claim SFTs in later changes.
Clarify and implement parts of the correct SHARE behaviour.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1393 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-23 02:04:03 +00:00
Bart Oldeman
7083b0a4fa On close or commit, only update those directory entry fields that have an
SFT equivalent. The rest stays unmodified on disk.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1392 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-22 00:25:11 +00:00
Bart Oldeman
ba75006b67 Use explicit dir_write() instead of letting dir_close() do the writing.
This is to prepare for an updating version to deal with SFTs.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1391 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-22 00:01:27 +00:00
Bart Oldeman
2092745236 Force near fnode use to use either fnode[0] or fnode[1] instead of the
allocation scheme. This eliminates the checks done in inthndlr.c because
the f_count field is no longer checked.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1389 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-20 18:13:37 +00:00
Kenneth J Davis
01cc83bc82 From Eric, reduce unnecessary calls to share hook, only re-check (int 2f/1000) on open/close, not on each access
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1379 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-11 22:04:43 +00:00
Eric Auer
26f116a217 More secure FAT handling: Avoids risk of cross links for example if
you reboot while files are open... Reported by Hardi Stengelin :-).

Always test *link_fat* result. New function is_free_cluster.  Extra
checks in *link_fat* (bad r/w offset, i/o, write) and *next_cluster*
(dangling chain: bad value in chain) with short messages (no msg for
bad chain start). Shorter "Bad DPB" (FAT size) msg.  More comments!

Update FS INFO on disk only when needed.  Check if chain EOF was at
expected place when extending.  Call *link_fat* before! *setdstart*
when a FAT chain grows.   [Q: Does 0 byte write always trunc? Why?]


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1358 6ac86273-5f31-0410-b378-82cca8765d1b
2008-03-08 20:31:37 +00:00
Eric Auer
cf05259924 Removed "Dutch plurals" ("Dutch plural's" ;-)) from the source code:
kernel/fatfs.c kernel/config.c kernel/kernel.asm kernel/initdisk.c
kernel/fattab.c kernel/dyninit.c kernel/int2f.asm kernel/memmgr.c
kernel/task.c kernel/dsk.c kernel/printer.asm kernel/globals.h
kernel/dosfns.c docs/config.txt hdr/device.h drivers/rdpcclk.asm


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1338 6ac86273-5f31-0410-b378-82cca8765d1b
2007-07-20 20:52:33 +00:00
Bart Oldeman
2466934534 Fix OW 1.6 warnings about functions redeclared as 'static'.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1308 6ac86273-5f31-0410-b378-82cca8765d1b
2007-05-15 00:05:41 +00:00
Bart Oldeman
818e1bf0da Fix OW warnings about "unsigned int <= 0".
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1307 6ac86273-5f31-0410-b378-82cca8765d1b
2007-05-14 23:53:46 +00:00
Kenneth J Davis
790ad53fee don't leave fd open when failing DIR bit check
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1124 6ac86273-5f31-0410-b378-82cca8765d1b
2005-04-10 15:00:37 +00:00
Kenneth J Davis
4dcdd071e5 bug 1874 fix, do not consider setting DIR bit an error for int 21/4301=set attribute, if really is a directory
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1123 6ac86273-5f31-0410-b378-82cca8765d1b
2005-04-05 15:08:30 +00:00
Kenneth J Davis
c41380e578 merge from dev kernel, Jason Hood's patch for extended DPBs and Set Extended Error function
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1120 6ac86273-5f31-0410-b378-82cca8765d1b
2005-03-06 16:58:33 +00:00
Kenneth J Davis
99f863a28f merge in some changes from UNSTABLE, batch files no change just line ending issue
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1036 6ac86273-5f31-0410-b378-82cca8765d1b
2004-09-12 04:46:28 +00:00
Bart Oldeman
24d27f2f9b From Tom: must set r_bpfat for C_BLDBPB, otherwise USBASPI.SYS, DI1000DD.SYS
won't like us. From Lucho: use DiskTransferBuffer for deblock_buf.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@943 6ac86273-5f31-0410-b378-82cca8765d1b
2004-05-23 15:10:08 +00:00
Bart Oldeman
de5bed6d28 From Lucho: converted TM_ENCODE into a function. Various cleanups in fatfs.c
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@942 6ac86273-5f31-0410-b378-82cca8765d1b
2004-05-23 15:00:37 +00:00
Bart Oldeman
42c0af3aee Inlined dos_setdta. Various bug fixes and cleanups from Lucho and Arkady.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@941 6ac86273-5f31-0410-b378-82cca8765d1b
2004-05-23 14:49:11 +00:00
Bart Oldeman
99d287bd2c fattab.c now remembers if the old FAT entry was free or not, so the free
space adjustment could be moved back to fattab.c.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@921 6ac86273-5f31-0410-b378-82cca8765d1b
2004-05-04 09:43:06 +00:00
Bart Oldeman
ecfcb9be29 dir_read() no longer updates the diroff counter. This eliminates the NEW
field, simplifies remove_lfn_entries(), and avoids a bug if you delete
the first entry in the root directory on FAT32.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@911 6ac86273-5f31-0410-b378-82cca8765d1b
2004-04-30 17:14:33 +00:00
Bart Oldeman
5d712fc2a6 Avoid bitfields for fnodes, using flags instead.
Replaced droot field by checks for f_dirstart == 0.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@867 6ac86273-5f31-0410-b378-82cca8765d1b
2004-04-13 10:46:37 +00:00
Bart Oldeman
eed84806f8 dos_commit was missing a save_far_f_node() call. That caused the tar xzvf
problem. Also fixed the case when no far fnodes are available anymore.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@837 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-27 17:12:16 +00:00
Bart Oldeman
0f4d6ea6a1 Define O_ACCMODE and use it instead of "3" for the open access mask.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@828 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-26 23:20:55 +00:00
Bart Oldeman
416e1014cf Declare save_far_fnode before use.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@823 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-25 00:42:27 +00:00
Bart Oldeman
f63eea565a Made the main fnodes far so they can be in UMBs.
Internally the kernel uses two near fnodes though, to save on codesize
and fmemcpy's if necessary. Having memory management on two fnodes is
a little silly but I just want to make sure with the panic message
that we never accidentally try to use three near fnodes at the same time.
(two are used at the same time by rename, commit, and merge_file_changes).
This can be cleaned up later.

Anyway. 644736 bytes free conv memory isn't bad.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@821 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-23 22:45:38 +00:00
Bart Oldeman
d39d3a84f4 Merge three almost identical pieces of code used to allocate a new
directory entry in creat, rename, and mkdir, into alloc_find_free.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@819 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-23 01:36:16 +00:00
Bart Oldeman
05cd65a193 Merge find_fat_free() and extend() -- they were almost identical.
Have a simplified clause for f_cluster == FREE.
Set f_cluster = FREE in shrink_file if the file is set to 0 bytes; in
that case we should set the current cluster to FREE even if it is
currently a LONG_LAST_CLUSTER.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@818 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-23 00:45:24 +00:00
Bart Oldeman
ce290a033f Eliminate f_back field.
extend() now uses f_cluster instead of f_back, while map_cluster makes
sure it's not set to LONG_LAST_CLUSTER (but to the cluster before it)
when calling extend().
extend() and first_fat() now return the new cluster number or
LONG_LAST_CLUSTER, just like find_fat_free()
Hopefully I didn't break anything... Initial testing was successful.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@816 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-22 22:33:05 +00:00
Bart Oldeman
df538bb32a Eliminated f_sector and f_boff fields from fnodes.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@814 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-22 16:56:34 +00:00
Bart Oldeman
b0009452ee Remove add_far. adjust_far can do the job.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@813 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-22 16:38:46 +00:00
Bart Oldeman
c73ee8084a Remove the 65535 check for root directories. It's checked against
a different limit later anyway later, and it breaks remove_lfn_entries...


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@812 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-22 15:43:56 +00:00
Bart Oldeman
11a7b69e5c Make f_diroff an entry offset so it can be 16bits. Enforce the 65536
entry limit in dir_read(). Saves 80 bytes or so + 2 bytes in every f_node.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@811 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-22 10:29:26 +00:00
Bart Oldeman
82261c0caf add_far can get away with adding 16 bit offsets only. Saves ~200 bytes!
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@807 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-21 13:56:13 +00:00
Bart Oldeman
0d6d0b8523 (with Lucho) -- remove the dosnames path 67 length check. Review the places
where it really matters (chdir and mkdir).


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@796 6ac86273-5f31-0410-b378-82cca8765d1b
2004-03-07 12:59:38 +00:00
Bart Oldeman
0e0abcd685 Added explicit (UWORD) type casts to avoid compiler warnings and sometimes
save a few bytes too. Also changed the FcbParseFname return value:
returns offset portion of pointer (SI) instead of the number of bytes to
be added to SI.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@775 6ac86273-5f31-0410-b378-82cca8765d1b
2004-02-07 18:04:50 +00:00
Bart Oldeman
5567aba08b Fixed bug #1722: dir_close() was called for normal files (via map_cluster
and find_fat_free). This completely messed up rwblock. Removed these calls
(for directories they are already covered at a higher level) and added
a few sanity checks to dir_close and dir_write.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@761 6ac86273-5f31-0410-b378-82cca8765d1b
2004-01-27 23:18:24 +00:00
Bart Oldeman
4f1a117069 * FAT32 kernels should ignore the upper word of the cluster number for
FAT16 partitions (just like FAT16 kernels do)
* added extra checks to make sure that invalid FAT entries are never
  followed
* made put_console() public to be able to print a message in case of
  FAT corruption
* some small optimizations and header cleanups (some suggested by Arkady)


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@753 6ac86273-5f31-0410-b378-82cca8765d1b
2004-01-26 00:51:49 +00:00
Bart Oldeman
ef3e38de7b Rename blockio by rqblockio (namespace conflict with dsk.c)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@734 6ac86273-5f31-0410-b378-82cca8765d1b
2003-12-02 23:34:43 +00:00
Bart Oldeman
a56e592871 Move permission check to better place (only for necessary for opening
existing files), not for creating them -- suggested by Steffen.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@727 6ac86273-5f31-0410-b378-82cca8765d1b
2003-11-23 18:03:35 +00:00
Bart Oldeman
3232712fae force r/o open for FCB and legacy creat if the file is read-only
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@726 6ac86273-5f31-0410-b378-82cca8765d1b
2003-11-16 16:21:29 +00:00
Bart Oldeman
09dca9d224 Move common code in media_check() to a new blockio() function.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@724 6ac86273-5f31-0410-b378-82cca8765d1b
2003-10-30 14:34:39 +00:00
Bart Oldeman
bdc5569995 Set the Critical Error number immediately after calling a device driver.
This solves problems with int24 handlers that call int21/ah=59.
Let truename and blockrw return with an error if there is a critical error.
Don't overwrite the critical error # with the DOS error #.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@709 6ac86273-5f31-0410-b378-82cca8765d1b
2003-09-24 19:34:11 +00:00
Bart Oldeman
bef6672954 Use 0x10000UL (avoids Turbo C warning)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@667 6ac86273-5f31-0410-b378-82cca8765d1b
2003-08-31 10:22:32 +00:00
Bart Oldeman
c444161296 Use near bpb on the stack in bpb_to_dpb.
Make sure the number of FAT sectors is actually enough to hold that
many clusters. Otherwise back the number of clusters down (LG & AB)


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@655 6ac86273-5f31-0410-b378-82cca8765d1b
2003-08-28 20:30:09 +00:00
Bart Oldeman
a4abd642bf Fix buffer deletion problem with multi-sector writes.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@611 6ac86273-5f31-0410-b378-82cca8765d1b
2003-06-17 08:38:20 +00:00
Bart Oldeman
355580dded Eliminate highwater fnode field.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@540 6ac86273-5f31-0410-b378-82cca8765d1b
2003-03-12 23:29:08 +00:00
Bart Oldeman
b43f271014 "rmdir" and FAT32 fixes from Tom.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@499 6ac86273-5f31-0410-b378-82cca8765d1b
2003-02-20 20:51:42 +00:00
Bart Oldeman
e67a8f5058 Changes for kernel 2028 (see history.txt)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@485 6ac86273-5f31-0410-b378-82cca8765d1b
2002-12-09 00:17:15 +00:00
Bart Oldeman
83b77cbb1b Changes for kernel 2027rc.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@427 6ac86273-5f31-0410-b378-82cca8765d1b
2002-10-22 02:40:19 +00:00