Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 3593 → Rev 3492

/branches/sparc/uspace/lib/libblock/libblock.c
File deleted
/branches/sparc/uspace/lib/libblock/libblock.h
File deleted
/branches/sparc/uspace/lib/libblock/Makefile
File deleted
/branches/sparc/uspace/lib/libfs/Makefile
30,8 → 30,6
## Common compiler flags
#
 
include ../../Makefile.config
 
LIBC_PREFIX = ../libc
## Setup toolchain
#
/branches/sparc/uspace/lib/libfs/libfs.c
36,6 → 36,7
 
#include "libfs.h"
#include "../../srv/vfs/vfs.h"
#include "../../srv/rd/rd.h"
#include <errno.h>
#include <async.h>
#include <ipc/ipc.h>
191,7 → 192,7
}
void *nodep;
if (lflag & L_CREATE)
nodep = ops->create(dev_handle, lflag);
nodep = ops->create(lflag);
else
nodep = ops->node_get(dev_handle,
index);
262,7 → 263,7
void *nodep;
if (lflag & L_CREATE)
nodep = ops->create(dev_handle, lflag);
nodep = ops->create(lflag);
else
nodep = ops->node_get(dev_handle, index);
if (nodep) {
330,5 → 331,62
ops->node_put(tmp);
}
 
/** Read data from a block device.
*
* @param phone Phone to be used to communicate with the device.
* @param buffer Communication buffer shared with the device.
* @param bufpos Pointer to the first unread valid offset within the
* communication buffer.
* @param buflen Pointer to the number of unread bytes that are ready in
* the communication buffer.
* @param pos Device position to be read.
* @param dst Destination buffer.
* @param size Size of the destination buffer.
* @param block_size Block size to be used for the transfer.
*
* @return True on success, false on failure.
*/
bool libfs_blockread(int phone, void *buffer, off_t *bufpos, size_t *buflen,
off_t *pos, void *dst, size_t size, size_t block_size)
{
off_t offset = 0;
size_t left = size;
while (left > 0) {
size_t rd;
if (*bufpos + left < *buflen)
rd = left;
else
rd = *buflen - *bufpos;
if (rd > 0) {
/*
* Copy the contents of the communication buffer to the
* destination buffer.
*/
memcpy(dst + offset, buffer + *bufpos, rd);
offset += rd;
*bufpos += rd;
*pos += rd;
left -= rd;
}
if (*bufpos == *buflen) {
/* Refill the communication buffer with a new block. */
ipcarg_t retval;
int rc = async_req_2_1(phone, RD_READ_BLOCK,
*pos / block_size, block_size, &retval);
if ((rc != EOK) || (retval != EOK))
return false;
*bufpos = 0;
*buflen = block_size;
}
}
return true;
}
 
/** @}
*/
/branches/sparc/uspace/lib/libfs/libfs.h
45,7 → 45,7
void * (* match)(void *, const char *);
void * (* node_get)(dev_handle_t, fs_index_t);
void (* node_put)(void *);
void * (* create)(dev_handle_t, int);
void * (* create)(int);
int (* destroy)(void *);
bool (* link)(void *, void *, const char *);
int (* unlink)(void *, void *);
69,6 → 69,9
 
extern void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
 
extern bool libfs_blockread(int, void *, off_t *, size_t *, off_t *, void *,
size_t, size_t);
 
#endif
 
/** @}
/branches/sparc/uspace/lib/softfloat/Makefile
29,8 → 29,6
## Common compiler flags
#
 
include ../../Makefile.config
 
LIBC_PREFIX = ../libc
## Setup toolchain
#
/branches/sparc/uspace/lib/softint/Makefile
29,8 → 29,6
## Common compiler flags
#
 
include ../../Makefile.config
 
LIBC_PREFIX = ../libc
## Setup toolchain
#
/branches/sparc/uspace/lib/libc/include/loader/loader.h
44,7 → 44,7
int phone_id;
} loader_t;
 
extern loader_t *loader_spawn(char *name);
extern loader_t *loader_spawn(void);
extern int loader_get_task_id(loader_t *, task_id_t *);
extern int loader_set_pathname(loader_t *, const char *);
extern int loader_set_args(loader_t *, char *const []);
/branches/sparc/uspace/lib/libc/include/byteorder.h
52,14 → 52,6
#define uint32_t_be2host(n) (n)
#define uint64_t_be2host(n) (n)
 
#define host2uint16_t_le(n) uint16_t_byteorder_swap(n)
#define host2uint32_t_le(n) uint32_t_byteorder_swap(n)
#define host2uint64_t_le(n) uint64_t_byteorder_swap(n)
 
#define host2uint16_t_be(n) (n)
#define host2uint32_t_be(n) (n)
#define host2uint64_t_be(n) (n)
 
#else
 
#define uint16_t_le2host(n) (n)
70,14 → 62,6
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n)
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n)
 
#define host2uint16_t_le(n) (n)
#define host2uint32_t_le(n) (n)
#define host2uint64_t_le(n) (n)
 
#define host2uint16_t_be(n) uint16_t_byteorder_swap(n)
#define host2uint32_t_be(n) uint32_t_byteorder_swap(n)
#define host2uint64_t_be(n) uint64_t_byteorder_swap(n)
 
#endif
 
static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
/branches/sparc/uspace/lib/libc/include/errno.h
46,7 → 46,6
#define EBADF (-262)
#define ERANGE (-263)
#define EXDEV (-264)
#define EIO (-265)
 
#endif
 
/branches/sparc/uspace/lib/libc/include/align.h
35,7 → 35,7
#ifndef LIBC_ALIGN_H_
#define LIBC_ALIGN_H_
 
/** Align to the nearest lower address which is a power of two.
/** Align to the nearest lower address.
*
* @param s Address or size to be aligned.
* @param a Size of alignment, must be power of 2.
43,7 → 43,7
#define ALIGN_DOWN(s, a) ((s) & ~((a) - 1))
 
 
/** Align to the nearest higher address which is a power of two.
/** Align to the nearest higher address.
*
* @param s Address or size to be aligned.
* @param a Size of alignment, must be power of 2.
50,13 → 50,6
*/
#define ALIGN_UP(s, a) ((long)((s) + ((a) - 1)) & ~((long) (a) - 1))
 
/** Round up to the nearest higher boundary.
*
* @param n Number to be aligned.
* @param b Boundary, arbitrary unsigned number.
*/
#define ROUND_UP(n, b) (((n) / (b) + ((n) % (b) != 0)) * (b))
 
#endif
 
/** @}
/branches/sparc/uspace/lib/libc/generic/task.c
64,7 → 64,7
int rc;
 
/* Spawn a program loader. */
ldr = loader_spawn(path);
ldr = loader_spawn();
if (ldr == NULL)
return 0;
 
/branches/sparc/uspace/lib/libc/generic/loader.c
46,11 → 46,10
/** Connect to a new program loader.
*
* Spawns a new program loader task and returns the connection structure.
* @param name Symbolic name to set on the newly created task.
* @return Pointer to the loader connection structure (should be
* de-allocated using free() after use).
*/
loader_t *loader_spawn(char *name)
loader_t *loader_spawn(void)
{
int phone_id, rc;
loader_t *ldr;
58,8 → 57,7
/*
* Ask kernel to spawn a new loader task.
*/
rc = __SYSCALL3(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id,
(sysarg_t) name, strlen(name));
rc = __SYSCALL1(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id);
if (rc != 0)
return NULL;
 
/branches/sparc/uspace/lib/libc/generic/thread.c
108,8 → 108,8
uarg->uspace_thread_arg = arg;
uarg->uspace_uarg = uarg;
rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name,
(sysarg_t) strlen(name), (sysarg_t) tid);
rc = __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name,
(sysarg_t) tid);
if (rc) {
/*
/branches/sparc/uspace/lib/libc/Makefile
29,8 → 29,6
## Common compiler flags
#
 
include ../../Makefile.config
 
LIBC_PREFIX = $(shell pwd)
SOFTINT_PREFIX = ../softint
CONSOLE_PREFIX = ../../srv/console
/branches/sparc/uspace/lib/libc/arch/ppc32/src/entry.s
34,12 → 34,11
 
## User-space task entry point
#
# r6 contains the PCB pointer
# r3 contains the PCB pointer
#
__entry:
# Pass the PCB pointer to __main() as the first argument.
# The first argument is passed in r3.
mr %r3, %r6
# Since the first argument is passed in r3, no operation is needed.
bl __main
 
bl __exit