Cleanup, add and fix source.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@18 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Jim Tabor 2000-05-17 19:15:12 +00:00
parent 0359f6e0aa
commit 504c1b3c02
11 changed files with 228 additions and 83 deletions

View File

@ -1,3 +1,23 @@
2000 May 17 - Build 2020
-------- James Tabor (jimtabor@infohwy.com)
+ Fixed Delete, Rename, Mkdir, and Rmdir. Comment out isDevice. There is
a serious bug in isDevice.
+ Added Finished adding function code for disk serial number support.
+ Clean Cleaned up source and removed duplicate functions.
2000 May 14 - Build 2020
-------- James Tabor (jimtabor@infohwy.com)
+ Clean Cleaned out the remaining CR's.
2000 May 08 - Build 2020
-------- James Tabor (jimtabor@infohwy.com)
+ Update Started Update to the New CVS at Sourceforge.net. Seting source
from 2018 to 2020.
2000 May 06
-------- Jim Hall (jhall1.isd.net)
+ Import Jim Hall imported the CVS from gcfl.net to Sourceforge.net.
2000 Apr 28 - Build 2020
-------- James Tabor (jimtabor@infohwy.com)
+ Added Dos Function calls 0x69, and 0x6C. IOCTL support in disk driver.

View File

@ -4,9 +4,9 @@ Version: 1.1.20
Entered-date: 5 May 2000
Description: The FreeDOS Kernel.
Keywords: kernel freedos dos msdos
Author: kernel@gcfl.net (developers)
Maintained-by: linux-guru@gcfl.net
Primary-site: http://www.gcfl.net/pub/FreeDOS/kernel
Author: (developers)
Maintained-by: jimtabor@infohwy.com
Primary-site: http://freedos.sourceforge.net
Alternate-site: www.freedos.org
Original-site: http://www.gcfl.net/pub/FreeDOS/kernel
Platforms: dos dosemu

View File

@ -34,9 +34,16 @@ static BYTE *dosfnsRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.2 2000/05/08 04:29:59 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.14 2000/04/02 05:01:08 jtabor
* Replaced ChgDir Code
*
@ -490,6 +497,8 @@ UCOUNT DosWrite(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode)
{
ULONG data;
/* Test for invalid mode */
if (mode < 0 || mode > 2)
return DE_INVLDFUNC;
@ -500,7 +509,9 @@ COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode)
{
if (mode == 2) {
/* seek from end of file */
int2f_Remote_call(REM_LSEEK, 0, (UWORD) FP_SEG(new_pos), (UWORD) FP_OFF(new_pos), (VOID FAR *) s, 0, 0);
int2f_Remote_call(REM_LSEEK, 0, (UWORD) FP_SEG(new_pos), (UWORD) FP_OFF(new_pos), (VOID FAR *) s, 0, (VOID FAR *)&data);
s->sft_posit = data;
return SUCCESS;
}
if (mode == 0) {
@ -1007,7 +1018,6 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
COUNT DosGetCuDir(COUNT drive, BYTE FAR * s)
{
REG struct cds FAR *cdsp;
REG WORD x;
/* next - "log" in the drive */
drive = (drive == 0 ? default_drive : drive - 1);
@ -1024,8 +1034,7 @@ COUNT DosGetCuDir(COUNT drive, BYTE FAR * s)
return DE_INVLDDRV;
}
x = 1 + cdsp->cdsJoinOffset;
fsncopy((BYTE FAR *) & cdsp->cdsCurrentPath[x], s, 64);
fsncopy((BYTE FAR *) & cdsp->cdsCurrentPath[1 + cdsp->cdsJoinOffset], s, 64);
return SUCCESS;
}
@ -1246,21 +1255,20 @@ BYTE DosSelectDrv(BYTE drv)
COUNT DosDelete(BYTE FAR *path)
{
COUNT result, drive;
/*
if (IsDevice(path)) {
return DE_PATHNOTFND;
}
drive = get_verify_drive(path);
*/
drive = get_verify_drive(path);
if (drive < 0) {
return drive;
}
result = truename(path, PriPathName, FALSE);
if (result != SUCCESS) {
result = truename(path, PriPathName, FALSE);
if (result != SUCCESS) {
return result;
}
current_ldt = &CDSp->cds_table[drive];
current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_DELETE, 0, 0, 0, 0, 0, 0);
result = -result;
@ -1273,20 +1281,22 @@ COUNT DosDelete(BYTE FAR *path)
COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
{
COUNT result, drive1, drive2;
if (IsDevice(path1) || IsDevice(path2)) {
/*
if (IsDevice(path1) || IsDevice(path2)) {
return DE_PATHNOTFND;
}
drive1 = get_verify_drive(path1);
result = truename(path1, PriPathName, FALSE);
*/
drive1 = get_verify_drive(path1);
result = truename(path1, PriPathName, FALSE);
if (result != SUCCESS) {
return result;
}
drive2 = get_verify_drive(path2);
result = truename(path2, SecPathName, FALSE);
if (result != SUCCESS) {
drive2 = get_verify_drive(path2);
result = truename(path2, SecPathName, FALSE);
if (result != SUCCESS) {
return result;
}
if ((drive1 != drive2) || (drive1 < 0)) {
if ((drive1 != drive2) || (drive1 < 0)) {
return DE_INVLDDRV;
}
current_ldt = &CDSp->cds_table[drive1];
@ -1294,7 +1304,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
result = int2f_Remote_call(REM_RENAME, 0, 0, 0, 0, 0, 0);
result = -result;
} else {
result = dos_rename(path1, path2);
result = dos_rename(path1, path2);
}
return result;
}
@ -1302,11 +1312,12 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
COUNT DosMkdir(BYTE FAR * dir)
{
COUNT result, drive;
/*
if (IsDevice(dir)) {
return DE_PATHNOTFND;
}
drive = get_verify_drive(dir);
*/
drive = get_verify_drive(dir);
if (drive < 0) {
return drive;
}
@ -1314,7 +1325,7 @@ COUNT DosMkdir(BYTE FAR * dir)
if (result != SUCCESS) {
return result;
}
current_ldt = &CDSp->cds_table[drive];
current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_MKDIR, 0, 0, 0, 0, 0, 0);
result = -result;
@ -1327,11 +1338,12 @@ COUNT DosMkdir(BYTE FAR * dir)
COUNT DosRmdir(BYTE FAR * dir)
{
COUNT result, drive;
/*
if (IsDevice(dir)) {
return DE_PATHNOTFND;
}
drive = get_verify_drive(dir);
*/
drive = get_verify_drive(dir);
if (drive < 0) {
return drive;
}
@ -1339,7 +1351,7 @@ COUNT DosRmdir(BYTE FAR * dir)
if (result != SUCCESS) {
return result;
}
current_ldt = &CDSp->cds_table[drive];
current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_RMDIR, 0, 0, 0, 0, 0, 0);
result = -result;

View File

@ -33,6 +33,9 @@ static BYTE *dskRcsId = "$Id$";
/*
* $Log$
* Revision 1.4 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
@ -40,8 +43,8 @@ static BYTE *dskRcsId = "$Id$";
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
* Revision 1.4 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.6 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
@ -454,7 +457,7 @@ static WORD mediachk(rqptr rp)
{
if ((result = fl_readdasd(drive)) == 2) /* if we can detect a change ... */
{
if ((result = fl_diskchanged(drive)) == 1) /* check if it has changed... */
if ((result = fl_diskchanged(drive)) == 1) /* check if it has changed... */
rp->r_mcretcode = M_CHANGED;
else if (result == 0)
rp->r_mcretcode = M_NOT_CHANGED;
@ -470,12 +473,12 @@ static WORD mediachk(rqptr rp)
return S_DONE;
}
static WORD bldbpb(rqptr rp)
/*
* Read Write Sector Zero or Hard Drive Dos Bpb
*/
static WORD RWzero(rqptr rp, WORD t)
{
REG retry = N_RETRY;
ULONG count;
byteptr trans;
WORD local_word;
if (hd(miarray[rp->r_unit].mi_drive))
{
@ -493,10 +496,29 @@ static WORD bldbpb(rqptr rp)
do
{
if (!t) /* 0 == Read */
{
ret = fl_read((WORD) miarray[rp->r_unit].mi_drive,
(WORD) head, (WORD) track, (WORD) sector, (WORD) 1, (byteptr) & buffer);
}
else
{
ret = fl_write((WORD) miarray[rp->r_unit].mi_drive,
(WORD) head, (WORD) track, (WORD) sector, (WORD) 1, (byteptr) & buffer);
}
}
while (ret != 0 && --retry > 0);
return ret;
}
static WORD bldbpb(rqptr rp)
{
ULONG count, i;
byteptr trans;
WORD local_word;
ret = RWzero( rp, 0);
if (ret != 0)
return (dskerr(ret));
@ -514,8 +536,15 @@ static WORD bldbpb(rqptr rp)
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HIDDEN])), &bpbarray[rp->r_unit].bpb_hidden);
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HUGE])), &bpbarray[rp->r_unit].bpb_huge);
/* Needs fat32 offset code */
getlong(&((((BYTE *) & buffer.bytes[0x27])[0])), &fsarray[rp->r_unit].fs_serialno);
for(i = 0; i < 11 ;i++ )
fsarray[rp->r_unit].fs_volume[i] = buffer.bytes[0x2B + i];
for(i = 0; i < 8; i++ )
fsarray[rp->r_unit].fs_fstype[i] = buffer.bytes[0x36 + i];
#ifdef DSK_DEBUG
printf("BPB_NBYTE = %04x\n", bpbarray[rp->r_unit].bpb_nbyte);
@ -570,6 +599,7 @@ static COUNT write_and_verify(WORD drive, WORD head, WORD track, WORD sector,
static WORD IoctlQueblk(rqptr rp)
{
switch(rp->r_count){
case 0x0846:
case 0x0860:
case 0x0866:
break;
@ -628,17 +658,29 @@ static WORD Genblkdev(rqptr rp)
struct FS_info FAR * fs = &fsarray[rp->r_unit];
gioc->ioc_serialno = fs->fs_serialno;
for(i = 0; i < 12 ;i++ )
for(i = 0; i < 11 ;i++ )
gioc->ioc_volume[i] = fs->fs_volume[i];
for(i = 0; i < 9; i++ )
for(i = 0; i < 8; i++ )
gioc->ioc_fstype[i] = fs->fs_fstype[i];
}
break;
printf("DSK_IOCTL SN %lx \n" , &fs->fs_serialno);
printf("DSK_IOCTL SN %lx \n" , &fs->fs_volume);
printf("DSK_IOCTL SN %lx \n" , &gioc->ioc_serialno);
printf("DSK_IOCTL SN %lx \n" , &gioc->ioc_volume);
case 0x0846: /* set volume serial number */
{
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
struct FS_info FAR * fs = (struct FS_info FAR *) &buffer.bytes[0x27];
ret = RWzero( rp, 0);
if (ret != 0)
return (dskerr(ret));
fs->fs_serialno = gioc->ioc_serialno;
fsarray[rp->r_unit].fs_serialno = fs->fs_serialno;
ret = RWzero( rp, 1);
if (ret != 0)
return (dskerr(ret));
}
break;
default:

View File

@ -36,9 +36,16 @@ static BYTE *fatdirRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.12 2000/03/31 05:40:09 jtabor
* Added Eric W. Biederman Patches
*
@ -713,7 +720,17 @@ COUNT dos_findnext(void)
/* assign our match parameters pointer. */
dmp = (dmatch FAR *) dta;
nDrive = dmp->dm_drive;
/*
* The new version of SHSUCDX 1.0 looks at the dm_drive byte to
* test 40h. I used RamView to see location MSD 116:04be and
* FD f61:04be, the byte set with 0xc4 = Remote/Network drive 4.
* Ralf Brown docs for dos 4eh say bit 7 set == remote so what is
* bit 6 for? SHSUCDX Mod info say "test redir not network bit".
*
* So, assume bit 6 is redirector and bit 7 is network.
* jt
*/
nDrive = dmp->dm_drive & 0x3f;
if (nDrive > lastdrive) {
return DE_INVLDDRV;

View File

@ -30,9 +30,16 @@
; $Id$
;
; $Log$
; Revision 1.3 2000/05/17 19:15:12 jimtabor
; Cleanup, add and fix source.
;
; Revision 1.2 2000/05/08 04:30:00 jimtabor
; Update CVS to 2020
;
; $Log$
; Revision 1.3 2000/05/17 19:15:12 jimtabor
; Cleanup, add and fix source.
;
; Revision 1.4 2000/03/31 05:40:09 jtabor
; Added Eric W. Biederman Patches
;
@ -144,7 +151,9 @@ _int2f_Remote_call:
jne short int2f_r_2
int2f_r_1:
call int2f_call
jc int2f_rfner
jnc short int2f_skip1
jmp int2f_rfner
int2f_skip1:
les di,[bp+18] ; do return data stuff
mov [es:di],cx
jmp short int2f_rfner
@ -184,10 +193,20 @@ int2f_r_5:
pop ds
call int2f_call
pop ds
jc short int2f_rfner
xor ax,ax
jc short int2f_rfner
xor ax,ax
jmp short int2f_rfner
int2f_r_6:
cmp al,021h ; Lseek from eof
jne short int2f_r_7
call int2f_call
jc short int2f_rfner
les di,[bp+18]
mov [es:di],ax
mov [es:di+2],dx
xor ax,ax
jmp short int2f_rfner
int2f_r_7:
;
; everything else goes through here.
;

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.6 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.5 2000/05/11 06:14:45 jimtabor
* Removed #if statement
*
@ -49,11 +52,8 @@ BYTE *RcsId = "$Id$";
* Update CVS to 2020
*
* $Log$
* Revision 1.5 2000/05/11 06:14:45 jimtabor
* Removed #if statement
*
* Revision 1.4 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
* Revision 1.6 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.24 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
@ -1230,9 +1230,7 @@ dispatch:
/* Dos Rename */
case 0x56:
rc = DosRename(
(BYTE FAR *) MK_FP(r->DS, r->DX), /* OldName */
(BYTE FAR *) MK_FP(r->ES, r->DI)); /* NewName */
rc = DosRename((BYTE FAR *) MK_FP(r->DS, r->DX), (BYTE FAR *) MK_FP(r->ES, r->DI));
if (rc < SUCCESS)
goto error_exit;
else
@ -1595,7 +1593,7 @@ dispatch:
r->AL = 0xFF;
break;
#if 0
/* Extended Open-Creat, not fully functional.*/
case 0x6c:
switch(r->DL) {
@ -1683,8 +1681,8 @@ dispatch:
default:
goto error_invalid;
}
}
#endif
}
#ifdef DEBUG

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.4 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
@ -42,8 +45,8 @@ static BYTE *RcsId = "$Id$";
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
* Revision 1.4 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.4 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
@ -155,7 +158,6 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
r->BL = ( r->BL == 0 ? default_drive : r->BL - 1);
printf("IOCTL bl = %04x\n", r->BL);
if (r->BL > lastdrive)
{

View File

@ -39,9 +39,16 @@ static BYTE *mainRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.14 2000/03/31 05:40:09 jtabor
* Added Eric W. Biederman Patches
*
@ -176,6 +183,9 @@ INIT static VOID init_kernel(void)
/* Init oem hook - returns memory size in KB */
ram_top = init_oem();
/* Fake int 21h stack frame */
user_r = (iregs FAR *) DOS_PSP + 0xD0;
#ifndef KDB
for (i = 0x20; i <= 0x3f; i++)
setvec(i, empty_handler);

View File

@ -36,9 +36,16 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.5 2000/03/31 05:40:09 jtabor
* Added Eric W. Biederman Patches
*
@ -122,12 +129,13 @@ COUNT Remote_find(UWORD func, UWORD attrib, BYTE FAR * name, REG dmatch FAR * dm
printf("'\n");
#endif
}
fsncopy(dta, (BYTE FAR *) &TempBuffer, 21);
p = dta;
dta = (BYTE FAR *) &TempBuffer;
i = int2f_Remote_call(func, 0, 0, 0, 0, 0, 0);
dta = p;
fsncopy((BYTE FAR *) &TempBuffer[1], &dta[1], 20);
fsncopy((BYTE FAR *) &TempBuffer[0], &dta[0], 21);
if (i != 0)
return i;

View File

@ -31,9 +31,16 @@ static BYTE *mainRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/17 19:15:12 jimtabor
* Cleanup, add and fix source.
*
* Revision 1.8 2000/04/02 06:11:35 jtabor
* Fix ChgDir Code
*
@ -208,22 +215,22 @@ COUNT get_verify_drive(char FAR *src)
* Added support for external and internal calls.
* Clean buffer before use. Make the true path and expand file names.
* Example: *.* -> ????????.??? as in the currect way.
* MSD returns \\D.\A.\????????.??? with SHSUCDX. So, this code is not
* compatible MSD Func 60h.
*/
COUNT truename(char FAR * src, char FAR * dest, COUNT t)
{
static char buf[128] = "A:\\";
static char buf[128] = "A:\\\0\0\0\0\0\0\0\0\0";
char *bufp = buf + 3;
COUNT i, n, x = 2;
BYTE far *test;
REG struct cds FAR *cdsp;
struct cds FAR *cdsp;
fbcopy((VOID FAR *) "A:\\\0\0\0\0\0\0\0", (VOID FAR *) buf, 10);
dest[0] = '\0';
/* First, adjust the source pointer */
/* First, adjust the source pointer */
src = adjust_far(src);
/* Do we have a drive? */
/* Do we have a drive? */
if (src[1] == ':')
{
buf[0] = (src[0] | 0x20) + 'A' - 'a';
@ -268,24 +275,25 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
}
else
src++;
/*
* The code here is brain dead. It works long as the calling
* function are operating with in normal parms.
* jt
*/
n = 9;
/* convert all forward slashes to backslashes, and uppercase all characters */
while (*src)
{
char c;
c = *src++;
if(!n)
return DE_PATHNOTFND; /* do this for now */
n--;
switch (c)
{
/* added *.*, *., * support.
*/
/* This doesn't expand cases like: foo*.* corrrectly
* disable it for now.
*/
#if 1
case '*':
if (*src == '.')
{
n = 8;
while (n--)
*bufp++ = '?';
break;
@ -294,25 +302,24 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
{
if (src[-2] == '.')
{
n = 3;
while (n--)
*bufp++ = '?';
break;
}
else
{
n = 8;
while (n--)
*bufp++ = '?';
break;
}
}
#endif
case '/': /* convert to backslash */
case '\\':
if (bufp[-1] != '\\')
*bufp++ = '\\';
if (bufp[-1] != '\\'){
*bufp++ = '\\';
n = 9;
}
break;
/* look for '.' and '..' dir entries */
@ -333,10 +340,20 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
bufp++;
}
else if (*src == '/' || *src == '\\' || *src == 0)
--bufp;
break;
/* --bufp;*/
else
return DE_PATHNOTFND;
}
else
*bufp++ = c;
else if ( *src == '/' || *src == '\\' || *src == 0)
{
break;
}
else
{
n = 4;
*bufp++ = c;
}
break;
default: