From e96f985d951c5d4b16ce454ec9345927c41bc79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 8 Dec 2004 02:15:09 +0000 Subject: [PATCH] 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 --- src/kernel/libroot/os/fs_attr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/kernel/libroot/os/fs_attr.c b/src/kernel/libroot/os/fs_attr.c index f5d4f44dd1..3d97d3280a 100644 --- a/src/kernel/libroot/os/fs_attr.c +++ b/src/kernel/libroot/os/fs_attr.c @@ -1,7 +1,7 @@ /* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include @@ -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);