Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4491 → Rev 4492

/trunk/uspace/lib/libc/include/vfs/vfs.h
40,24 → 40,28
#include <ipc/devmap.h>
#include <stdio.h>
 
/**
* This type is a libc version of the VFS triplet.
* It uniquelly identifies a file system node within a file system instance.
*/
typedef struct {
fs_handle_t fs_handle;
dev_handle_t dev_handle;
fs_index_t index;
} inode_t;
} fdi_node_t;
 
extern char *absolutize(const char *, size_t *);
 
extern int mount(const char *, const char *, const char *, const char *,
unsigned int flags);
unsigned int);
 
extern int open_node(inode_t *node, int oflag);
extern int open_node(fdi_node_t *, int);
extern int fd_phone(int);
extern void fd_node(int, inode_t *);
extern void fd_node(int, fdi_node_t *);
 
extern FILE *fopen_node(inode_t *node, const char *);
extern FILE *fopen_node(fdi_node_t *, const char *);
extern int fphone(FILE *);
extern void fnode(FILE *stream, inode_t *node);
extern void fnode(FILE *, fdi_node_t *);
 
#endif
 
/trunk/uspace/lib/libc/include/loader/pcb.h
60,7 → 60,7
/** Number of preset files. */
int filc;
/** Preset files. */
inode_t **filv;
fdi_node_t **filv;
/*
* ELF-specific data.
/trunk/uspace/lib/libc/include/loader/loader.h
50,7 → 50,7
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[]);
extern int loader_set_files(loader_t *, inode_t *const[]);
extern int loader_set_files(loader_t *, fdi_node_t *const[]);
extern int loader_load_program(loader_t *);
extern int loader_run(loader_t *);
extern void loader_abort(loader_t *);
/trunk/uspace/lib/libc/generic/task.c
100,10 → 100,10
/* Send default files */
inode_t *files[4];
inode_t stdin_node;
inode_t stdout_node;
inode_t stderr_node;
fdi_node_t *files[4];
fdi_node_t stdin_node;
fdi_node_t stdout_node;
fdi_node_t stderr_node;
if ((stdin != NULL) && (stdin != &stdin_null)) {
fnode(stdin, &stdin_node);
/trunk/uspace/lib/libc/generic/loader.c
205,13 → 205,13
* @return Zero on success or negative error code.
*
*/
int loader_set_files(loader_t *ldr, inode_t *const files[])
int loader_set_files(loader_t *ldr, fdi_node_t *const files[])
{
/*
* Serialize the arguments into a single array. First
* compute size of the buffer needed.
*/
inode_t *const *ap = files;
fdi_node_t *const *ap = files;
size_t count = 0;
while (*ap != NULL) {
count++;
218,7 → 218,8
ap++;
}
inode_t *files_buf = (inode_t *) malloc(count * sizeof(inode_t));
fdi_node_t *files_buf;
files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t));
if (files_buf == NULL)
return ENOMEM;
231,7 → 232,7
ipc_call_t answer;
aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer);
ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) files_buf,
count * sizeof(inode_t));
count * sizeof(fdi_node_t));
if (rc != EOK) {
async_wait_for(req, NULL);
return rc;
/trunk/uspace/lib/libc/generic/vfs/vfs.c
223,7 → 223,7
return _open(path, L_FILE, oflag);
}
 
int open_node(inode_t *node, int oflag)
int open_node(fdi_node_t *node, int oflag)
{
futex_down(&vfs_phone_futex);
async_serialize_start();
332,7 → 332,7
return devmap_device_connect((dev_handle_t) device, 0);
}
 
void fd_node(int fildes, inode_t *node)
void fd_node(int fildes, fdi_node_t *node)
{
futex_down(&vfs_phone_futex);
async_serialize_start();
/trunk/uspace/lib/libc/generic/io/io.c
144,7 → 144,7
return stream;
}
 
FILE *fopen_node(inode_t *node, const char *mode)
FILE *fopen_node(fdi_node_t *node, const char *mode)
{
int flags;
if (!parse_mode(mode, &flags))
353,7 → 353,7
return -1;
}
 
void fnode(FILE *stream, inode_t *node)
void fnode(FILE *stream, fdi_node_t *node)
{
if (stream->fd >= 0) {
fd_node(stream->fd, node);
/trunk/uspace/srv/loader/main.c
81,7 → 81,7
/** Preset files vector */
static char **filv = NULL;
/** Buffer holding all preset files */
static inode_t *fil_buf = NULL;
static fdi_node_t *fil_buf = NULL;
 
static elf_info_t prog_info;
static elf_info_t interp_info;
242,7 → 242,7
return;
}
if ((buf_size % sizeof(inode_t)) != 0) {
if ((buf_size % sizeof(fdi_node_t)) != 0) {
ipc_answer_0(callid, EINVAL);
ipc_answer_0(rid, EINVAL);
return;
267,10 → 267,10
ipc_data_write_finalize(callid, fil_buf, buf_size);
int count = buf_size / sizeof(inode_t);
int count = buf_size / sizeof(fdi_node_t);
/* Allocate filvv */
filv = malloc((count + 1) * sizeof(inode_t *));
filv = malloc((count + 1) * sizeof(fdi_node_t *));
if (filv == NULL) {
free(fil_buf);