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.14 by cebix, 1999-11-15T15:01:34Z vs.
Revision 1.15 by cebix, 1999-12-22T16:16:09Z

# Line 223 | Line 223 | static void get_path_for_fsitem(FSItem *
223  
224  
225   /*
226 + *  Exchange parent CNIDs in all FSItems
227 + */
228 +
229 + static void swap_parent_ids(uint32 parent1, uint32 parent2)
230 + {
231 +        FSItem *p = first_fs_item;
232 +        while (p) {
233 +                if (p->parent_id == parent1)
234 +                        p->parent_id = parent2;
235 +                else if (p->parent_id == parent2)
236 +                        p->parent_id = parent1;
237 +                p = p->next;
238 +        }
239 + }
240 +
241 +
242 + /*
243   *  String handling functions
244   */
245  
# Line 1778 | Line 1795 | static int16 fs_read(uint32 pb)
1795          }
1796  
1797          // Read
1798 <        size_t actual = extfs_read(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount));
1798 >        ssize_t actual = extfs_read(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount));
1799          int16 read_err = errno2oserr();
1800          D(bug("  actual %d\n", actual));
1801 <        WriteMacInt32(pb + ioActCount, actual);
1801 >        WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0);
1802          uint32 pos = lseek(fd, 0, SEEK_CUR);
1803          WriteMacInt32(fcb + fcbCrPs, pos);
1804          WriteMacInt32(pb + ioPosOffset, pos);
1805          if (actual != ReadMacInt32(pb + ioReqCount))
1806 <                return read_err ? read_err : eofErr;
1806 >                return actual < 0 ? read_err : eofErr;
1807          else
1808                  return noErr;
1809   }
# Line 1827 | Line 1844 | static int16 fs_write(uint32 pb)
1844          }
1845  
1846          // Write
1847 <        size_t actual = extfs_write(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount));
1847 >        ssize_t actual = extfs_write(fd, Mac2HostAddr(ReadMacInt32(pb + ioBuffer)), ReadMacInt32(pb + ioReqCount));
1848          int16 write_err = errno2oserr();
1849          D(bug("  actual %d\n", actual));
1850 <        WriteMacInt32(pb + ioActCount, actual);
1850 >        WriteMacInt32(pb + ioActCount, actual >= 0 ? actual : 0);
1851          uint32 pos = lseek(fd, 0, SEEK_CUR);
1852          WriteMacInt32(fcb + fcbCrPs, pos);
1853          WriteMacInt32(pb + ioPosOffset, pos);
# Line 1940 | Line 1957 | static int16 fs_rename(uint32 pb, uint32
1957                  return errno2oserr();
1958          else {
1959                  // The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems
1960 +                swap_parent_ids(fs_item->id, new_item->id);
1961                  uint32 t = fs_item->id;
1962                  fs_item->id = new_item->id;
1963                  new_item->id = t;
# Line 1985 | Line 2003 | static int16 fs_cat_move(uint32 pb)
2003                  // The ID of the old file/dir has to stay the same, so we swap the IDs of the FSItems
2004                  FSItem *new_item = find_fsitem(fs_item->name, new_dir_item);
2005                  if (new_item) {
2006 +                        swap_parent_ids(fs_item->id, new_item->id);
2007                          uint32 t = fs_item->id;
2008                          fs_item->id = new_item->id;
2009                          new_item->id = t;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines