write_overlay: Read()/Write() with user_memcpy().
This commit is contained in:
@@ -776,8 +776,8 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length,
|
|||||||
if (ioRequest != NULL) {
|
if (ioRequest != NULL) {
|
||||||
ioRequest->CopyData(source, ioRequest->Offset()
|
ioRequest->CopyData(source, ioRequest->Offset()
|
||||||
+ ((addr_t)pointer - (addr_t)buffer), copyLength);
|
+ ((addr_t)pointer - (addr_t)buffer), copyLength);
|
||||||
} else
|
} else if (user_memcpy(pointer, source, copyLength) < B_OK)
|
||||||
memcpy(pointer, source, copyLength);
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
bytesLeft -= copyLength;
|
bytesLeft -= copyLength;
|
||||||
position += copyLength;
|
position += copyLength;
|
||||||
@@ -838,8 +838,8 @@ OverlayInode::Write(void *_cookie, off_t position, const void *buffer,
|
|||||||
void *target = other->buffer + (newPosition - other->position);
|
void *target = other->buffer + (newPosition - other->position);
|
||||||
if (ioRequest != NULL)
|
if (ioRequest != NULL)
|
||||||
ioRequest->CopyData(ioRequest->Offset(), target, length);
|
ioRequest->CopyData(ioRequest->Offset(), target, length);
|
||||||
else
|
else if (user_memcpy(target, buffer, length) < B_OK)
|
||||||
memcpy(target, buffer, length);
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
fStat.st_mtime = time(NULL);
|
fStat.st_mtime = time(NULL);
|
||||||
if (fIsAttribute) {
|
if (fIsAttribute) {
|
||||||
@@ -897,8 +897,8 @@ OverlayInode::Write(void *_cookie, off_t position, const void *buffer,
|
|||||||
void *target = element->buffer + (position - newPosition);
|
void *target = element->buffer + (position - newPosition);
|
||||||
if (ioRequest != NULL)
|
if (ioRequest != NULL)
|
||||||
ioRequest->CopyData(0, target, length);
|
ioRequest->CopyData(0, target, length);
|
||||||
else
|
else if (user_memcpy(target, buffer, length) < B_OK)
|
||||||
memcpy(target, buffer, length);
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
fStat.st_mtime = time(NULL);
|
fStat.st_mtime = time(NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user