fs_read_attr() and fs_write_attr() transferred bytes from/to the provided

file descriptor, not from/to the attribute...
Added ToDo comment about eventually adding syscalls for these functions.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10373 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-12-08 02:15:09 +00:00
parent a3d814e271
commit e96f985d95
+11 -7
View File
@@ -1,7 +1,7 @@
/*
** Copyright 2002, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2002-2004, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <fs_attr.h>
@@ -13,6 +13,8 @@
#include "syscalls.h"
// ToDo: think about adding special syscalls for the read/write/stat functions to speed them up
#define RETURN_AND_SET_ERRNO(status) \
{ \
if (status < 0) { \
@@ -27,7 +29,8 @@
ssize_t
fs_read_attr(int fd, const char *attribute, uint32 type, off_t pos, void *buffer, size_t readBytes)
fs_read_attr(int fd, const char *attribute, uint32 type,
off_t pos, void *buffer, size_t readBytes)
{
ssize_t bytes;
@@ -38,7 +41,7 @@ fs_read_attr(int fd, const char *attribute, uint32 type, off_t pos, void *buffer
// type is not used at all in this function
(void)type;
bytes = _kern_read(fd, pos, buffer, readBytes);
bytes = _kern_read(attr, pos, buffer, readBytes);
_kern_close(attr);
RETURN_AND_SET_ERRNO(bytes);
@@ -46,7 +49,8 @@ fs_read_attr(int fd, const char *attribute, uint32 type, off_t pos, void *buffer
ssize_t
fs_write_attr(int fd, const char *attribute, uint32 type, off_t pos, const void *buffer, size_t readBytes)
fs_write_attr(int fd, const char *attribute, uint32 type,
off_t pos, const void *buffer, size_t writeBytes)
{
ssize_t bytes;
@@ -54,7 +58,7 @@ fs_write_attr(int fd, const char *attribute, uint32 type, off_t pos, const void
if (attr < 0)
RETURN_AND_SET_ERRNO(attr);
bytes = _kern_write(fd, pos, buffer, readBytes);
bytes = _kern_write(attr, pos, buffer, writeBytes);
_kern_close(attr);
RETURN_AND_SET_ERRNO(bytes);