Bart Oldeman
8b07bb8c23
Check the BPB instead of the DPB for FAT32 after a BUILDBPB device
...
call, as the DPB may still be uninitialized at this point.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1490 6ac86273-5f31-0410-b378-82cca8765d1b
2009-07-18 14:05:26 +00:00
Bart Oldeman
9e1e01e9e6
If the current directory is no longer valid, call dos_cd() for the root to
...
update the CDS cluster. Call media_check explicitly in truename() as a central
first and only place in directory-using DOS calls (except DosFindNext)
to call it.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1473 6ac86273-5f31-0410-b378-82cca8765d1b
2009-07-05 21:21:14 +00:00
Bart Oldeman
924f6d1bfd
In case of "not sure" if the removable media has changed, the
...
IBM PCDOS technical reference says to call BLDBPB if there are no used
buffers, so we only do it then, instead of flushing the buffers.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1458 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-26 20:12:33 +00:00
Bart Oldeman
6aa1e45bd8
Set the clean bit also on created/replaced files, not just opened files, so
...
the directory entry is only updated after they are written too.
Fixes SF bug #2380531 .
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1453 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-18 16:42:03 +00:00
Bart Oldeman
e3f90446b3
initdisk: further optimizations in CalculateFATData(): merging the FAT16 & FAT32
...
loops.
fatfs: #if DEBUG fix.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1451 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-17 20:37:26 +00:00
Bart Oldeman
132b1fe579
Cluster optimizations, mainly for FAT32: eliminated checkdstart,
...
replaced (cl == FREE || cl == 1) by (cl <= 1), UWORD cluster cast for FAT12/16,
and merge if branches for link_fat().
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1448 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-16 21:45:17 +00:00
Bart Oldeman
d854929efb
Merged if status==S_OPENED logic in dos_open, cache dir_attrib, and remove
...
unnecessary init to 0.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1447 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-16 20:13:41 +00:00
Bart Oldeman
5252faa425
Optimization: changed find_fname() to call split_path() because find_fname
...
was always preceeded by split_path(). The return code is now an error code,
DE_FILENOTFND, DE_PATHNOTFND, or SUCCESS, depending on the failure.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1445 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-16 15:22:16 +00:00
Bart Oldeman
d20b59ebe0
Added a split boolean argument to dir_open so the trick with setting the
...
dir/filename separator to 0 can be avoided, and we don't need to calculate
its location in split_path(). Without the trick many more char * path
arguments in the kernel can become "const char *".
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1444 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-13 04:31:55 +00:00
Bart Oldeman
78fc7a1e6d
Remove dosnames.c and inline ParseDosName, because there is only one user left
...
(split_path()) which only uses it to find out if the path ends in a backslash
and the length of the directory part.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1442 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-13 04:01:01 +00:00
Bart Oldeman
60915d3cd0
dos_findfirst() now uses split_path(). The only thing that needed to be
...
added was the need to check for "d:\" paths which return DE_NFILES.
Also, findfirst("d:\nonexist\*.*",D_VOLID) should fail even if it actually
searches in d:\.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1441 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-13 03:44:50 +00:00
Bart Oldeman
f5696a4a7e
For read/write don't update sft_posit in dosfns.c anymore so fatfs.c takes
...
care of it.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1437 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-11 13:25:32 +00:00
Bart Oldeman
76c967d581
Remove usage of the fnode f_flags field where it is not relevant anymore.
...
Because of the explicit dir_write() calls we only need them in situations
where SFTs where used, that is for open files but not for directories.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1436 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-11 12:33:30 +00:00
Bart Oldeman
3a16a4c755
Eliminate fcbname[] on the stack: we can use dm_name_pat in the dirmatch
...
structures instead.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1435 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-10 21:08:16 +00:00
Bart Oldeman
a21bcd8a85
Split 8.3 FCB-style filename extraction from ParseDosName into a new
...
ConvertNameSZToName83 function, also used by dir_open().
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1433 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-10 19:02:24 +00:00
Bart Oldeman
8e2b96a70b
Move the fnode fields f_diroff and f_dirstart into a referenced directory
...
match structure with fields dm_entry and dm_dircluster.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1432 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-10 16:10:54 +00:00
Bart Oldeman
f57099220b
Introduce clear_dir() to clear a directory, this was code shared between
...
dos_mkdir() and extend_dir(). Now dos_mkdir() calls this function to clear
the new directory, and then creates the . and .. entries using higher level
functions instead of dealing with the blocks directly.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1421 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-05 14:53:05 +00:00
Bart Oldeman
ec30074f48
Make the fnode f_flags completely equal to the SFT sft_flags.
...
Rename SFT_FDIRTY to SFT_FCLEAN to avoid confusion.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1420 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-05 00:06:05 +00:00
Bart Oldeman
fedf951beb
Eliminate the fnode F_DDIR flag which has no SFT equivalent:
...
f_sft_idx==0xff can do the same. rwblock() is never called for directories
so the checks could be removed.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1419 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-04 23:40:17 +00:00
Bart Oldeman
60e8c56f91
Flip target and source checks to avoid calling ParseDosName for in-directory
...
renames. Do not allow to rename directories between different directories.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1418 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-03 12:24:16 +00:00
Bart Oldeman
063c57e237
RENAME: if the source and target directories are the same, rename the directory
...
entry in-place instead of creating a new one and deleting the old one.
Fixes archived bugzilla bug:
http://www.freedos.org/bugzilla/cgi-bin/show_bug.cgi?id=1908
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1417 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-03 03:11:23 +00:00
Bart Oldeman
4a6e5677ad
Change dos_rmdir to only use 1 fnode. It now first checks if the directory
...
is empty and then opens the parent and deletes the real directory.
No longer returns DE_FILENOTFND(2), but return DE_PATHNOTFND(3) instead.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1416 6ac86273-5f31-0410-b378-82cca8765d1b
2009-06-03 01:01:47 +00:00
Bart Oldeman
2fb8715bdc
Fix compilation with Turbo C.
...
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1411 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-29 00:50:28 +00:00
Bart Oldeman
5b46738372
Eliminate dir_close().
...
Its only purpose left was to flush buffers, which isn't necessary after
just open/read, so we can move that to dir_write().
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1410 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-29 00:25:38 +00:00
Bart Oldeman
1cc33a1a5e
Move the open/creat access checks to more efficient places.
...
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1409 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-29 00:03:27 +00:00
Bart Oldeman
7b89e44274
Make merge_file_changes more direct dealing with SFTs and merge the
...
"close open files setfattr wants to change" functionality there.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1408 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-28 18:33:22 +00:00
Bart Oldeman
a0382d32e4
Eliminate dos_setfsize, dos_setftime, and dos_lseek, by just using the SFT.
...
dos_setfsize still needed to merge changes for SHARE so the call was replaced
by a new dos_merge_file_changes() call.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1405 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 20:44:44 +00:00
Bart Oldeman
76f1c10a4e
Eliminate xlt_fd(), save_far_f_node(), and the redundant fnode f_mode field.
...
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1404 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 18:34:05 +00:00
Bart Oldeman
4a81e6e9a2
Let merge_file_changes operate directly on the other SFTs.
...
dos_setfattr with SHARE now closes open SFTs referring to that file
in compat mode.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1403 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 18:23:35 +00:00
Bart Oldeman
386fc961e3
Fix SFT/fnode fields so the SHARE related functions is_same_file() and
...
merge_file_changes() work.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1402 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 16:49:57 +00:00
Bart Oldeman
c179284147
Remove redundant checks for fnodes==0 since the checks are done in dosfns.c.
...
Replace global f_nodes[] array by f_sft_idx fields in the fnodes.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1401 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 14:44:44 +00:00
Bart Oldeman
a69b4ba011
Eliminate the sft_status field as it is now equal to the SFT index.
...
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1400 6ac86273-5f31-0410-b378-82cca8765d1b
2009-05-26 14:11:50 +00:00
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