delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/07/05:38:20

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200101071038.LAA22854@father.ludd.luth.se>
Subject: df <-> df r:/
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Sun, 7 Jan 2001 11:38:14 +0100 (MET)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

r: is my CDROM/DVD-ROM drive.

If I run "df" with a CDROM in it it works fine. If I run "df" with a
DVD-ROM it skips the r: drive. If I call "statfs("r:/", &buf)" (with a
DVD-ROM) it works. If I run "df r:/" (with a DVD-ROM) it works.

I've traced the problem to this fragment of function cdrom_drive_ready
in src/libc/compat/mntent/mntent.c:

  /* Put control block into the transfer buffer.  */
  _farpokeb(_dos_ds, __tb, 6);  /* read device status */
  _farpokel(_dos_ds, __tb + 1, 0);      /* zero out the result field */

  /* Put request header into the transfer buffer and call the driver.  */
  dosmemput(request_header, sizeof (request_header), __tb + 5);
  r.x.ax = 0x1510;
  r.x.cx = drive_num - 1;
  r.x.es = __tb_segment;
  r.x.bx = __tb_offset + 5;
  __dpmi_int(0x2f, &r);
  status = _farpeekw(_dos_ds, __tb + 5 + 3);
  dev_status = _farpeekl(_dos_ds, __tb + 1);
  if (status == 0x100 && _farpeekw (_dos_ds, __tb + 5 + 0x12) == 5
      && (dev_status & 0x801) == 0) /* door open and drive empty bits */
    return 1;
  return 0;


I've inserted print-outs of status and dev_status.

For a CDROM I get status = 256, dev_status = 912. For a DVD-ROM I get
status = 768, dev_status = 1940, unless I previously had a CDROM in
the drive. In that case I get status = 256, dev_status = 1940!

For an audio CD I get status = 768, dev_status = 17296, unless I'm
very quick with df. Then I get 256, dev_status = 912.

The first thing that should be adjusted is "status == 0x100" above to
"( status & 0x100 )".

Any comments?


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019