file_systems: fs_read_link() doesn't use a user buffer
introduced in hrev26728 and hrev54107. Change-Id: I3e98d54e829bcce559c43a8ee1abe4d889c0a571 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2819 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
d750211a65
commit
f9b218aa8a
@@ -1606,7 +1606,8 @@ bfs_read_link(fs_volume* _volume, fs_vnode* _node, char* buffer,
|
|||||||
|
|
||||||
*_bufferSize = linkLength;
|
*_bufferSize = linkLength;
|
||||||
|
|
||||||
return user_memcpy(buffer, inode->Node().short_symlink, bytesToCopy);
|
memcpy(buffer, inode->Node().short_symlink, bytesToCopy);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1313,10 +1313,7 @@ ext2_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer,
|
|||||||
size_t bytesToCopy = std::min(static_cast<size_t>(inode->Size()),
|
size_t bytesToCopy = std::min(static_cast<size_t>(inode->Size()),
|
||||||
*_bufferSize);
|
*_bufferSize);
|
||||||
|
|
||||||
status_t result = user_memcpy(buffer, inode->Node().symlink,
|
memcpy(buffer, inode->Node().symlink, bytesToCopy);
|
||||||
bytesToCopy);
|
|
||||||
if (result != B_OK)
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*_bufferSize = inode->Size();
|
*_bufferSize = inode->Size();
|
||||||
|
|||||||
@@ -569,7 +569,8 @@ fs_read_link(fs_volume* _volume, fs_vnode* _node, char* buffer,
|
|||||||
|
|
||||||
*_bufferSize = length;
|
*_bufferSize = length;
|
||||||
|
|
||||||
return user_memcpy(buffer, node->attr.slName, bytesToCopy);
|
memcpy(buffer, node->attr.slName, bytesToCopy);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2254,7 +2254,6 @@ fs_readlink(fs_volume *_volume, fs_vnode *_node, char *buf, size_t *bufsize)
|
|||||||
struct XDRInPacket reply;
|
struct XDRInPacket reply;
|
||||||
fs_nspace *ns;
|
fs_nspace *ns;
|
||||||
fs_node *node;
|
fs_node *node;
|
||||||
status_t result;
|
|
||||||
|
|
||||||
ns = _volume->private_volume;
|
ns = _volume->private_volume;
|
||||||
node = _node->private_node;
|
node = _node->private_node;
|
||||||
@@ -2291,12 +2290,12 @@ fs_readlink(fs_volume *_volume, fs_vnode *_node, char *buf, size_t *bufsize)
|
|||||||
|
|
||||||
length = XDRInPacketGetDynamic(&reply, data);
|
length = XDRInPacketGetDynamic(&reply, data);
|
||||||
|
|
||||||
result = user_memcpy(buf, data, min_c(length, *bufsize));
|
memcpy(buf, data, min_c(length, *bufsize));
|
||||||
*bufsize = length;
|
*bufsize = length;
|
||||||
|
|
||||||
XDRInPacketDestroy(&reply);
|
XDRInPacketDestroy(&reply);
|
||||||
XDROutPacketDestroy(&call);
|
XDROutPacketDestroy(&call);
|
||||||
return result;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
|
|||||||
@@ -281,7 +281,8 @@ UnpackingLeafNode::ReadSymlink(void* buffer, size_t* bufferSize)
|
|||||||
|
|
||||||
*bufferSize = linkLength;
|
*bufferSize = linkLength;
|
||||||
|
|
||||||
return user_memcpy(buffer, linkPath, bytesToCopy);
|
memcpy(buffer, linkPath, bytesToCopy);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,8 @@ PackageLinkSymlink::ReadSymlink(void* buffer, size_t* bufferSize)
|
|||||||
|
|
||||||
*bufferSize = linkLength;
|
*bufferSize = linkLength;
|
||||||
|
|
||||||
return user_memcpy(buffer, fLinkPath, bytesToCopy);
|
memcpy(buffer, fLinkPath, bytesToCopy);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -375,11 +375,10 @@ ramfs_read_symlink(fs_volume* _volume, fs_vnode* _node, char *buffer,
|
|||||||
size_t toRead = min(*bufferSize,
|
size_t toRead = min(*bufferSize,
|
||||||
symLink->GetLinkedPathLength());
|
symLink->GetLinkedPathLength());
|
||||||
if (toRead > 0)
|
if (toRead > 0)
|
||||||
error = user_memcpy(buffer, symLink->GetLinkedPath(),
|
memcpy(buffer, symLink->GetLinkedPath(),
|
||||||
toRead);
|
toRead);
|
||||||
|
|
||||||
if (error == B_OK)
|
*bufferSize = symLink->GetLinkedPathLength();
|
||||||
*bufferSize = symLink->GetLinkedPathLength();
|
|
||||||
} else {
|
} else {
|
||||||
FATAL("Node %" B_PRIdINO " pretends to be a SymLink, but isn't!\n",
|
FATAL("Node %" B_PRIdINO " pretends to be a SymLink, but isn't!\n",
|
||||||
node->GetID());
|
node->GetID());
|
||||||
|
|||||||
@@ -1522,11 +1522,9 @@ StreamReader::_ReadIndirectItem(off_t offset, void *buffer, size_t bufferSize)
|
|||||||
off_t blockOffset = i * (off_t)fBlockSize;
|
off_t blockOffset = i * (off_t)fBlockSize;
|
||||||
uint32 localOffset = max_c(0LL, offset - blockOffset);
|
uint32 localOffset = max_c(0LL, offset - blockOffset);
|
||||||
uint32 toRead = min_c(fBlockSize - localOffset, bufferSize);
|
uint32 toRead = min_c(fBlockSize - localOffset, bufferSize);
|
||||||
status_t copyResult = user_memcpy(buffer,
|
memcpy(buffer,
|
||||||
reinterpret_cast<uint8*>(block->GetData()) + localOffset,
|
reinterpret_cast<uint8*>(block->GetData()) + localOffset,
|
||||||
toRead);
|
toRead);
|
||||||
if (copyResult != B_OK)
|
|
||||||
return copyResult;
|
|
||||||
|
|
||||||
block->Put();
|
block->Put();
|
||||||
bufferSize -= toRead;
|
bufferSize -= toRead;
|
||||||
@@ -1547,7 +1545,8 @@ StreamReader::_ReadDirectItem(off_t offset, void *buffer, size_t bufferSize)
|
|||||||
{
|
{
|
||||||
//PRINT(("StreamReader::_ReadDirectItem(%Ld, %p, %lu)\n", offset, buffer, bufferSize));
|
//PRINT(("StreamReader::_ReadDirectItem(%Ld, %p, %lu)\n", offset, buffer, bufferSize));
|
||||||
// copy the data into the buffer
|
// copy the data into the buffer
|
||||||
return user_memcpy(buffer,
|
memcpy(buffer,
|
||||||
reinterpret_cast<uint8*>(fItem.GetData()) + offset, bufferSize);
|
reinterpret_cast<uint8*>(fItem.GetData()) + offset, bufferSize);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user