We need to update the name and parent directory when renaming/moving.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30930 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
331f147bae
commit
c89b0ea4c2
@ -115,6 +115,7 @@ public:
|
||||
OverlayInode * ParentDir() { return fParentDir; }
|
||||
|
||||
status_t Lookup(const char *name, ino_t *inodeNumber);
|
||||
void SetName(const char *name);
|
||||
status_t GetName(char *buffer, size_t bufferSize);
|
||||
|
||||
status_t ReadStat(struct stat *stat);
|
||||
@ -292,17 +293,24 @@ OverlayInode::Lookup(const char *name, ino_t *inodeNumber)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OverlayInode::SetName(const char *name)
|
||||
{
|
||||
fName = name;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
OverlayInode::GetName(char *buffer, size_t bufferSize)
|
||||
{
|
||||
if (fIsVirtual) {
|
||||
if (fName == NULL)
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
if (fName != NULL) {
|
||||
strlcpy(buffer, fName, bufferSize);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (fIsVirtual)
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
if (fSuperVnode.ops->get_vnode_name == NULL)
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
@ -465,8 +473,8 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length,
|
||||
size_t bytesLeft = MIN(fStat.st_size - position, *length);
|
||||
*length = bytesLeft;
|
||||
|
||||
void *superCookie = NULL;
|
||||
if (!fIsVirtual && _cookie != NULL)
|
||||
void *superCookie = _cookie;
|
||||
if (!fIsVirtual && !readPages && _cookie != NULL)
|
||||
superCookie = ((open_cookie *)_cookie)->super_cookie;
|
||||
|
||||
while (bytesLeft > 0) {
|
||||
@ -1284,6 +1292,14 @@ overlay_rename(fs_volume *volume, fs_vnode *vnode,
|
||||
return result;
|
||||
}
|
||||
|
||||
OverlayInode *node = NULL;
|
||||
result = get_vnode(volume, entry->inode_number, (void **)&node);
|
||||
if (result == B_OK && node != NULL) {
|
||||
node->SetName(entry->name);
|
||||
node->SetParentDir(toNode);
|
||||
put_vnode(volume, entry->inode_number);
|
||||
}
|
||||
|
||||
free(oldName);
|
||||
notify_entry_moved(volume->id, fromNode->InodeNumber(), fromName,
|
||||
toNode->InodeNumber(), toName, entry->inode_number);
|
||||
|
Loading…
Reference in New Issue
Block a user