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;
117 char nameBuffer[ 250 ];
120 M_DEBUG(
"open %i %s %s\n", f->
unit, name ,base);
121 fd = iomanX_open(
fd_name( nameBuffer, name), mode, 0 );
122 if ( fd < 0 )
return fd;
135 return iomanX_close(
realfd(f) );
148 return iomanX_read(
realfd(f), buffer, size );
161 return iomanX_write(
realfd(fd), buffer, size );
174 return iomanX_lseek(
realfd(fd), offset, whence );
177IOMAN_RETURN_VALUE_IMPL(0);
178IOMAN_RETURN_VALUE_IMPL(
EIO);
182 IOMAN_RETURN_VALUE(0),
183 IOMAN_RETURN_VALUE(0),
184 IOMAN_RETURN_VALUE(
EIO),
188 IOMAN_RETURN_VALUE(
EIO),
190 IOMAN_RETURN_VALUE(
EIO),
191 IOMAN_RETURN_VALUE(
EIO),
192 IOMAN_RETURN_VALUE(
EIO),
193 IOMAN_RETURN_VALUE(
EIO),
194 IOMAN_RETURN_VALUE(
EIO),
195 IOMAN_RETURN_VALUE(
EIO),
196 IOMAN_RETURN_VALUE(
EIO),
197 IOMAN_RETURN_VALUE(
EIO),
198 IOMAN_RETURN_VALUE(
EIO),
206 "host redirection driver",
229 M_PRINTF(
"Copyright (c) 2004 adresd\n" );
233 M_PRINTF(
"HOST requires based argument\n" );
234 return MODULE_NO_RESIDENT_END;
239 strncpy( base, argv[1] ,
sizeof(base) - 1);
240 base[
sizeof(base) - 1] =
'\0';
242 M_PRINTF(
"redirecting '%s:' to '%s'\n",FS_REPNAME,base);
245 M_PRINTF(
"HOST final step, bye\n" );
251 io_DelDrv( FS_REPNAME );
252 io_AddDrv( &driver );
254 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_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)