1 |
|
/* |
2 |
|
* extfs.cpp - MacOS file system for native file system access |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2004 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
107 |
|
static struct stat root_stat; |
108 |
|
|
109 |
|
// File system ID/media type |
110 |
< |
const int16 MY_FSID = 0x6261; // 'ba' |
111 |
< |
const uint32 MY_MEDIA_TYPE = FOURCC('b','a','s','i'); |
110 |
> |
const int16 MY_FSID = EMULATOR_ID_2; |
111 |
> |
const uint32 MY_MEDIA_TYPE = EMULATOR_ID_4; |
112 |
|
|
113 |
|
// CNID of root and root's parent |
114 |
|
const uint32 ROOT_ID = 2; |
730 |
|
if (no_vol_name) |
731 |
|
WriteMacInt32(pb + ioNamePtr, name_ptr); |
732 |
|
int16 status = ReadMacInt16(fs_data + fsReturn); |
733 |
– |
int16 more_matches = ReadMacInt16(fs_data + fsReturn + 2); |
734 |
– |
int16 vRefNum = ReadMacInt16(fs_data + fsReturn + 4); |
735 |
– |
uint32 vcb = ReadMacInt32(fs_data + fsReturn + 6); |
733 |
|
D(bug(" UTDetermineVol() returned %d, status %d\n", r.d[0], status)); |
734 |
|
result = (int16)(r.d[0] & 0xffff); |
735 |
|
|
964 |
|
r.a[0] = fs_data + fsReturn; |
965 |
|
r.a[1] = fs_data + fsReturn + 2; |
966 |
|
Execute68k(fs_data + fsAllocateVCB, &r); |
967 |
+ |
#if DEBUG |
968 |
|
uint16 sysVCBLength = ReadMacInt16(fs_data + fsReturn); |
969 |
+ |
#endif |
970 |
|
uint32 vcb = ReadMacInt32(fs_data + fsReturn + 2); |
971 |
|
D(bug(" UTAllocateVCB() returned %d, vcb %08lx, size %d\n", r.d[0], vcb, sysVCBLength)); |
972 |
|
if (r.d[0] & 0xffff) |
975 |
|
// Init VCB |
976 |
|
WriteMacInt16(vcb + vcbSigWord, 0x4244); |
977 |
|
#if defined(__BEOS__) || defined(WIN32) |
978 |
< |
WriteMacInt32(vcb + vcbCrDate, root_stat.st_crtime + TIME_OFFSET); |
978 |
> |
WriteMacInt32(vcb + vcbCrDate, TimeToMacTime(root_stat.st_crtime)); |
979 |
|
#else |
980 |
|
WriteMacInt32(vcb + vcbCrDate, 0); |
981 |
|
#endif |
982 |
< |
WriteMacInt32(vcb + vcbLsMod, root_stat.st_mtime + TIME_OFFSET); |
982 |
> |
WriteMacInt32(vcb + vcbLsMod, TimeToMacTime(root_stat.st_mtime)); |
983 |
|
WriteMacInt32(vcb + vcbVolBkUp, 0); |
984 |
|
WriteMacInt16(vcb + vcbNmFls, 1); //!! |
985 |
|
WriteMacInt16(vcb + vcbNmRtDirs, 1); //!! |
1038 |
|
if (ReadMacInt32(pb + ioNamePtr)) |
1039 |
|
pstrcpy((char *)Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), VOLUME_NAME); |
1040 |
|
#if defined(__BEOS__) || defined(WIN32) |
1041 |
< |
WriteMacInt32(pb + ioVCrDate, root_stat.st_crtime + TIME_OFFSET); |
1041 |
> |
WriteMacInt32(pb + ioVCrDate, TimeToMacTime(root_stat.st_crtime)); |
1042 |
|
#else |
1043 |
|
WriteMacInt32(pb + ioVCrDate, 0); |
1044 |
|
#endif |
1045 |
< |
WriteMacInt32(pb + ioVLsMod, root_stat.st_mtime + TIME_OFFSET); |
1045 |
> |
WriteMacInt32(pb + ioVLsMod, TimeToMacTime(root_stat.st_mtime)); |
1046 |
|
WriteMacInt16(pb + ioVAtrb, 0); |
1047 |
|
WriteMacInt16(pb + ioVNmFls, 1); //!! |
1048 |
|
WriteMacInt16(pb + ioVBitMap, 0); |
1230 |
|
WriteMacInt32(pb + ioDirID, fs_item->id); |
1231 |
|
|
1232 |
|
#if defined(__BEOS__) || defined(WIN32) |
1233 |
< |
WriteMacInt32(pb + ioFlCrDat, st.st_crtime + TIME_OFFSET); |
1233 |
> |
WriteMacInt32(pb + ioFlCrDat, TimeToMacTime(st.st_crtime)); |
1234 |
|
#else |
1235 |
|
WriteMacInt32(pb + ioFlCrDat, 0); |
1236 |
|
#endif |
1237 |
< |
WriteMacInt32(pb + ioFlMdDat, st.st_mtime + TIME_OFFSET); |
1237 |
> |
WriteMacInt32(pb + ioFlMdDat, TimeToMacTime(st.st_mtime)); |
1238 |
|
|
1239 |
< |
get_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0); |
1239 |
> |
get_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0, false); |
1240 |
|
|
1241 |
|
WriteMacInt16(pb + ioFlStBlk, 0); |
1242 |
|
WriteMacInt32(pb + ioFlLgLen, st.st_size); |
1273 |
|
return fnfErr; |
1274 |
|
|
1275 |
|
// Set Finder info |
1276 |
< |
set_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0); |
1276 |
> |
set_finfo(full_path, pb + ioFlFndrInfo, hfs ? pb + ioFlXFndrInfo : 0, false); |
1277 |
|
|
1278 |
|
//!! times |
1279 |
|
return noErr; |
1352 |
|
WriteMacInt32(pb + ioDirID, fs_item->id); |
1353 |
|
WriteMacInt32(pb + ioFlParID, fs_item->parent_id); |
1354 |
|
#if defined(__BEOS__) || defined(WIN32) |
1355 |
< |
WriteMacInt32(pb + ioFlCrDat, st.st_crtime + TIME_OFFSET); |
1355 |
> |
WriteMacInt32(pb + ioFlCrDat, TimeToMacTime(st.st_crtime)); |
1356 |
|
#else |
1357 |
|
WriteMacInt32(pb + ioFlCrDat, 0); |
1358 |
|
#endif |
1362 |
|
fs_item->mtime = mtime; |
1363 |
|
cached = false; |
1364 |
|
} |
1365 |
< |
WriteMacInt32(pb + ioFlMdDat, mtime + TIME_OFFSET); |
1365 |
> |
WriteMacInt32(pb + ioFlMdDat, TimeToMacTime(mtime)); |
1366 |
|
WriteMacInt32(pb + ioFlBkDat, 0); |
1367 |
|
|
1368 |
< |
get_finfo(full_path, pb + ioFlFndrInfo, pb + ioFlXFndrInfo); |
1368 |
> |
get_finfo(full_path, pb + ioFlFndrInfo, pb + ioFlXFndrInfo, S_ISDIR(st.st_mode)); |
1369 |
|
|
1370 |
|
if (S_ISDIR(st.st_mode)) { |
1371 |
|
|
1421 |
|
return errno2oserr(); |
1422 |
|
|
1423 |
|
// Set Finder info |
1424 |
< |
set_finfo(full_path, pb + ioFlFndrInfo, pb + ioFlXFndrInfo); |
1424 |
> |
set_finfo(full_path, pb + ioFlFndrInfo, pb + ioFlXFndrInfo, S_ISDIR(st.st_mode)); |
1425 |
|
|
1426 |
|
//!! times |
1427 |
|
return noErr; |
1509 |
|
WriteMacInt32(fcb + fcbVPtr, vcb); |
1510 |
|
WriteMacInt32(fcb + fcbClmpSize, CLUMP_SIZE); |
1511 |
|
|
1512 |
< |
get_finfo(full_path, fs_data + fsPB, 0); |
1512 |
> |
get_finfo(full_path, fs_data + fsPB, 0, false); |
1513 |
|
WriteMacInt32(fcb + fcbFType, ReadMacInt32(fs_data + fsPB + fdType)); |
1514 |
|
|
1515 |
|
WriteMacInt32(fcb + fcbCatPos, fd); |