| afs_rename#(; OLD_PARENT_INODE, NEW_PARENT_INODE, OLD_CHILD_INODE, NEW_CHILD_INODE, OLD_DENT, NEW_DENT, ERR, DIRS, FILES; ASYNCED) {if pre-rename(OLD_PARENT_INODE, OLD_DENT, OLD_CHILD_INODE, NEW_PARENT_INODE, NEW_DENT, NEW_CHILD_INODE, DIRS, FILES) then { let OLD_INO = OLD_PARENT_INODE.ino, NEW_INO = NEW_PARENT_INODE.ino, OVERWRITE = NEW_DENT.dentry? in let IDENTITY = OLD_INO = NEW_INO ∧ NEW_DENT = OLD_DENT in {DIRS[OLD_INO].entries := DIRS[OLD_INO].entries -- OLD_DENT.name; if ¬ IDENTITY then {DIRS[OLD_INO].size := DIRS[OLD_INO].size - 1; if OLD_DENT.ino ∈ DIRS then DIRS[OLD_INO].nsubdirs := DIRS[OLD_INO].nsubdirs - 1}; DIRS[NEW_INO].entries[NEW_DENT.name] := OLD_DENT.ino; if OVERWRITE ∧ ¬ IDENTITY then let INO = NEW_DENT.ino in afs_drop_nlink#(INO; DIRS, FILES); if ¬ OVERWRITE then {DIRS[NEW_INO].size := DIRS[NEW_INO].size + 1; if OLD_DENT.ino ∈ DIRS then DIRS[NEW_INO].nsubdirs := DIRS[NEW_INO].nsubdirs + 1}; NEW_DENT := mkdentry(NEW_DENT.name, OLD_DENT.ino); OLD_DENT := negdentry(OLD_DENT.name); afs_inode_sync#(OLD_PARENT_INODE; DIRS, FILES); afs_inode_sync#(NEW_PARENT_INODE; DIRS, FILES); if OVERWRITE then {afs_inode_sync#(NEW_CHILD_INODE; DIRS, FILES); NEW_CHILD_INODE := getinode(NEW_CHILD_INODE.ino, DIRS, FILES)}; OLD_PARENT_INODE := getinode(OLD_PARENT_INODE.ino, DIRS, FILES); NEW_PARENT_INODE := getinode(NEW_PARENT_INODE.ino, DIRS, FILES); ERR := ESUCCESS} or fail#(; ; ERR); ASYNCED := ?} else abort } |