41#define MODNAME "fakehost"
44#define FS_REPNAME "host"
48#define M_PRINTF(format, args...) \
49 printf(MODNAME ": " format, ##args)
52#define M_DEBUG M_PRINTF
54#define M_DEBUG(format, args...)
62extern int ttyMount(
void);
75char *
fd_name(
char * buffer,
const char * name )
77 strcpy( buffer, base );
78 strcat( buffer, name );
91 f->
unit = ++fd_global;
112 M_DEBUG(
"dummy function called\n");
124 M_PRINTF(
"initializing '%s' file driver.\n", driver->name );
138 char nameBuffer[ 250 ];
141 M_DEBUG(
"open %i %s %s\n", f->
unit, name ,base);
142 fd = iomanX_open(
fd_name( nameBuffer, name), mode, 0 );
143 if ( fd < 0 )
return fd;
156 return iomanX_close(
realfd(f) );
169 return iomanX_read(
realfd(f), buffer, size );
182 return iomanX_write(
realfd(fd), buffer, size );
195 return iomanX_lseek(
realfd(fd), offset, whence );
224 "host redirection driver",
247 M_PRINTF(
"Copyright (c) 2004 adresd\n" );
251 M_PRINTF(
"HOST requires based argument\n" );
252 return MODULE_NO_RESIDENT_END;
257 strncpy( base, argv[1] ,
sizeof(base) - 1);
258 base[
sizeof(base) - 1] =
'\0';
260 M_PRINTF(
"redirecting '%s:' to '%s'\n",FS_REPNAME,base);
263 M_PRINTF(
"HOST final step, bye\n" );
269 io_DelDrv( FS_REPNAME );
270 io_AddDrv( &driver );
272 return MODULE_RESIDENT_END;
int fd_open(iop_io_file_t *f, const char *name, int mode)
int fd_save(int fd, iop_io_file_t *f)
char * fd_name(char *buffer, const char *name)
int fd_close(iop_io_file_t *f)
int _start(int argc, char *argv[])
int fd_initialize(iop_io_device_t *driver)
int fd_read(iop_io_file_t *f, void *buffer, int size)
int realfd(iop_io_file_t *f)
int fd_lseek(iop_io_file_t *fd, int offset, int whence)
int fd_write(iop_io_file_t *fd, void *buffer, int size)