#include <kdata.h>
#include <devsys.h>
#include <audio.h>
+#include <netdev.h>
+#include <net_native.h>
/*
* System devices:
* Minor 2 zero
* Minor 3 proc
* Minor 64 audio
+ * Minor 65 net_native
*
* Use Minor 128+ for platform specific devices
*/
if (udata.u_offset >= PTABSIZE * sizeof(struct p_tab))
return 0;
return uputsys(addr + udata.u_offset, udata.u_count);
+#ifdef CONFIG_NET_NATIVE
+ case 65:
+ return netdev_read(flag);
+#endif
default:
udata.u_error = ENXIO;
return -1;
case 3:
udata.u_error = EINVAL;
return -1;
+#ifdef CONFIG_NET_NATIVE
+ case 65:
+ return netdev_write(flag);
+#endif
default:
udata.u_error = ENXIO;
return -1;
#ifdef CONFIG_AUDIO
if (minor == 64)
return audio_ioctl(request, data);
+#endif
+#ifdef CONFIG_NET_NATIVE
+ if (minor == 65)
+ return netdev_ioctl(request, data);
#endif
if (minor != 3) {
udata.u_error = ENOTTY;
}
return 0;
}
+
+int sys_close(uint8_t minor)
+{
+ used(minor);
+#ifdef CONFIG_NET_NATIVE
+ if (minor == 65)
+ return netdev_close(minor);
+#endif
+ return 0;
+}
\ No newline at end of file
extern int sys_read(uint8_t minor, uint8_t rawflag, uint8_t flag);
extern int sys_write(uint8_t minor, uint8_t rawflag, uint8_t flag);
extern int sys_ioctl(uint8_t minor, uarg_t request, char *data);
+extern int sys_close(uint8_t minor);
#define EOPNOTSUPP 44 /* Operation not supported on transport
endpoint */
#define ECONNRESET 45 /* Connection reset by peer */
+#define ENETDOWN 46 /* Network is down */
+#define EMSGSIZE 47 /* Message too long */
/*
* ioctls for kernel internal operations start at 0x8000 and cannot be issued
* Graphics ioctls 03xx (see graphics.h)
*/
+/*
+ * Networking ioctls 04xx (see net_native.h)
+ */
+
/*
* System info shared with user space
*/
/* 3: /dev/lpr Printer devices */
{ lpr_open, lpr_close, no_rdwr, lpr_write, no_ioctl },
/* 4: /dev/mem etc System devices (one offs) */
- { no_open, no_close, sys_read, sys_write, sys_ioctl },
+ { no_open, sys_close, sys_read, sys_write, sys_ioctl },
/* Pack to 7 with nxio if adding private devices and start at 8 */
};