; 2009.01.20 clipboard sharing
; 2009.12.27 console hook
; 2010.05.27 Z3Chip
+; 2011.12.17 built-in CDFS support
AllocMem = -198
FreeMem = -210
residenthack
movem.l d0-d2/a0-a2/a6,-(sp)
+
+ move.w #$FF38,d0
+ moveq #17,d1
+ bsr.w getrtbase
+ jsr (a0)
+ tst.l d0
+ beq.s .rsh
+
move.l 4.w,a6
cmp.w #37,20(a6)
bcs.s .rsh
move.l d0,a4
tst.l $10c(a5)
- beq.s FSIN_none
+ beq.w FSIN_none
move.l #PP_TOTAL,d0
move.l #$10001,d1
jsr AllocMem(a6)
move.l d0,a3 ; param packet
move.l a4,PP_EXPLIB(a3)
+
moveq #0,d6
FSIN_init_units:
- cmp.l $10c(a5),d6
+ cmp.w $10e(a5),d6
bcc.b FSIN_units_ok
move.l d6,-(sp)
FSIN_nextsub:
FSIN_nomoresub:
move.l (sp)+,d6
addq.w #1,d6
- bra.b FSIN_init_units
+ bra.b FSIN_init_units
FSIN_units_ok:
+
+ tst.w d5
+ beq.s CDIN_done
+ moveq #0,d6
+CDIN_init_units:
+ move.w $10c(a5),d0
+ btst d6,d0
+ beq.s CDIN_next
+ movem.l d6/a3,-(sp)
+ move.l a3,a0
+ bset #31,d6
+ bsr.w make_cd_dev
+ movem.l (sp)+,d6/a3
+CDIN_next:
+ addq.w #1,d6
+ cmp.w #8,d6
+ bne.s CDIN_init_units
+CDIN_done:
+
move.l 4.w,a6
move.l a3,a1
move.l #PP_TOTAL,d0
;FSIN_scandone:
; jsr -$007e(a6) ; Enable
-
filesys_dev_storeinfo
moveq #3,d4 ; MEMF_CHIP | MEMF_PUBLIC
cmp.w #36,20(a6)
FSIN_ksold
; add >2MB-6MB chip RAM to memory list
+ lea $210000,a1
+ ; do not add if RAM detected already
+ jsr -$216(a6) ; TypeOfMem
+ tst.l d0
+ bne.s FSIN_chip_done
move.w #$FF80,d0
bsr.w getrtbase
jsr (a0)
jsr -366(a6) ; PutMsg
bra.b EXTS_loop
EXTS_signal_reply:
- cmp.w #2,d0
- bgt.b EXTS_reply
+ cmp.w #2,d0
+ bgt.b EXTS_reply
move.l d1,d0
jsr -$144(a6) ; Signal
bra.b EXTS_loop
ree moveq #0,d7
bra.s r0
-fsres
+fsres:
movem.l d1/a0-a2/a6,-(sp)
move.l 4.w,a6
lea $150(a6),a0 ;ResourceList
tst.l (a0) ; eac_Entries == 0 -> get more
rts
+ ; mount CD drives using built-in AROS CDFS + uaescsi.device
+
+make_cd_dev: ; IN: A0 param_packet, D6: unit_no | 0x80000000 (=CD)
+ bsr.w fsres
+ move.l d0,PP_FSRES(a0) ; pointer to FileSystem.resource
+ move.l a0,-(sp)
+ move.w #$FFFC,d0 ; filesys base
+ bsr.w getrtbase
+ move.l (a0),a5
+ move.w #$FF28,d0 ; fill in unit-dependent info (filesys_dev_storeinfo)
+ bsr.w getrtbase
+ move.l a0,a1
+ move.l (sp)+,a0
+ clr.l PP_FSSIZE(a0) ; filesystem size
+ clr.l PP_FSPTR(a0) ; filesystem memory
+ jsr (a1)
+ tst.l d0
+ beq.w .fail
+
+ ; allocate memory for loaded filesystem
+ move.l PP_FSSIZE(a0),d0
+ beq.s .nofs
+ bmi.s .nofs
+ move.l a0,-(sp)
+ moveq #1,d1
+ move.l 4.w,a6
+ jsr AllocMem(a6)
+ move.l (sp)+,a0
+ move.l d0,PP_FSPTR(a0)
+ beq.w .fail
+.nofs
+
+ move.l a4,a6
+ move.l a0,-(sp)
+ jsr -144(a6) ; MakeDosNode()
+ move.l (sp)+,a0 ; parmpacket
+ move.l a0,a1
+ move.l d0,a3 ; devicenode
+ move.w #$FF20,d0 ; record in ui.startup (filesys_dev_remember)
+ bsr.w getrtbase
+ jsr (a0)
+ moveq #0,d0
+ move.l d0,8(a3) ; dn_Task
+ move.l d0,16(a3) ; dn_Handler
+ move.l d0,32(a3) ; dn_SegList
+
+ move.l PP_FSPTR(a1),d0
+ beq.s .nofs2
+ move.l d0,a0
+ bsr.w relocate
+ movem.l d0/a0-a1,-(sp)
+ move.l PP_FSSIZE(a1),d0
+ move.l PP_FSPTR(a1),a1
+ move.l 4.w,a6
+ jsr FreeMem(a6)
+ movem.l (sp)+,d0/a0-a1
+ bsr.w addfs
+.nofs2
+ move.w #$FF18,d0 ; update dn_SegList if needed (filesys_dev_bootfilesys)
+ bsr.w getrtbase
+ jsr (a0)
+
+ move.b 79(a1),d3 ; bootpri
+ cmp.b #-128,d3
+ beq.s .cdnoboot
+ move.l 4.w,a6
+ moveq #20,d0
+ move.l #65536+1,d1
+ jsr AllocMem(a6)
+ move.l d0,a1 ; bootnode
+ move.w #$1000,d0
+ or.b d3,d0
+ move.w d0,8(a1)
+ move.l $104(a5),10(a1) ; filesys_configdev
+ move.l a3,16(a1) ; devicenode
+ lea.l 74(a4),a0 ; MountList
+ jsr -$0084(a6) ;Forbid
+ jsr -270(a6) ; Enqueue()
+ jsr -$008a(a6) ;Permit
+ bra.s .fail
+.cdnoboot:
+ move.l a1,a2 ; bootnode
+ move.l a3,a0 ; parmpacket
+ moveq #0,d1
+ move.l d1,a1
+ moveq #1,d1 ; ADNF_STARTPROC (v36+)
+ moveq #-20,d0
+ move.l a4,a6 ; expansion base
+ jsr -150(a6) ; AddDosNode
+
+.fail:
+ rts
+
+ ; mount harddrives, virtual or hdf
make_dev: ; IN: A0 param_packet, D6: unit_no, D7: b0=autoboot,b1=onthefly,b2=v36+
; A4: expansionbase
mountalways
; allocate memory for loaded filesystem
move.l PP_FSSIZE(a0),d0
- beq.s nordbfs1
- bmi.s nordbfs1
+ beq.s .nordbfs1
+ bmi.s .nordbfs1
move.l a0,-(sp)
moveq #1,d1
move.l 4.w,a6
jsr AllocMem(a6)
move.l (sp)+,a0
move.l d0,PP_FSPTR(a0)
-nordbfs1:
+.nordbfs1:
tst.l d3
bpl.s do_mount
MKDV_doboot:
btst #0,d7
beq.b MKDV_noboot
+ cmp.b #-128,d3
+ beq.s MKDV_noboot
move.l 4.w,a6
- moveq.l #20,d0
- moveq.l #0,d1
+ moveq #20,d0
+ move.l #65536+1,d1
jsr AllocMem(a6)
move.l d0,a1 ; bootnode
- moveq #0,d0
- move.l d0,(a1)
- move.l d0,4(a1)
- move.w d0,14(a1)
move.w #$1000,d0
or.b d3,d0
move.w d0,8(a1)
move.l $104(a5),10(a1) ; filesys_configdev
- move.l a3,16(a1) ; devicenode
+ move.l a3,16(a1) ; devicenode
lea.l 74(a4),a0 ; MountList
+ jsr -$0084(a6) ;Forbid
jsr -270(a6) ; Enqueue()
+ jsr -$008a(a6) ;Permit
moveq #0,d0
rts
btst #2,d7
beq.s .nob
moveq #1,d1 ; ADNF_STARTPROC (v36+)
-.nob moveq #-20,d0
+.nob
+ moveq #-128,d0
move.l a4,a6 ; expansion base
jsr -150(a6) ; AddDosNode
btst #1,d7
bset #13,d0 ; SIGBREAK_CTRL_D
jsr -$013e(a6) ;Wait
.msg
- ; disk changed?
+ ; SIGBREAK_CTRL_D = disk change notification from native code
tst.b 172(a3)
beq.s .nodc
+ ; call filesys_media_change_reply (pre)
+ move.w #$ff58,d0 ; fsmisc_helper
+ bsr.w getrtbase
+ moveq #1,d0 ; filesys_media_change_reply
+ jsr (a0)
+ tst.l d0
+ beq.s .nodc2
bsr.w diskchange
+.nodc2
clr.b 172(a3)
+ ; call filesys_media_change_reply (post)
+ move.w #$ff58,d0 ; fsmisc_helper
+ bsr.w getrtbase
+ moveq #2,d0 ; filesys_media_change_reply
+ jsr (a0)
.nodc
move.l a4,d0
- beq.s FSML_loop
+ beq.s nonnotif
; notify reply?
cmp.w #38, 18(a4)
- bne.s nonotif
+ bne.s nonnotif
cmp.l #NOTIFY_CLASS, 20(a4)
- bne.s nonotif
+ bne.s nonnotif
cmp.w #NOTIFY_CODE, 24(a4)
- bne.s nonotif
+ bne.s nonnotif
move.l 26(a4),a0 ; NotifyRequest
move.l 12(a0),d0 ; flags
and.l #NRF_WAIT_REPLY|NRF_MAGIC,d0
move.l a4,a1
move.b #8,(a1)
jsr -366(a6) ; PutMsg
- bra.s FSML_loop
+ bra.w FSML_loop
nonoti
move.l a4,a1
moveq #38,d0
jsr FreeMem(a6)
bra.w FSML_loop
-nonotif
+nonnotif
+ moveq #-2,d2 ; lock timeout "done" value
+ move.l a4,d0
+ beq.s FSML_check_queue_other
move.l 10(a4),d3 ; ln_Name
bne.b FSML_FromDOS
+ moveq #-1,d2 ; normal "done" value
; It's a dummy packet indicating that some queued command finished.
move.w #$FF50,d0 ; exter_int_helper
bsr.w getrtbase
moveq.l #1,d0
jsr (a0)
+FSML_check_queue_other:
; Go through the queue and reply all those that finished.
lea.l 4(a3),a2
move.l (a2),a0
; This field may be accessed concurrently by several UAE threads.
; This _should_ be harmless on all reasonable machines.
move.l 4(a0),d0
- bpl.b FSML_check_next
+ cmp.l d0,d2
+ bne.b FSML_check_next
movem.l a0/a1,-(a7)
move.l 10(a0),a4
bsr.b ReplyOne
bsr.w action_exall
bne.s FSML_ReplyOne3
; Arghh.. we need more entries. (some buggy programs fail if eac_Entries = 0 with continue enabled)
- move.w #$ff58,d0
+ move.w #$ff58,d0 ; fsmisc_helper
bsr.w getrtbase
+ moveq #0,d0 ; exall
jsr (a0)
bra.s .exaretry
clipboard_init:
movem.l a5/a6,-(sp)
+
+ move.w #$FF38,d0
+ moveq #17,d1
+ bsr.w getrtbase
+ jsr (a0)
+ btst #0,d0
+ beq.s .noclip
+
move.l 4.w,a6
move.l #CLIP_END,d0
move.l #$10001,d1
moveq #-10,d0
move.l #10000,d1
bsr.w createproc
-
+.noclip
moveq #0,d0
movem.l (sp)+,a5/a6
rts
consolehook:
move.l 4.w,a6
+
moveq #-1,d2
move.w #$FF38,d0
- moveq #100,d1
+ moveq #17,d1
bsr.w getrtbase
jsr (a0)
- tst.l d0
+ btst #1,d0
beq.s .ch2
+
moveq #0,d2
jsr -$0084(a6) ;Forbid
lea 350(a6),a0 ;DeviceList
uaecptr filesys_initcode;
-static uae_u32 fsdevname, filesys_configdev;
-static uae_u32 cdfs_devname, cdfs_control;
+static uae_u32 fsdevname, fshandlername, filesys_configdev;
+static uae_u32 cdfs_devname, cdfs_handlername, cdfs_control;
static int filesys_in_interrupt;
static uae_u32 mountertask;
static int automountunit = -1;
TCHAR *devname; /* device name, e.g. UAE0: */
uaecptr devname_amiga;
uaecptr startup;
+ uaecptr devicenode;
TCHAR *volname; /* volume name, e.g. CDROM, WORK, etc. */
int volflags; /* volume flags, readonly, stream uaefsdb support */
TCHAR *rootdir; /* root native directory/hdf. empty drive if invalid path */
int is_hardfile (int unit_no)
{
- if (mountinfo.ui[unit_no].volname || mountinfo.ui[unit_no].wasisempty)
+ if (mountinfo.ui[unit_no].volname || mountinfo.ui[unit_no].wasisempty || mountinfo.ui[unit_no].unknown_media)
return FILESYS_VIRTUAL;
if (mountinfo.ui[unit_no].hf.secspertrack == 0) {
if (mountinfo.ui[unit_no].hf.flags & 1)
#define ACTION_MAKE_LINK 1021
#define ACTION_READ_LINK 1024
-#define DISK_TYPE 0x444f5301 /* DOS\1 */
-#define CDFS_DOSTYPE (USE_CDFS == 2 ? 0x43444653 : 0x43445644)
+#define DISK_TYPE_DOS 0x444f5300 /* DOS\0 */
+#define DISK_TYPE_DOS_FFS 0x444f5301 /* DOS\1 */
+#define CDFS_DOSTYPE 0x43440000 /* CDxx */
+//#define CDFS_DOSTYPE (USE_CDFS == 2 ? 0x43444653 : 0x43445644)
typedef struct {
uae_u32 uniq;
return (uae_u32)fs_fsize64 (fsf);
}
-static void set_volume_name (Unit *unit)
+static void set_highcyl (UnitInfo *ui, uae_u32 blocks)
+{
+ uaecptr startup = get_long (ui->devicenode + 7 * 4) << 2;
+ uaecptr env = get_long (startup + 8) << 2;
+ put_long (env + 10 * 4, blocks);
+}
+
+static void set_volume_name (Unit *unit, uae_u32 ctime)
{
int namelen;
int i;
for (i = 0; i < namelen; i++)
put_byte (unit->volume + 45 + i, s[i]);
put_byte (unit->volume + 45 + namelen, 0);
+ if (ctime) {
+ long days, mins, ticks;
+ get_time (ctime, &days, &mins, &ticks);
+ put_long (unit->volume + 16, days);
+ put_long (unit->volume + 20, mins);
+ put_long (unit->volume + 24, ticks);
+ }
xfree (s);
unit->rootnode.aname = unit->ui.volname;
unit->rootnode.nname = unit->ui.rootdir;
static int filesys_isvolume (Unit *unit)
{
- return get_byte (unit->volume + 44);
+ return get_byte (unit->volume + 44) || unit->ui.unknown_media;
}
static void clear_exkeys (Unit *unit)
u->newrootdir = my_strdup (rootdir);
if (volume)
u->newvolume = my_strdup (volume);
- filesys_eject(u->unit);
+ filesys_eject (u->unit);
if (!rootdir || _tcslen (rootdir) == 0)
u->reinsertdelay = 0;
if (u->reinsertdelay > 0)
ui->cdfs_superblock = u->ui.cdfs_superblock = NULL;
zfile_fclose_archive (u->zarchive);
u->zarchive = NULL;
+ u->ui.unknown_media = false;
} else {
u->mount_changed = 0;
}
} else if (u->mount_changed > 0) {
if (mode == 0) {
// insert
+ uae_u32 ctime = 0;
bool emptydrive = false;
struct uaedev_config_info *uci;
xfree (u->ui.rootdir);
ui->rootdir = u->ui.rootdir = my_strdup (u->mount_rootdir);
flush_cache (u, -1);
+ xfree (u->ui.volname);
+ ui->volname = u->ui.volname = NULL;
if (ui->unit_type == UNIT_CDFS) {
uae_u64 uniq;
ui->cdfs_superblock = u->ui.cdfs_superblock = isofs_mount (ui->cddevno, &uniq);
u->rootnode.uniq_external = uniq;
- if (!u->ui.cdfs_superblock)
+ if (!u->ui.cdfs_superblock) {
+ u->ui.unknown_media = true;
return 0;
+ }
struct isofs_info ii;
+ set_highcyl (ui, 0);
if (isofs_mediainfo (ui->cdfs_superblock, &ii) && ii.media) {
u->ui.unknown_media = ii.unknown_media;
- if (!ii.unknown_media)
+ if (!ii.unknown_media) {
u->ui.volname = ui->volname = my_strdup (ii.volumename);
+ ctime = ii.creation;
+ set_highcyl (ui, ii.blocks);
+ }
}
+
} else {
if (set_filesys_volume (u->mount_rootdir, &u->mount_flags, &u->mount_readonly, &emptydrive, &u->zarchive) < 0)
return 0;
xfree (u->ui.volname);
ui->volname = u->ui.volname = filesys_createvolname (u->mount_volume, u->mount_rootdir, L"removable");
}
- set_volume_name (u);
- write_log (L"FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, u->mount_readonly, ui->volname, u->mount_rootdir);
- if (u->mount_flags >= 0)
- ui->volflags = u->volflags = u->ui.volflags = u->mount_flags;
- _tcscpy (uci->volname, ui->volname);
- _tcscpy (uci->rootdir, u->mount_rootdir);
- if (u->mount_flags >= 0)
- uci->readonly = ui->readonly = u->ui.readonly = u->mount_readonly;
- put_byte (u->volume + 44, 0);
- put_byte (u->volume + 172 - 32, 1);
+ if (u->ui.unknown_media) {
+ write_log (L"FILESYS: inserted unreadable volume NR=%d RO=%d\n", nr, u->mount_readonly);
+ } else {
+ write_log (L"FILESYS: inserted volume NR=%d RO=%d '%s' ('%s')\n", nr, u->mount_readonly, ui->volname, u->mount_rootdir);
+ set_volume_name (u, ctime);
+ if (u->mount_flags >= 0)
+ ui->volflags = u->volflags = u->ui.volflags = u->mount_flags;
+ _tcscpy (uci->volname, ui->volname);
+ _tcscpy (uci->rootdir, u->mount_rootdir);
+ if (u->mount_flags >= 0)
+ uci->readonly = ui->readonly = u->ui.readonly = u->mount_readonly;
+ put_byte (u->volume + 44, 0);
+ put_byte (u->volume + 172 - 32, 1);
+ }
xfree (u->mount_volume);
xfree (u->mount_rootdir);
int late = 0;
int ed, ef;
uae_u64 uniq = 0;
+ uae_u32 cdays, ctime = 0;
/* find UnitInfo with correct device name */
s = _tcschr (devname, ':');
return 0;
}
uinfo = mountinfo.ui + i;
+ cdays = 3800 + i;
if (uinfo->unit_type == UNIT_CDFS) {
ed = ef = 0;
uinfo->wasisempty = false;
if (!ii.unknown_media) {
uinfo->volname = my_strdup (ii.volumename);
+ ctime = ii.creation;
+ set_highcyl (uinfo, ii.totalblocks);
}
}
uinfo->unknown_media = ii.unknown_media;
/* Prepare volume information */
put_long (unit->volume + 4, 2); /* Type = dt_volume */
put_long (unit->volume + 12, 0); /* Lock */
- put_long (unit->volume + 16, 3800 + i); /* Creation Date */
+ put_long (unit->volume + 16, cdays); /* Creation Date */
put_long (unit->volume + 20, 0);
put_long (unit->volume + 24, 0);
put_long (unit->volume + 28, 0); /* lock list */
put_byte (unit->volume + 44, 0);
if (!uinfo->wasisempty && !uinfo->unknown_media) {
/* Set volume if non-empty */
- set_volume_name (unit);
+ set_volume_name (unit, ctime);
fsdb_clean_dir (&unit->rootnode);
}
put_long (unit->volume + 8, unit->port);
- put_long (unit->volume + 32, uinfo->unit_type == UNIT_CDFS ? CDFS_DOSTYPE : DISK_TYPE);
+ put_long (unit->volume + 32, uinfo->unit_type == UNIT_CDFS ? DISK_TYPE_DOS : DISK_TYPE_DOS_FFS);
put_long (pkt + dp_Res1, DOS_TRUE);
} else {
put_long (info + 12, fsu.fsu_blocks ); /* numblocks */
put_long (info + 16, fsu.fsu_blocks - fsu.fsu_bavail); /* inuse */
- put_long (info + 24, DISK_TYPE); /* disk type */
+ put_long (info + 24, (unit->volflags & MYVOLUMEINFO_CDFS) ? DISK_TYPE_DOS : DISK_TYPE_DOS_FFS); /* disk type */
put_long (info + 28, unit->volume >> 2); /* volume node */
}
put_long (info + 32, 0); /* inuse */
{
struct _stat64 statbuf;
long days, mins, ticks;
- int i, n, entrytype;
+ int i, n, entrytype, blocksize;
int fsdb_can = fsdb_cando (unit);
TCHAR *xs;
char *x, *x2;
#ifdef HAVE_ST_BLOCKS
put_long (info + 128, statbuf.st_blocks);
#else
- put_long (info + 128, (statbuf.st_size + 511) / 512);
+ blocksize = (unit->volflags & MYVOLUMEINFO_CDFS) ? 2048 : 512;
+ put_long (info + 128, (statbuf.st_size + blocksize - 1) / blocksize);
#endif
get_time (statbuf.st_mtime, &days, &mins, &ticks);
put_long (info + 132, days);
/* get volume name */
xfree (unit->ui.volname);
unit->ui.volname = bstr1 (name);
- set_volume_name (unit);
+ set_volume_name (unit, 0);
PUT_PCK_RES1 (packet, DOS_TRUE);
}
uaecptr fsres = get_long (parmpacket + PP_FSRES);
uaecptr fsnode;
uae_u32 dostype, dostype2;
- UnitInfo *uip = mountinfo.ui;
int no = m68k_dreg (regs, 6) & 0x7fffffff;
int unit_no = no & 65535;
+ UnitInfo *uip = &mountinfo.ui[unit_no];
int iscd = (m68k_dreg (regs, 6) & 0x80000000) != 0 || uip->unit_type == UNIT_CDFS;
int type;
if (iscd) {
#if USE_CDFS == 2
+ if (!get_long (devicenode + 16))
+ put_long (devicenode + 16, cdfs_handlername);
return 0;
#endif
type = FILESYS_CD;
type = is_hardfile (unit_no);
}
- if (type == FILESYS_VIRTUAL)
+ if (type == FILESYS_VIRTUAL) {
+ if (!get_long (devicenode + 16))
+ put_long (devicenode + 16, fshandlername);
return 0;
+ }
dostype = get_long (parmpacket + 80);
fsnode = get_long (fsres + 18);
while (get_long (fsnode)) {
int fssize;
uae_u8 *fs;
+ uip->devicenode = devicenode;
if (iscd && USE_CDFS == 1) {
fssize = cdfs_handler_len;
fs = cdfs_handler;
buf = xmalloc (uae_u8, readblocksize);
if (showdebug) {
+ if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize)
+ write_log (L"RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n",
+ (uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize, hfd->virtsize);
write_log (L"RDSK dump start\n");
write_log (L"RDSK at %d, C=%d S=%d H=%d\n",
rdblock, hfd->cylinders, hfd->sectors, hfd->heads);
write_log (L"RDSK dump end\n");
}
- if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize) {
- write_log (L"RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n",
- (uae_u64)hfd->cylinders * hfd->sectors * hfd->heads, hfd->virtsize);
- }
-
for (i = 0; i <= partnum; i++) {
if (i == 0)
partblock = rl (bufrdb + 28);
}
write_log (L"Mounting uaescsi.device %d: (%d)\n", cd_unit_no, unit_no);
- put_long (parmpacket, cdname_amiga);
+ put_long (parmpacket + 0, cdname_amiga);
put_long (parmpacket + 4, cdfs_devname);
put_long (parmpacket + 8, cd_unit_no);
put_long (parmpacket + 12, 0); /* Device flags */
put_long (parmpacket + 52, 0); /* lowCyl */
put_long (parmpacket + 56, 0); /* hiCyl */
put_long (parmpacket + 60, 50); /* Number of buffers */
- put_long (parmpacket + 64, 0); /* Buffer mem type */
- put_long (parmpacket + 68, 0x7FFFFFFF); /* largest transfer */
- put_long (parmpacket + 72, ~1); /* addMask (?) */
+ put_long (parmpacket + 64, 1); /* Buffer mem type */
+ put_long (parmpacket + 68, 0x7FFFFFFE); /* largest transfer */
+ put_long (parmpacket + 72, 0x7FFFFFFE); /* addrressMask (?) */
put_long (parmpacket + 76, scsi_get_cd_drive_media_mask () & (1 << cd_unit_no) ? -127 : -128); /* bootPri */
- put_long (parmpacket + 80, CDFS_DOSTYPE);
+ put_long (parmpacket + 80, CDFS_DOSTYPE | (((cd_unit_no / 10) + '0') << 8) | ((cd_unit_no % 10) + '0'));
put_long (parmpacket + 84, 0); /* baud */
- put_long (parmpacket + 88, cdfs_control >> 2); /* Control. BSTR! */
+ put_long (parmpacket + 88, cdfs_control);
put_long (parmpacket + 92, 0); /* bootblocks */
#if USE_CDFS == 1
uaecptr fsres = get_long (parmpacket + PP_FSRES);
put_long (parmpacket + 44, 0); /* unused */
put_long (parmpacket + 48, 0); /* interleave */
put_long (parmpacket + 60, 50); /* Number of buffers */
- put_long (parmpacket + 64, 0); /* Buffer mem type */
- put_long (parmpacket + 68, 0x7FFFFFFF); /* largest transfer */
- put_long (parmpacket + 72, ~1); /* addMask (?) */
+ put_long (parmpacket + 64, 1); /* Buffer mem type */
+ put_long (parmpacket + 68, 0x7FFFFFFE); /* largest transfer */
+ put_long (parmpacket + 72, 0x7FFFFFFE); /* addMask (?) */
put_long (parmpacket + 76, uip[unit_no].bootpri); /* bootPri */
- put_long (parmpacket + 80, 0x444f5300); /* DOS\0 */
+ put_long (parmpacket + 80, DISK_TYPE_DOS); /* DOS\0 */
if (type == FILESYS_VIRTUAL) {
put_long (parmpacket + 4, fsdevname);
put_long (parmpacket + 20, 1024 >> 2); /* longwords per block */
ROM_filesys_resid = ds_ansi ("UAE unixfs 0.4");
fsdevname = ds_ansi ("uae.device"); /* does not really exist */
+ fshandlername = ds_bstr_ansi ("uaefs");
#if USE_CDFS
cdfs_devname = ds_ansi ("uaescsi.device");
+ cdfs_handlername = ds_bstr_ansi ("uaecdfs");
#if USE_CDFS == 1
cdfs_control = ds_bstr_ansi ("ROCKRIDGE JOLIET MAYBELOWERCASE SCANINTERVAL=-1 DE=.1 RE=.2");
#endif
#endif
}
-/*
- * We have to convert from a MM/DD/YY format to the Unix ctime format.
- * We have to take into account leap years and all of that good stuff.
- * Unfortunately, the kernel does not have the information on hand to
- * take into account daylight savings time, but it shouldn't matter.
- * The time stored should be localtime (with or without DST in effect),
- * and the timezone offset should hold the offset required to get back
- * to GMT. Thus we should always be correct.
- */
-
-static int iso_date(char * p, int flag)
+static int make_date(int year, int month, int day, int hour, int minute, int second, int tz)
{
- int year, month, day, hour, minute, second, tz;
int crtime, days, i;
- year = p[0] - 70;
- month = p[1];
- day = p[2];
- hour = p[3];
- minute = p[4];
- second = p[5];
- if (flag == 0) tz = p[6]; /* High sierra has no time zone */
- else tz = 0;
-
if (year < 0) {
crtime = 0;
} else {
return crtime;
}
+/*
+ * We have to convert from a MM/DD/YY format to the Unix ctime format.
+ * We have to take into account leap years and all of that good stuff.
+ * Unfortunately, the kernel does not have the information on hand to
+ * take into account daylight savings time, but it shouldn't matter.
+ * The time stored should be localtime (with or without DST in effect),
+ * and the timezone offset should hold the offset required to get back
+ * to GMT. Thus we should always be correct.
+ */
+
+static int iso_date(char * p, int flag)
+{
+ int year, month, day, hour, minute, second, tz;
+ year = p[0] - 70;
+ month = p[1];
+ day = p[2];
+ hour = p[3];
+ minute = p[4];
+ second = p[5];
+ if (flag == 0) tz = p[6]; /* High sierra has no time zone */
+ else tz = 0;
+
+ return make_date(year, month, day, hour, minute, second, tz);
+}
+
+static int iso_ltime(char *p)
+{
+ int year, month, day, hour, minute, second;
+ char t;
+
+ t = p[4];
+ p[4] = 0;
+ year = atol(p);
+ p[4] = t;
+ t = p[6];
+ p[6] = 0;
+ month = atol(p + 4);
+ p[6] = t;
+ t = p[8];
+ p[8] = 0;
+ day = atol(p + 6);
+ p[8] = t;
+ t = p[10];
+ p[10] = 0;
+ hour = atol(p + 8);
+ p[10] = t;
+ t = p[12];
+ p[12] = 0;
+ minute = atol(p + 10);
+ p[12] = t;
+ t = p[14];
+ p[14] = 0;
+ second = atol(p + 12);
+ p[14] = t;
+
+ return make_date(year - 1970, month, day, hour, minute, second, 0);
+}
static int isofs_read_level3_size(struct inode *inode)
int table, error = -EINVAL;
unsigned int vol_desc_start;
TCHAR *volume_name = NULL, *ch;
+ uae_u32 volume_date;
//save_mount_options(s, data);
write_log (L"ISOFS: System ID: %s", ch);
xfree(ch);
volume_name = getname(pri->volume_id, 32);
+ volume_date = iso_ltime(pri->creation_date);
write_log (L" Volume ID: '%s'\n", volume_name);
if (!strncmp(pri->system_id, ISO_SYSTEM_ID_CDTV, strlen(ISO_SYSTEM_ID_CDTV)))
sbi->s_cdtv = 1;
iput(inode);
s->root = inode;
inode->name = volume_name;
+ inode->i_ctime.tv_sec = volume_date;
*uniq = inode->i_ino;
return 0;
return true;
struct isofs_sb_info *sbi = ISOFS_SB(sb);
if (sys_command_ismedia (sb->unitnum, true)) {
+ struct device_info di;
+ uae_u32 totalblocks = 0;
ii->media = true;
+ di.cylinders = 0;
+ if (sys_command_info (sb->unitnum, &di, true))
+ totalblocks = di.cylinders * di.sectorspertrack * di.trackspercylinder;
ii->unknown_media = sb->unknown_media;
ii->blocksize = 2048;
if (sb->root) {
_tcscpy (ii->volumename, sb->root->name);
ii->blocks = sbi->s_max_size;
+ ii->totalblocks = totalblocks ? totalblocks : ii->blocks;
+ ii->creation = sb->root->i_ctime.tv_sec;
}
}
return true;