ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/extfs.cpp
(Generate patch)

Comparing BasiliskII/src/extfs.cpp (file contents):
Revision 1.3 by cebix, 1999-10-20T15:13:53Z vs.
Revision 1.5 by cebix, 1999-10-21T22:39:51Z

# Line 204 | Line 204 | static FSItem *find_fsitem(const char *n
204   const int MAX_PATH_LENGTH = 1024;
205   static char full_path[MAX_PATH_LENGTH];
206  
207 < static void add_path_component(const char *s)
207 > static void add_path_comp(const char *s)
208   {
209 <        int l = strlen(full_path);
210 <        if (l < MAX_PATH_LENGTH-1 && full_path[l-1] != '/') {
211 <                full_path[l] = '/';
212 <                full_path[l+1] = 0;
213 <        }
214 <        strncat(full_path, s, MAX_PATH_LENGTH-1);
209 >        add_path_component(full_path, s, MAX_PATH_LENGTH);
210   }
211  
212   static void get_path_for_fsitem(FSItem *p)
# Line 221 | Line 216 | static void get_path_for_fsitem(FSItem *
216                  full_path[MAX_PATH_LENGTH-1] = 0;
217          } else {
218                  get_path_for_fsitem(p->parent);
219 <                add_path_component(p->name);
219 >                add_path_comp(p->name);
220          }
221   }
222  
# Line 325 | Line 320 | void ExtFSInit(void)
320          cstr2pstr(FS_NAME, GetString(STR_EXTFS_NAME));
321          cstr2pstr(VOLUME_NAME, GetString(STR_EXTFS_VOLUME_NAME));
322  
323 <        // Create root FSItem
323 >        // Create root's parent FSItem
324          FSItem *p = new FSItem;
325          first_fs_item = last_fs_item = p;
326          p->next = NULL;
327 +        p->id = ROOT_PARENT_ID;
328 +        p->parent_id = 0;
329 +        p->parent = NULL;
330 +        p->name[0] = 0;
331 +
332 +        // Create root FSItem
333 +        p = new FSItem;
334 +        last_fs_item->next = p;
335 +        p->next = NULL;
336 +        last_fs_item = p;
337          p->id = ROOT_ID;
338          p->parent_id = ROOT_PARENT_ID;
339 <        p->parent = NULL;
339 >        p->parent = first_fs_item;
340          strncpy(p->name, GetString(STR_EXTFS_VOLUME_NAME), 32);
341  
342          // Find path for root
# Line 430 | Line 435 | void InstallExtFS(void)
435          WriteMacInt16(p, 0x7006); p+= 2;        // UTAllocateVCB
436          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
437          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
438 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
438 >        WriteMacInt16(p, M68K_RTS); p+= 2;
439          if (p - fs_data != fsAddNewVCB)
440                  goto fsdat_error;
441          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 440 | Line 445 | void InstallExtFS(void)
445          WriteMacInt16(p, 0x7007); p+= 2;        // UTAddNewVCB
446          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
447          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
448 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
448 >        WriteMacInt16(p, M68K_RTS); p+= 2;
449          if (p - fs_data != fsDetermineVol)
450                  goto fsdat_error;
451          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 452 | Line 457 | void InstallExtFS(void)
457          WriteMacInt16(p, 0x701d); p+= 2;        // UTDetermineVol
458          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
459          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
460 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
460 >        WriteMacInt16(p, M68K_RTS); p+= 2;
461          if (p - fs_data != fsResolveWDCB)
462                  goto fsdat_error;
463          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 463 | Line 468 | void InstallExtFS(void)
468          WriteMacInt16(p, 0x700e); p+= 2;        // UTResolveWDCB
469          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
470          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
471 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
471 >        WriteMacInt16(p, M68K_RTS); p+= 2;
472          if (p - fs_data != fsGetDefaultVol)
473                  goto fsdat_error;
474          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 471 | Line 476 | void InstallExtFS(void)
476          WriteMacInt16(p, 0x7012); p+= 2;        // UTGetDefaultVol
477          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
478          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
479 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
479 >        WriteMacInt16(p, M68K_RTS); p+= 2;
480          if (p - fs_data != fsGetPathComponentName)
481                  goto fsdat_error;
482          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 479 | Line 484 | void InstallExtFS(void)
484          WriteMacInt16(p, 0x701c); p+= 2;        // UTGetPathComponentName
485          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
486          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
487 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
487 >        WriteMacInt16(p, M68K_RTS); p+= 2;
488          if (p - fs_data != fsParsePathname)
489                  goto fsdat_error;
490          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 488 | Line 493 | void InstallExtFS(void)
493          WriteMacInt16(p, 0x701b); p+= 2;        // UTParsePathname
494          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
495          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
496 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
496 >        WriteMacInt16(p, M68K_RTS); p+= 2;
497          if (p - fs_data != fsDisposeVCB)
498                  goto fsdat_error;
499          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 496 | Line 501 | void InstallExtFS(void)
501          WriteMacInt16(p, 0x7008); p+= 2;        // UTDisposeVCB
502          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
503          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
504 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
504 >        WriteMacInt16(p, M68K_RTS); p+= 2;
505          if (p - fs_data != fsCheckWDRefNum)
506                  goto fsdat_error;
507          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 504 | Line 509 | void InstallExtFS(void)
509          WriteMacInt16(p, 0x7013); p+= 2;        // UTCheckWDRefNum
510          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
511          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
512 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
512 >        WriteMacInt16(p, M68K_RTS); p+= 2;
513          if (p - fs_data != fsSetDefaultVol)
514                  goto fsdat_error;
515          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 514 | Line 519 | void InstallExtFS(void)
519          WriteMacInt16(p, 0x7011); p+= 2;        // UTSetDefaultVol
520          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
521          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
522 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
522 >        WriteMacInt16(p, M68K_RTS); p+= 2;
523          if (p - fs_data != fsAllocateFCB)
524                  goto fsdat_error;
525          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 523 | Line 528 | void InstallExtFS(void)
528          WriteMacInt16(p, 0x7000); p+= 2;        // UTAllocateFCB
529          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
530          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
531 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
531 >        WriteMacInt16(p, M68K_RTS); p+= 2;
532          if (p - fs_data != fsReleaseFCB)
533                  goto fsdat_error;
534          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 531 | Line 536 | void InstallExtFS(void)
536          WriteMacInt16(p, 0x7001); p+= 2;        // UTReleaseFCB
537          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
538          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
539 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
539 >        WriteMacInt16(p, M68K_RTS); p+= 2;
540          if (p - fs_data != fsIndexFCB)
541                  goto fsdat_error;
542          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 541 | Line 546 | void InstallExtFS(void)
546          WriteMacInt16(p, 0x7004); p+= 2;        // UTIndexFCB
547          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
548          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
549 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
549 >        WriteMacInt16(p, M68K_RTS); p+= 2;
550          if (p - fs_data != fsResolveFCB)
551                  goto fsdat_error;
552          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 550 | Line 555 | void InstallExtFS(void)
555          WriteMacInt16(p, 0x7005); p+= 2;        // UTResolveFCB
556          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
557          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
558 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
558 >        WriteMacInt16(p, M68K_RTS); p+= 2;
559          if (p - fs_data != fsAdjustEOF)
560                  goto fsdat_error;
561          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 558 | Line 563 | void InstallExtFS(void)
563          WriteMacInt16(p, 0x7010); p+= 2;        // UTAdjustEOF
564          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
565          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
566 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
566 >        WriteMacInt16(p, M68K_RTS); p+= 2;
567          if (p - fs_data != fsAllocateWDCB)
568                  goto fsdat_error;
569          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 566 | Line 571 | void InstallExtFS(void)
571          WriteMacInt16(p, 0x700c); p+= 2;        // UTAllocateWDCB
572          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
573          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
574 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
574 >        WriteMacInt16(p, M68K_RTS); p+= 2;
575          if (p - fs_data != fsReleaseWDCB)
576                  goto fsdat_error;
577          WriteMacInt16(p, 0x4267); p+= 2;        // clr.w -(sp)
# Line 574 | Line 579 | void InstallExtFS(void)
579          WriteMacInt16(p, 0x700d); p+= 2;        // UTReleaseWDCB
580          WriteMacInt16(p, 0xa824); p+= 2;        // FSMgr
581          WriteMacInt16(p, 0x301f); p+= 2;        // move.w (sp)+,d0
582 <        WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
582 >        WriteMacInt16(p, M68K_RTS); p+= 2;
583          if (p - fs_data != SIZEOF_fsdat)
584                  goto fsdat_error;
585  
# Line 689 | Line 694 | static int16 get_current_dir(uint32 pb,
694          int16 result;
695  
696          // Determine volume
697 < //      D(bug("  determining volume\n"));
697 >        D(bug("  determining volume, dirID %d\n", dirID));
698          r.a[0] = pb;
699          r.a[1] = fs_data + fsReturn;
700          r.a[2] = fs_data + fsReturn + 2;
# Line 707 | Line 712 | static int16 get_current_dir(uint32 pb,
712          int16 more_matches = ReadMacInt16(fs_data + fsReturn + 2);
713          int16 vRefNum = ReadMacInt16(fs_data + fsReturn + 4);
714          uint32 vcb = ReadMacInt32(fs_data + fsReturn + 6);
715 < //      D(bug("  UTDetermineVol() returned %d, status %d\n", r.d[0], status));
715 >        D(bug("  UTDetermineVol() returned %d, status %d\n", r.d[0], status));
716          result = r.d[0] & 0xffff;
717  
718          if (result == noErr) {
# Line 790 | Line 795 | static int16 get_item_and_path(uint32 pb
795          uint32 current_dir;
796          if ((result = get_current_dir(pb, dirID, current_dir, no_vol_name)) != noErr)
797                  return result;
798 +        D(bug("  current dir %08x\n", current_dir));
799          FSItem *p = find_fsitem_by_id(current_dir);
800          if (p == NULL)
801                  return dirNFErr;
# Line 803 | Line 809 | static int16 get_item_and_path(uint32 pb
809          WriteMacInt8(parseRec + ppFoundDelimiter, false);
810  
811          // Get length of volume name
812 < //      D(bug("  parsing pathname\n"));
812 >        D(bug("  parsing pathname\n"));
813          r.a[0] = parseRec + ppStartOffset;
814          r.a[1] = ReadMacInt32(parseRec + ppNamePtr);
815          Execute68k(fs_data + fsParsePathname, &r);
816 < //      D(bug("  UTParsePathname() returned %d, startOffset %d\n", r.d[0], ReadMacInt16(parseRec + ppStartOffset)));
816 >        D(bug("  UTParsePathname() returned %d, startOffset %d\n", r.d[0], ReadMacInt16(parseRec + ppStartOffset)));
817          result = r.d[0] & 0xffff;
818          if (result == noErr) {
819  
# Line 1086 | Line 1092 | static int16 fs_get_vol(uint32 pb)
1092   // Set default volume (WDParam)
1093   static int16 fs_set_vol(uint32 pb, bool hfs, uint32 vcb)
1094   {
1095 <        D(bug(" fs_set_vol(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioWDDirID)));
1095 >        D(bug(" fs_set_vol(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioWDDirID)));
1096          M68kRegisters r;
1097  
1098          // Determine parameters
# Line 1142 | Line 1148 | static int16 fs_set_vol(uint32 pb, bool
1148   // Query file attributes (HFileParam)
1149   static int16 fs_get_file_info(uint32 pb, bool hfs, uint32 dirID)
1150   {
1151 <        D(bug(" fs_get_file_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), dirID));
1151 >        D(bug(" fs_get_file_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), dirID));
1152  
1153          FSItem *fs_item;
1154 <        int16 dir_index = ReadMacInt16(pb + ioFDirIndex);
1155 <        if (dir_index == 0) {   // Query item specified by ioDirID and ioNamePtr
1154 >        int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex);
1155 >        if (dir_index <= 0) {           // Query item specified by ioDirID and ioNamePtr
1156  
1157                  // Find FSItem for given file
1158                  int16 result = get_item_and_path(pb, dirID, fs_item);
# Line 1181 | Line 1187 | read_next_de:
1187                                  goto read_next_de;      // Suppress name beginning with '.' (MacOS could interpret these as driver names)
1188                          //!! suppress directories
1189                  }
1190 <                add_path_component(de->d_name);
1190 >                add_path_comp(de->d_name);
1191  
1192                  // Get FSItem for queried item
1193                  fs_item = find_fsitem(de->d_name, p);
# Line 1238 | Line 1244 | read_next_de:
1244   // Set file attributes (HFileParam)
1245   static int16 fs_set_file_info(uint32 pb, bool hfs, uint32 dirID)
1246   {
1247 <        D(bug(" fs_set_file_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), dirID));
1247 >        D(bug(" fs_set_file_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), dirID));
1248  
1249          // Find FSItem for given file/dir
1250          FSItem *fs_item;
# Line 1263 | Line 1269 | static int16 fs_set_file_info(uint32 pb,
1269   // Query file/directory attributes
1270   static int16 fs_get_cat_info(uint32 pb)
1271   {
1272 <        D(bug(" fs_get_cat_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID)));
1272 >        D(bug(" fs_get_cat_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID)));
1273  
1274          FSItem *fs_item;
1275 <        int16 dir_index = ReadMacInt16(pb + ioFDirIndex);
1276 <        if (dir_index == -1) {          // Query directory specified by ioDirID
1275 >        int16 dir_index = (int16)ReadMacInt16(pb + ioFDirIndex);
1276 >        if (dir_index < 0) {                    // Query directory specified by ioDirID
1277  
1278                  // Find FSItem for directory
1279                  fs_item = find_fsitem_by_id(ReadMacInt32(pb + ioDrDirID));
# Line 1309 | Line 1315 | read_next_de:
1315                          if (de->d_name[0] == '.')
1316                                  goto read_next_de;      // Suppress name beginning with '.' (MacOS could interpret these as driver names)
1317                  }
1318 <                add_path_component(de->d_name);
1318 >                add_path_comp(de->d_name);
1319  
1320                  // Get FSItem for queried item
1321                  fs_item = find_fsitem(de->d_name, p);
# Line 1397 | Line 1403 | read_next_de:
1403   // Set file/directory attributes
1404   static int16 fs_set_cat_info(uint32 pb)
1405   {
1406 <        D(bug(" fs_set_cat_info(%08lx), vRefNum %d, name %#s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID)));
1406 >        D(bug(" fs_set_cat_info(%08lx), vRefNum %d, name %.31s, idx %d, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt16(pb + ioFDirIndex), ReadMacInt32(pb + ioDirID)));
1407  
1408          // Find FSItem for given file/dir
1409          FSItem *fs_item;
# Line 1424 | Line 1430 | static int16 fs_set_cat_info(uint32 pb)
1430   // Open file
1431   static int16 fs_open(uint32 pb, uint32 dirID, uint32 vcb, bool resource_fork)
1432   {
1433 <        D(bug(" fs_open(%08lx), %s, vRefNum %d, name %#s, dirID %d, perm %d\n", pb, resource_fork ? "rsrc" : "data", ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID, ReadMacInt8(pb + ioPermssn)));
1433 >        D(bug(" fs_open(%08lx), %s, vRefNum %d, name %.31s, dirID %d, perm %d\n", pb, resource_fork ? "rsrc" : "data", ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID, ReadMacInt8(pb + ioPermssn)));
1434          M68kRegisters r;
1435  
1436          // Find FSItem for given file
# Line 1711 | Line 1717 | static int16 fs_set_fpos(uint32 pb)
1717                          if (lseek(fd, ReadMacInt32(pb + ioPosOffset), SEEK_SET) < 0)
1718                                  return posErr;
1719                          break;
1720 +                case fsFromLEOF:
1721 +                        if (lseek(fd, (int32)ReadMacInt32(pb + ioPosOffset), SEEK_END) < 0)
1722 +                                return posErr;
1723 +                        break;
1724                  case fsFromMark:
1725 <                        if (lseek(fd, ReadMacInt32(pb + ioPosOffset), SEEK_CUR) < 0)
1725 >                        if (lseek(fd, (int32)ReadMacInt32(pb + ioPosOffset), SEEK_CUR) < 0)
1726                                  return posErr;
1727 +                        break;
1728                  default:
1729                          break;
1730          }
# Line 1825 | Line 1836 | static int16 fs_write(uint32 pb)
1836   // Create file
1837   static int16 fs_create(uint32 pb, uint32 dirID)
1838   {
1839 <        D(bug(" fs_create(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID));
1839 >        D(bug(" fs_create(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID));
1840  
1841          // Find FSItem for given file
1842          FSItem *fs_item;
# Line 1850 | Line 1861 | static int16 fs_create(uint32 pb, uint32
1861   // Create directory
1862   static int16 fs_dir_create(uint32 pb)
1863   {
1864 <        D(bug(" fs_dir_create(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioDirID)));
1864 >        D(bug(" fs_dir_create(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioDirID)));
1865  
1866          // Find FSItem for given directory
1867          FSItem *fs_item;
# Line 1874 | Line 1885 | static int16 fs_dir_create(uint32 pb)
1885   // Delete file/directory
1886   static int16 fs_delete(uint32 pb, uint32 dirID)
1887   {
1888 <        D(bug(" fs_delete(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID));
1888 >        D(bug(" fs_delete(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID));
1889  
1890          // Find FSItem for given file/dir
1891          FSItem *fs_item;
# Line 1899 | Line 1910 | static int16 fs_delete(uint32 pb, uint32
1910   // Rename file/directory
1911   static int16 fs_rename(uint32 pb, uint32 dirID)
1912   {
1913 <        D(bug(" fs_rename(%08lx), vRefNum %d, name %#s, dirID %d, new name %#s\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), dirID, Mac2HostAddr(ReadMacInt32(pb + ioMisc))));
1913 >        D(bug(" fs_rename(%08lx), vRefNum %d, name %.31s, dirID %d, new name %.31s\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), dirID, Mac2HostAddr(ReadMacInt32(pb + ioMisc) + 1)));
1914  
1915          // Find path of given file/dir
1916          FSItem *fs_item;
# Line 1940 | Line 1951 | static int16 fs_rename(uint32 pb, uint32
1951   // Move file/directory (CMovePBRec)
1952   static int16 fs_cat_move(uint32 pb)
1953   {
1954 <        D(bug(" fs_cat_move(%08lx), vRefNum %d, name %#s, dirID %d, new name %#s, new dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioDirID), Mac2HostAddr(ReadMacInt32(pb + ioNewName)), ReadMacInt32(pb + ioNewDirID)));
1954 >        D(bug(" fs_cat_move(%08lx), vRefNum %d, name %.31s, dirID %d, new name %.31s, new dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioDirID), Mac2HostAddr(ReadMacInt32(pb + ioNewName) + 1), ReadMacInt32(pb + ioNewDirID)));
1955  
1956          // Find path of given file/dir
1957          FSItem *fs_item;
# Line 1962 | Line 1973 | static int16 fs_cat_move(uint32 pb)
1973                  return result;
1974  
1975          // Append old file/dir name
1976 <        add_path_component(fs_item->name);
1976 >        add_path_comp(fs_item->name);
1977  
1978          // Does the new name already exist?
1979          if (access(full_path, F_OK) == 0)
# Line 1987 | Line 1998 | static int16 fs_cat_move(uint32 pb)
1998   // Open working directory (WDParam)
1999   static int16 fs_open_wd(uint32 pb)
2000   {
2001 <        D(bug(" fs_open_wd(%08lx), vRefNum %d, name %#s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr)), ReadMacInt32(pb + ioWDDirID)));
2001 >        D(bug(" fs_open_wd(%08lx), vRefNum %d, name %.31s, dirID %d\n", pb, ReadMacInt16(pb + ioVRefNum), Mac2HostAddr(ReadMacInt32(pb + ioNamePtr) + 1), ReadMacInt32(pb + ioWDDirID)));
2002          M68kRegisters r;
2003  
2004          // Allocate WDCB

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines