Index: uspace/app/netstart/self_test.c
===================================================================
--- uspace/app/netstart/self_test.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
+++ uspace/app/netstart/self_test.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup net
+ * @{
+ */
+
+/** @file
+ * Networking self-tests implementation.
+ *
+ */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+
+#include <net_checksum.h>
+#include <adt/int_map.h>
+#include <adt/char_map.h>
+#include <adt/generic_char_map.h>
+#include <adt/measured_strings.h>
+#include <adt/dynamic_fifo.h>
+
+#include "self_test.h"
+
+/** Test the statement, compare the result and evaluate.
+ *
+ * @param[in] statement The statement to test.
+ * @param[in] result    The expected result.
+ *
+ */
+#define TEST(statement, result) \
+	do { \
+		printf("\n\t%s == %s", #statement, #result); \
+		if ((statement) != (result)) { \
+			printf("\tfailed\n"); \
+			fprintf(stderr, "\nNetwork self-test failed\n"); \
+			return EINVAL; \
+		} else \
+			printf("\tOK"); \
+	} while (0)
+
+#define XMALLOC(var, type) \
+	do { \
+		(var) = (type *) malloc(sizeof(type)); \
+		if ((var) == NULL) { \
+			fprintf(stderr, "\nMemory allocation error\n"); \
+			return ENOMEM; \
+		} \
+	} while (0)
+
+GENERIC_CHAR_MAP_DECLARE(int_char_map, int);
+GENERIC_CHAR_MAP_IMPLEMENT(int_char_map, int);
+
+GENERIC_FIELD_DECLARE(int_field, int);
+GENERIC_FIELD_IMPLEMENT(int_field, int);
+
+INT_MAP_DECLARE(int_map, int);
+INT_MAP_IMPLEMENT(int_map, int);
+
+/** Self-test start function.
+ *
+ * Run all self-tests.
+ *
+ * @returns EOK on success.
+ * @returns The first error occurred.
+ *
+ */
+int self_test(void)
+{
+	printf("Running networking self-tests\n");
+	
+	printf("\nChar map test");
+	char_map_t cm;
+	
+	TEST(char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	TEST(char_map_initialize(&cm), EOK);
+	TEST(char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_add(&cm, "bla", 0, 1), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 1);
+	TEST(char_map_add(&cm, "bla", 0, 10), EEXISTS);
+	TEST(char_map_update(&cm, "bla", 0, 2), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 2);
+	TEST(char_map_update(&cm, "ucho", 0, 2), EOK);
+	TEST(char_map_exclude(&cm, "bla", 0), 2);
+	TEST(char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "ucho", 0), 2);
+	TEST(char_map_update(&cm, "ucho", 0, 3), EOK);
+	TEST(char_map_find(&cm, "ucho", 0), 3);
+	TEST(char_map_add(&cm, "blabla", 0, 5), EOK);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "bla", 0, 6), EOK);
+	TEST(char_map_find(&cm, "bla", 0), 6);
+	TEST(char_map_exclude(&cm, "bla", 0), 6);
+	TEST(char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "auto", 0, 7), EOK);
+	TEST(char_map_find(&cm, "auto", 0), 7);
+	TEST(char_map_add(&cm, "kara", 0, 8), EOK);
+	TEST(char_map_find(&cm, "kara", 0), 8);
+	TEST(char_map_add(&cm, "nic", 0, 9), EOK);
+	TEST(char_map_find(&cm, "nic", 0), 9);
+	TEST(char_map_find(&cm, "blabla", 0), 5);
+	TEST(char_map_add(&cm, "micnicnic", 5, 9), EOK);
+	TEST(char_map_find(&cm, "micni", 0), 9);
+	TEST(char_map_find(&cm, "micnicn", 5), 9);
+	TEST(char_map_add(&cm, "\x10\x0\x2\x2", 4, 15), EOK);
+	TEST(char_map_find(&cm, "\x10\x0\x2\x2", 4), 15);
+	
+	TEST((char_map_destroy(&cm), EOK), EOK);
+	TEST(char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	
+	printf("\nCRC computation test");
+	uint32_t value;
+	
+	TEST(value = ~compute_crc32(~0, "123456789", 8 * 9), 0xcbf43926);
+	TEST(value = ~compute_crc32(~0, "1", 8), 0x83dcefb7);
+	TEST(value = ~compute_crc32(~0, "12", 8 * 2), 0x4f5344cd);
+	TEST(value = ~compute_crc32(~0, "123", 8 * 3), 0x884863d2);
+	TEST(value = ~compute_crc32(~0, "1234", 8 * 4), 0x9be3e0a3);
+	TEST(value = ~compute_crc32(~0, "12345678", 8 * 8), 0x9ae0daaf);
+	TEST(value = ~compute_crc32(~0, "ahoj pane", 8 * 9), 0x5fc3d706);
+	
+	printf("\nDynamic fifo test");
+	dyn_fifo_t fifo;
+	
+	TEST(dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	TEST(dyn_fifo_initialize(&fifo, 1), EOK);
+	TEST(dyn_fifo_push(&fifo, 1, 0), EOK);
+	TEST(dyn_fifo_pop(&fifo), 1);
+	TEST(dyn_fifo_pop(&fifo), ENOENT);
+	TEST(dyn_fifo_push(&fifo, 2, 1), EOK);
+	TEST(dyn_fifo_push(&fifo, 3, 1), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 3, 0), EOK);
+	TEST(dyn_fifo_pop(&fifo), 2);
+	TEST(dyn_fifo_pop(&fifo), 3);
+	TEST(dyn_fifo_push(&fifo, 4, 2), EOK);
+	TEST(dyn_fifo_push(&fifo, 5, 2), EOK);
+	TEST(dyn_fifo_push(&fifo, 6, 2), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 6, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 7, 5), EOK);
+	TEST(dyn_fifo_pop(&fifo), 4);
+	TEST(dyn_fifo_pop(&fifo), 5);
+	TEST(dyn_fifo_push(&fifo, 8, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 9, 5), EOK);
+	TEST(dyn_fifo_push(&fifo, 10, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 11, 6), EOK);
+	TEST(dyn_fifo_pop(&fifo), 6);
+	TEST(dyn_fifo_pop(&fifo), 7);
+	TEST(dyn_fifo_push(&fifo, 12, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 13, 6), EOK);
+	TEST(dyn_fifo_push(&fifo, 14, 6), ENOMEM);
+	TEST(dyn_fifo_push(&fifo, 14, 8), EOK);
+	TEST(dyn_fifo_pop(&fifo), 8);
+	TEST(dyn_fifo_pop(&fifo), 9);
+	TEST(dyn_fifo_pop(&fifo), 10);
+	TEST(dyn_fifo_pop(&fifo), 11);
+	TEST(dyn_fifo_pop(&fifo), 12);
+	TEST(dyn_fifo_pop(&fifo), 13);
+	TEST(dyn_fifo_pop(&fifo), 14);
+	TEST(dyn_fifo_destroy(&fifo), EOK);
+	TEST(dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	
+	printf("\nGeneric char map test");
+	
+	int *x;
+	int *y;
+	int *z;
+	int *u;
+	int *v;
+	int *w;
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_char_map_t icm;
+	icm.magic = 0;
+	
+	TEST(int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	TEST(int_char_map_initialize(&icm), EOK);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), NULL);
+	TEST(int_char_map_add(&icm, "bla", 0, x), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), x);
+	TEST(int_char_map_add(&icm, "bla", 0, y), EEXISTS);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_add(&icm, "blabla", 0, v), EOK);
+	TEST(int_char_map_find(&icm, "blabla", 0), v);
+	TEST(int_char_map_add(&icm, "bla", 0, w), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), w);
+	TEST((int_char_map_exclude(&icm, "bla", 0), EOK), EOK);
+	TEST(int_char_map_find(&icm, "bla", 0), NULL);
+	TEST(int_char_map_find(&icm, "blabla", 0), v);
+	TEST(int_char_map_add(&icm, "auto", 0, u), EOK);
+	TEST(int_char_map_find(&icm, "auto", 0), u);
+	TEST((int_char_map_destroy(&icm), EOK), EOK);
+	TEST(int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	
+	printf("\nGeneric field test");
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_field_t gf;
+	gf.magic = 0;
+	
+	TEST(int_field_add(&gf, x), EINVAL);
+	TEST(int_field_count(&gf), -1);
+	TEST(int_field_initialize(&gf), EOK);
+	TEST(int_field_count(&gf), 0);
+	TEST(int_field_get_index(&gf, 1), NULL);
+	TEST(int_field_add(&gf, x), 0);
+	TEST(int_field_get_index(&gf, 0), x);
+	TEST((int_field_exclude_index(&gf, 0), EOK), EOK);
+	TEST(int_field_get_index(&gf, 0), NULL);
+	TEST(int_field_add(&gf, y), 1);
+	TEST(int_field_get_index(&gf, 1), y);
+	TEST(int_field_add(&gf, z), 2);
+	TEST(int_field_get_index(&gf, 2), z);
+	TEST(int_field_get_index(&gf, 1), y);
+	TEST(int_field_count(&gf), 3);
+	TEST(int_field_add(&gf, u), 3);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST(int_field_add(&gf, v), 4);
+	TEST(int_field_get_index(&gf, 4), v);
+	TEST(int_field_add(&gf, w), 5);
+	TEST(int_field_get_index(&gf, 5), w);
+	TEST(int_field_count(&gf), 6);
+	TEST((int_field_exclude_index(&gf, 1), EOK), EOK);
+	TEST(int_field_get_index(&gf, 1), NULL);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST((int_field_exclude_index(&gf, 7), EOK), EOK);
+	TEST(int_field_get_index(&gf, 3), u);
+	TEST(int_field_get_index(&gf, 5), w);
+	TEST((int_field_exclude_index(&gf, 4), EOK), EOK);
+	TEST(int_field_get_index(&gf, 4), NULL);
+	TEST((int_field_destroy(&gf), EOK), EOK);
+	TEST(int_field_count(&gf), -1);
+	
+	printf("\nInt map test");
+	
+	XMALLOC(x, int);
+	XMALLOC(y, int);
+	XMALLOC(z, int);
+	XMALLOC(u, int);
+	XMALLOC(v, int);
+	XMALLOC(w, int);
+	
+	int_map_t im;
+	im.magic = 0;
+	
+	TEST(int_map_add(&im, 1, x), EINVAL);
+	TEST(int_map_count(&im), -1);
+	TEST(int_map_initialize(&im), EOK);
+	TEST(int_map_count(&im), 0);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_add(&im, 1, x), 0);
+	TEST(int_map_find(&im, 1), x);
+	TEST((int_map_exclude(&im, 1), EOK), EOK);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_add(&im, 1, y), 1);
+	TEST(int_map_find(&im, 1), y);
+	TEST(int_map_add(&im, 4, z), 2);
+	TEST(int_map_get_index(&im, 2), z);
+	TEST(int_map_find(&im, 4), z);
+	TEST(int_map_find(&im, 1), y);
+	TEST(int_map_count(&im), 3);
+	TEST(int_map_add(&im, 2, u), 3);
+	TEST(int_map_find(&im, 2), u);
+	TEST(int_map_add(&im, 3, v), 4);
+	TEST(int_map_find(&im, 3), v);
+	TEST(int_map_get_index(&im, 4), v);
+	TEST(int_map_add(&im, 6, w), 5);
+	TEST(int_map_find(&im, 6), w);
+	TEST(int_map_count(&im), 6);
+	TEST((int_map_exclude(&im, 1), EOK), EOK);
+	TEST(int_map_find(&im, 1), NULL);
+	TEST(int_map_find(&im, 2), u);
+	TEST((int_map_exclude(&im, 7), EOK), EOK);
+	TEST(int_map_find(&im, 2), u);
+	TEST(int_map_find(&im, 6), w);
+	TEST((int_map_exclude_index(&im, 4), EOK), EOK);
+	TEST(int_map_get_index(&im, 4), NULL);
+	TEST(int_map_find(&im, 3), NULL);
+	TEST((int_map_destroy(&im), EOK), EOK);
+	TEST(int_map_count(&im), -1);
+	
+	printf("\nMeasured strings test");
+	
+	measured_string_ref string =
+	    measured_string_create_bulk("I am a measured string!", 0);
+	printf("\n%x, %s at %x of %d\n", string, string->value, string->value,
+	    string->length);
+	
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/app/netstart/self_test.h
===================================================================
--- uspace/app/netstart/self_test.h	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
+++ uspace/app/netstart/self_test.h	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup net
+ * @{
+ */
+
+#ifndef __SELF_TEST_H__
+#define __SELF_TEST_H__
+
+extern int self_test(void);
+
+#endif
+
+/** @}
+ */
Index: uspace/drv/usbhid/generic/hiddev.c
===================================================================
--- uspace/drv/usbhid/generic/hiddev.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/generic/hiddev.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -126,13 +126,5 @@
 	}
 	
-	/*! @todo This should probably be atomic. */
-//	if (usb_hid_report_ready()) {
-//		usb_log_debug2("Report ready, size: %zu\n", 
-//		    hid_dev->input_report_size);
-		
-//		usb_hid_report_received();
-//	} else {
-//		memset(buffer, 0, hid_dev->input_report_size);
-//	}
+	/*! @todo This should probably be somehow atomic. */
 	memcpy(buffer, hid_dev->input_report, 
 	    hid_dev->input_report_size);
@@ -140,9 +132,4 @@
 	*event_nr = usb_hid_report_number(hid_dev);
 	
-	// clear the buffer so that it will not be received twice
-	//memset(hid_dev->input_report, 0, hid_dev->input_report_size);
-	
-	// note that we already received this report
-//	report_received = true;
 	usb_log_debug2("OK\n");
 	
@@ -184,5 +171,5 @@
 	
 	if (hid_dev->report_desc_size > size) {
-		return EINVAL;	// TODO: other error code
+		return EINVAL;
 	}
 	
Index: uspace/drv/usbhid/kbd/kbddev.c
===================================================================
--- uspace/drv/usbhid/kbd/kbddev.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/kbd/kbddev.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -72,15 +72,4 @@
 static const unsigned DEFAULT_ACTIVE_MODS = KM_NUM_LOCK;
 
-///** Boot protocol report size (key part). */
-//static const size_t BOOTP_REPORT_SIZE = 6;
-
-///** Boot protocol total report size. */
-//static const size_t BOOTP_BUFFER_SIZE = 8;
-
-///** Boot protocol output report size. */
-//static const size_t BOOTP_BUFFER_OUT_SIZE = 1;
-
-///** Boot protocol error key code. */
-//static const uint8_t BOOTP_ERROR_ROLLOVER = 1;
 static const uint8_t ERROR_ROLLOVER = 1;
 
@@ -105,19 +94,4 @@
 	.flags = 0
 };
-
-//static usb_endpoint_description_t hid_poll_endpoint_description = {
-//	.transfer_type = USB_TRANSFER_INTERRUPT,
-//	.direction = USB_DIRECTION_IN,
-//	.interface_class = USB_CLASS_HID,
-//	.flags = 0
-//};
-
-///* Array of endpoints expected on the device, NULL terminated. */
-//usb_endpoint_description_t 
-//    *usb_kbd_endpoints[USB_KBD_POLL_EP_COUNT + 1] = {
-//	&boot_poll_endpoint_description,
-//	&hid_poll_endpoint_description,
-//	NULL
-//};
 
 const char *HID_KBD_FUN_NAME = "keyboard";
@@ -176,13 +150,4 @@
 
 /*----------------------------------------------------------------------------*/
-
-//static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,
-//    uint8_t report_id, void *arg);
-
-//static const usb_hid_report_in_callbacks_t usb_kbd_parser_callbacks = {
-//	.keyboard = usb_kbd_process_keycodes
-//};
-
-/*----------------------------------------------------------------------------*/
 /* Keyboard layouts                                                           */
 /*----------------------------------------------------------------------------*/
@@ -200,39 +165,8 @@
 
 /*----------------------------------------------------------------------------*/
-/* Modifier constants                                                         */
-/*----------------------------------------------------------------------------*/
-/** Mapping of USB modifier key codes to generic modifier key codes. */
-//static const keycode_t usbhid_modifiers_keycodes[USB_HID_MOD_COUNT] = {
-//	KC_LCTRL,         /* USB_HID_MOD_LCTRL */
-//	KC_LSHIFT,        /* USB_HID_MOD_LSHIFT */
-//	KC_LALT,          /* USB_HID_MOD_LALT */
-//	0,                /* USB_HID_MOD_LGUI */
-//	KC_RCTRL,         /* USB_HID_MOD_RCTRL */
-//	KC_RSHIFT,        /* USB_HID_MOD_RSHIFT */
-//	KC_RALT,          /* USB_HID_MOD_RALT */
-//	0,                /* USB_HID_MOD_RGUI */
-//};
-
-//typedef enum usbhid_lock_code {
-//	USB_KBD_LOCK_NUM = 0x53,
-//	USB_KBD_LOCK_CAPS = 0x39,
-//	USB_KBD_LOCK_SCROLL = 0x47,
-//	USB_KBD_LOCK_COUNT = 3
-//} usbhid_lock_code;
-
-//static const usbhid_lock_code usbhid_lock_codes[USB_KBD_LOCK_COUNT] = {
-//	USB_KBD_LOCK_NUM,
-//	USB_KBD_LOCK_CAPS,
-//	USB_KBD_LOCK_SCROLL
-//};
-
-/*----------------------------------------------------------------------------*/
 /* IPC method handler                                                         */
 /*----------------------------------------------------------------------------*/
 
 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
-//ddf_dev_ops_t keyboard_ops = {
-//	.default_handler = default_connection_handler
-//};
 
 /** 
@@ -301,5 +235,5 @@
 		return;
 	}
-		
+
 	/* Reset the LED data. */
 	memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
@@ -495,5 +429,5 @@
  */
 static void usb_kbd_check_key_changes(usb_hid_dev_t *hid_dev, 
-    usb_kbd_t *kbd_dev/*, const uint8_t *key_codes, size_t count*/)
+    usb_kbd_t *kbd_dev)
 {
 	unsigned int key;
@@ -567,17 +501,4 @@
 	}
 	
-//	usb_log_debug("Old keys: ");
-//	for (i = 0; i < kbd_dev->key_count; ++i) {
-//		usb_log_debug("%d ", kbd_dev->keys_old[i]);
-//	}
-//	usb_log_debug("\n");
-	
-	
-//	usb_log_debug("New keys: ");
-//	for (i = 0; i < kbd_dev->key_count; ++i) {
-//		usb_log_debug("%d ", kbd_dev->keys[i]);
-//	}
-//	usb_log_debug("\n");
-	
 	memcpy(kbd_dev->keys_old, kbd_dev->keys, kbd_dev->key_count * 4);
 	
@@ -590,54 +511,4 @@
 
 /*----------------------------------------------------------------------------*/
-/* Callbacks for parser                                                       */
-/*----------------------------------------------------------------------------*/
-/**
- * Callback function for the HID report parser.
- *
- * This function is called by the HID report parser with the parsed report.
- * The parsed report is used to check if any events occured (key was pressed or
- * released, modifier was pressed or released).
- *
- * @param key_codes Parsed keyboard report - codes of currently pressed keys 
- *                  according to HID Usage Tables.
- * @param count Number of key codes in report (size of the report).
- * @param report_id
- * @param arg User-specified argument. Expects pointer to the keyboard device
- *            structure representing the keyboard.
- *
- * @sa usb_kbd_check_key_changes(), usb_kbd_check_modifier_changes()
- */
-//static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,
-//    uint8_t report_id, void *arg)
-//{
-//	if (arg == NULL) {
-//		usb_log_warning("Missing argument in callback "
-//		    "usbhid_process_keycodes().\n");
-//		return;
-//	}
-	
-//	usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
-	
-//	if (hid_dev->data == NULL) {
-//		usb_log_warning("Missing KBD device structure in callback.\n");
-//		return;
-//	}
-	
-//	usb_kbd_t *kbd_dev = (usb_kbd_t *)hid_dev->data;
-
-//	usb_log_debug("Got keys from parser (report id: %u): %s\n", 
-//	    report_id, usb_debug_str_buffer(key_codes, count, 0));
-	
-//	if (count != kbd_dev->key_count) {
-//		usb_log_warning("Number of received keycodes (%zu) differs from"
-//		    " expected (%zu).\n", count, kbd_dev->key_count);
-//		return;
-//	}
-	
-//	///usb_kbd_check_modifier_changes(kbd_dev, key_codes, count);
-//	usb_kbd_check_key_changes(hid_dev, kbd_dev, key_codes, count);
-//}
-
-/*----------------------------------------------------------------------------*/
 /* General kbd functions                                                      */
 /*----------------------------------------------------------------------------*/
@@ -668,9 +539,6 @@
 	    "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0));
 	
-//	int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size,
-//	    callbacks, kbd_dev);
 	usb_hid_report_path_t *path = usb_hid_report_path();
 	usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
-	//usb_hid_report_path_set_report_id(path, 0);
 
 	uint8_t report_id;
@@ -698,16 +566,6 @@
 		
 		assert(i < kbd_dev->key_count);
-//		if (i == kbd_dev->key_count) {
-//			break;
-//		}
 		
 		// save the key usage
-		/* TODO: maybe it's not good to save value, nor usage
-		 *       as the value may be e.g. 1 for LEDs and usage may be
-		 *       value of the LED. On the other hand, in case of normal
-		 *       keys, the usage is more important and we must check
-		 *       that. One possible solution: distinguish between those
-		 *       two parts of the Report somehow.
-		 */
 		if (field->value != 0) {
 			kbd_dev->keys[i] = field->usage;
@@ -896,5 +754,5 @@
 		usb_log_warning("Error creating output report buffer.\n");
 		free(kbd_dev->keys);
-		return ENOMEM;  /* TODO: other error code */
+		return ENOMEM;
 	}
 	
@@ -951,5 +809,4 @@
 	
 	// save the KBD device structure into the HID device structure
-	//hid_dev->data = kbd_dev;
 	*data = kbd_dev;
 	
@@ -1038,6 +895,6 @@
 	
 	if ((*kbd_dev)->repeat_mtx != NULL) {
-		/* TODO: replace by some check and wait */
-		assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));
+		//assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));
+		while (fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)) {}
 		free((*kbd_dev)->repeat_mtx);
 	}
Index: uspace/drv/usbhid/kbd/main.c
===================================================================
--- uspace/drv/usbhid/kbd/main.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/kbd/main.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -131,14 +131,8 @@
 		    "Could not add DDF function to class 'keyboard': %s.\n",
 		    str_error(rc));
-		// TODO: Can / should I destroy the DDF function?
 		ddf_fun_destroy(kbd_fun);
 		usb_kbd_free(&kbd_dev);
 		return rc;
 	}
-	
-	/*
-	 * Create new fibril for handling this keyboard
-	 */
-	//fid_t fid = fibril_create(usb_kbd_fibril, kbd_dev);
 	
 	/* Start automated polling function.
@@ -164,5 +158,4 @@
 		return rc;
 	}
-	//fibril_add_ready(fid);
 	
 	/*
Index: uspace/drv/usbhid/mouse/mousedev.c
===================================================================
--- uspace/drv/usbhid/mouse/mousedev.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/mouse/mousedev.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -394,5 +394,5 @@
 	
 	fun->ops = &mouse->ops;
-	fun->driver_data = mouse;   // TODO: maybe change to hid_dev->data
+	fun->driver_data = mouse;
 
 	int rc = ddf_fun_bind(fun);
@@ -432,5 +432,5 @@
 	 */
 	fun->ops = &mouse->ops;
-	fun->driver_data = mouse;   // TODO: maybe change to hid_dev->data
+	fun->driver_data = mouse;
 
 	rc = ddf_fun_bind(fun);
@@ -488,10 +488,9 @@
 	
 	// set handler for incoming calls
-	// TODO: must be one for each subdriver!!
 	mouse_dev->ops.default_handler = default_connection_handler;
 	
 	// TODO: how to know if the device supports the request???
-//	usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, 
-//	    hid_dev->usb_dev->interface_no, IDLE_RATE);
+	usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, 
+	    hid_dev->usb_dev->interface_no, IDLE_RATE);
 	
 	int rc = usb_mouse_create_function(hid_dev, mouse_dev);
Index: uspace/drv/usbhid/mouse/mousedev.h
===================================================================
--- uspace/drv/usbhid/mouse/mousedev.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/mouse/mousedev.h	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -45,6 +45,4 @@
 /** Container for USB mouse device. */
 typedef struct {
-	///** Polling interval in microseconds. */
-	//suseconds_t poll_interval_us;
 	/** IPC phone to console (consumer). */
 	int mouse_phone;
Index: uspace/drv/usbhid/multimedia/multimedia.c
===================================================================
--- uspace/drv/usbhid/multimedia/multimedia.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/multimedia/multimedia.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -143,6 +143,4 @@
 	assert(multim_dev != NULL);
 	
-//	usb_multimedia_t *multim_dev = (usb_multimedia_t *)hid_dev->data;
-	
 	console_event_t ev;
 	
@@ -173,12 +171,4 @@
 	// hangup phone to the console
 	async_hangup((*multim_dev)->console_phone);
-	
-	// free all buffers
-//	if ((*multim_dev)->keys != NULL) {
-//		free((*multim_dev)->keys);
-//	}
-//	if ((*multim_dev)->keys_old != NULL) {
-//		free((*multim_dev)->keys_old);
-//	}
 
 	free(*multim_dev);
@@ -245,36 +235,4 @@
 	multim_dev->console_phone = -1;
 	
-//	usb_hid_report_path_t *path = usb_hid_report_path();
-//	usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
-	
-//	usb_hid_report_path_set_report_id(path, 1);
-	
-//	multim_dev->key_count = usb_hid_report_size(
-//	    hid_dev->report, 1, USB_HID_REPORT_TYPE_INPUT);
-
-//	usb_hid_report_path_free(path);
-	
-//	usb_log_debug(NAME " Size of the input report: %zu\n", 
-//	    multim_dev->key_count);
-	
-//	multim_dev->keys = (int32_t *)calloc(multim_dev->key_count, 
-//	    sizeof(int32_t));
-	
-//	if (multim_dev->keys == NULL) {
-//		usb_log_fatal("No memory!\n");
-//		free(multim_dev);
-//		return ENOMEM;
-//	}
-	
-//	multim_dev->keys_old = 
-//		(int32_t *)calloc(multim_dev->key_count, sizeof(int32_t));
-	
-//	if (multim_dev->keys_old == NULL) {
-//		usb_log_fatal("No memory!\n");
-//		free(multim_dev->keys);
-//		free(multim_dev);
-//		return ENOMEM;
-//	}
-	
 	/*! @todo Autorepeat */
 	
@@ -315,11 +273,10 @@
 {
 	// TODO: checks
+	if (hid_dev == NULL || data == NULL || buffer == NULL) {
+		return false;
+	}
 	
 	usb_log_debug(NAME " usb_lgtch_polling_callback(%p, %p, %zu)\n",
 	    hid_dev, buffer, buffer_size);
-	
-	if (data == NULL) {
-		return EINVAL;	// TODO: other error code?
-	}
 	
 	usb_multimedia_t *multim_dev = (usb_multimedia_t *)data;
@@ -348,7 +305,5 @@
 	    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
 	    USB_HID_REPORT_TYPE_INPUT);
-	
-//	unsigned int key;
-	
+
 	/*! @todo Is this iterating OK if done multiple times? 
 	 *  @todo The parsing is not OK
Index: uspace/drv/usbhid/subdrivers.c
===================================================================
--- uspace/drv/usbhid/subdrivers.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/subdrivers.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -58,8 +58,4 @@
 };
 
-//static usb_hid_subdriver_usage_t generic_hid_key_path[] = {
-//	{0, 0}
-//};
-
 const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = {
 	{
@@ -103,17 +99,4 @@
 		}
 	},
-//	{
-//		generic_hid_key_path,
-//		0,
-//		USB_HID_PATH_COMPARE_ANYWHERE,
-//		-1,
-//		-1,
-//		{
-//			.init = usb_generic_hid_init,
-//			.deinit = NULL,
-//			.poll = usb_generic_hid_polling_callback,
-//			.poll_end = NULL
-//		}
-//	},
 	{NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL, NULL}}
 };
Index: uspace/drv/usbhid/usbhid.c
===================================================================
--- uspace/drv/usbhid/usbhid.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/usbhid.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -63,7 +63,4 @@
 static const int USB_HID_MAX_SUBDRIVERS = 10;
 
-/** @todo What happens if this is not fibril local? */
-//static fibril_local bool report_number;
-
 /*----------------------------------------------------------------------------*/
 
@@ -206,30 +203,12 @@
 	}
 	
-//	if (mapping->report_id >= 0) {
-//		usb_hid_report_path_set_report_id(usage_path, 
-//		    mapping->report_id);
-//	}
-	
 	assert(hid_dev->report != NULL);
 	
 	usb_log_debug("Compare flags: %d\n", mapping->compare);
-//	size_t size = usb_hid_report_size(hid_dev->report, 0, 
-//	    USB_HID_REPORT_TYPE_INPUT);
-//	size_t size = 0;
 	
 	bool matches = false;
-
-//	usb_hid_report_description_t *report_des = 
-//		usb_hid_report_find_description(hid_dev->report,
-//		mapping->report_id, USB_HID_REPORT_TYPE_INPUT);
 	uint8_t report_id = mapping->report_id;
 
-	/*while(report_des != NULL)*/do {
-
-//		if((mapping->report_id) == 0 && (report_des->report_id != 0)) {
-//			usb_hid_report_path_set_report_id(usage_path,
-//				report_des->report_id);
-//		}
-					     
+	do {
 		usb_log_debug("Trying report id %u\n", report_id);
 		
@@ -247,8 +226,4 @@
 
 		if (field != NULL) {
-//			size++;
-//			field = usb_hid_report_get_sibling(hid_dev->report,
-//			    field, usage_path, mapping->compare, 
-//			    USB_HID_REPORT_TYPE_INPUT);
 			matches = true;
 			break;
@@ -258,24 +233,6 @@
 		    hid_dev->report, report_id,
 		    USB_HID_REPORT_TYPE_INPUT);
-
-//		if((mapping->report_id == 0) && (report_des->report_id != 0)) {
-//			uint8_t report_id = usb_hid_get_next_report_id(
-//				hid_dev->report, report_des->report_id,
-//			        USB_HID_REPORT_TYPE_INPUT);
-
-//			if(report_id == 0) {
-//				break;
-//			}
-
-//	 		report_des = usb_hid_report_find_description(
-//				hid_dev->report, report_id, 
-//				USB_HID_REPORT_TYPE_INPUT);
-//		}
-//		else {
-//			break;
-//		}
 	} while (!matches && report_id != 0);
 	
-//	usb_log_debug("Size of the input report: %zu\n", size);
 	usb_hid_report_path_free(usage_path);
 	
@@ -423,6 +380,5 @@
 	
 	uint8_t report_id = 0;
-	size_t size;/* = usb_hid_report_byte_size(hid_dev->report, report_id, 
-	    USB_HID_REPORT_TYPE_INPUT);*/
+	size_t size;
 	
 	size_t max_size = 0;
@@ -503,5 +459,4 @@
 	rc = usb_hid_check_pipes(hid_dev, dev);
 	if (rc != EOK) {
-		//usb_hid_free(&hid_dev);
 		return rc;
 	}
@@ -551,6 +506,4 @@
 			    == USB_HID_GENERIC_POLL_EP_NO);
 			
-			/* TODO: this has no meaning if the report descriptor
-			         is not parsed */
 			usb_log_info("Falling back to generic HID driver.\n");
 			rc = usb_hid_set_generic_hid_subdriver(hid_dev);
@@ -563,5 +516,4 @@
 		usb_log_debug("Subdriver count: %d\n", 
 		    hid_dev->subdriver_count);
-		//usb_hid_free(&hid_dev);
 		
 	} else {
@@ -619,9 +571,8 @@
 	usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
 	
-//	int allocated = (hid_dev->input_report != NULL);
 	assert(hid_dev->input_report != NULL);
 	usb_log_debug("Max input report size: %zu, buffer size: %zu\n",
 	    hid_dev->max_input_report_size, buffer_size);
-	//assert(hid_dev->max_input_report_size >= buffer_size);
+
 	if (hid_dev->max_input_report_size >= buffer_size) {
 		/*! @todo This should probably be atomic. */
@@ -670,39 +621,4 @@
 /*----------------------------------------------------------------------------*/
 
-//const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev)
-//{
-//	switch (hid_dev->poll_pipe_index) {
-//	case USB_HID_KBD_POLL_EP_NO:
-//		return HID_KBD_FUN_NAME;
-//		break;
-//	case USB_HID_MOUSE_POLL_EP_NO:
-//		return HID_MOUSE_FUN_NAME;
-//		break;
-//	default:
-//		return HID_GENERIC_FUN_NAME;
-//	}
-//}
-
-/*----------------------------------------------------------------------------*/
-
-//const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev)
-//{
-//	// this means that only boot protocol keyboards will be connected
-//	// to the console; there is probably no better way to do this
-	
-//	switch (hid_dev->poll_pipe_index) {
-//	case USB_HID_KBD_POLL_EP_NO:
-//		return HID_KBD_CLASS_NAME;
-//		break;
-//	case USB_HID_MOUSE_POLL_EP_NO:
-//		return HID_MOUSE_CLASS_NAME;
-//		break;
-//	default:
-//		return HID_GENERIC_CLASS_NAME;
-//	}
-//}
-
-/*----------------------------------------------------------------------------*/
-
 void usb_hid_new_report(usb_hid_dev_t *hid_dev)
 {
@@ -716,18 +632,4 @@
 	return hid_dev->report_nr;
 }
-
-/*----------------------------------------------------------------------------*/
-
-//void usb_hid_report_received(void)
-//{
-//	++report_number;
-//}
-
-/*----------------------------------------------------------------------------*/
-
-//bool usb_hid_report_ready(void)
-//{
-//	return !report_received;
-//}
 
 /*----------------------------------------------------------------------------*/
Index: uspace/drv/usbhid/usbhid.h
===================================================================
--- uspace/drv/usbhid/usbhid.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhid/usbhid.h	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -55,5 +55,4 @@
                                          bool reason);
 
-// TODO: add function and class name??
 typedef struct usb_hid_subdriver {	
 	/** Function to be called when initializing HID device. */
@@ -126,15 +125,7 @@
      void *arg);
 
-//const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev);
-
-//const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev);
-
 void usb_hid_new_report(usb_hid_dev_t *hid_dev);
 
 int usb_hid_report_number(usb_hid_dev_t *hid_dev);
-
-//void usb_hid_report_received(void);
-
-//bool usb_hid_report_ready(void);
 
 void usb_hid_free(usb_hid_dev_t **hid_dev);
Index: uspace/drv/usbhub/ports.c
===================================================================
--- uspace/drv/usbhub/ports.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhub/ports.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -95,5 +95,5 @@
  * @param port port number, starting from 1
  */
-void usb_hub_process_interrupt(usb_hub_info_t *hub,
+void usb_hub_process_port_interrupt(usb_hub_info_t *hub,
     uint16_t port) {
 	usb_log_debug("Interrupt at port %zu\n", (size_t) port);
Index: uspace/drv/usbhub/ports.h
===================================================================
--- uspace/drv/usbhub/ports.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhub/ports.h	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -70,5 +70,5 @@
 
 
-void usb_hub_process_interrupt(usb_hub_info_t *hub,
+void usb_hub_process_port_interrupt(usb_hub_info_t *hub,
 	uint16_t port);
 
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ uspace/drv/usbhub/usbhub.c	(revision d754f5928ea0c9b368a6f672602fb86f4ab4e4fe)
@@ -168,5 +168,5 @@
 		bool change = (change_bitmap[port / 8] >> (port % 8)) % 2;
 		if (change) {
-			usb_hub_process_interrupt(hub, port);
+			usb_hub_process_port_interrupt(hub, port);
 		}
 	}
@@ -266,11 +266,6 @@
 
 		if (!has_individual_port_powering) {
-			usb_log_debug("Has_global powering\n");
-			opResult = usb_hub_set_feature(hub_info->control_pipe,
-			    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
-			if (opResult != EOK) {
-				usb_log_error("Cannot power hub: %s\n",
-				    str_error(opResult));
-			}
+			//this setting actually makes no difference
+			usb_log_debug("Hub has global powering\n");
 		}
 
@@ -280,5 +275,5 @@
 			    port, USB_HUB_FEATURE_PORT_POWER);
 			if (opResult != EOK) {
-				usb_log_error("cannot power on port %zu: %s.\n",
+				usb_log_error("Cannot power on port %zu: %s.\n",
 				    port, str_error(opResult));
 			}
Index: uspace/lib/packet/include/net_byteorder.h
===================================================================
--- uspace/lib/packet/include/net_byteorder.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Host - network byte order manipulation functions.
- */
-
-#ifndef __NET_BYTEORDER_H__
-#define __NET_BYTEORDER_H__
-
-#include <byteorder.h>
-#include <sys/types.h>
-
-
-/** Converts the given short number (16 bit) from the host byte order to the network byte order (big endian).
- *  @param[in] number The number in the host byte order to be converted.
- *  @returns The number in the network byte order.
- */
-#define htons(number)		host2uint16_t_be(number)
-
-/** Converts the given long number (32 bit) from the host byte order to the network byte order (big endian).
- *  @param[in] number The number in the host byte order to be converted.
- *  @returns The number in the network byte order.
- */
-#define htonl(number)		host2uint32_t_be(number)
-
-/** Converts the given short number (16 bit) from the network byte order (big endian) to the host byte order.
- *  @param[in] number The number in the network byte order to be converted.
- *  @returns The number in the host byte order.
- */
-#define ntohs(number) 	uint16_t_be2host(number)
-
-/** Converts the given long number (32 bit) from the network byte order (big endian) to the host byte order.
- *  @param[in] number The number in the network byte order to be converted.
- *  @returns The number in the host byte order.
- */
-#define ntohl(number)		uint32_t_be2host(number)
-
-#endif
-
-/** @}
- */
Index: uspace/lib/packet/include/net_err.h
===================================================================
--- uspace/lib/packet/include/net_err.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- * @{
- */
-
-/** @file
- * Common error processing codes and routines.
- */
-
-#ifndef __NET_ERR_H__
-#define __NET_ERR_H__
-
-#include <errno.h>
-
-#ifdef CONFIG_DEBUG
-	#include <stdio.h>
-	#include <str_error.h>
-#endif
-
-/** An actual stored error code.
- *
- */
-#define ERROR_CODE  error_check_return_value
-
-/** An error processing routines declaration.
- *
- * This has to be declared in the block where the error processing
- * is desired.
- *
- */
-#define ERROR_DECLARE  int ERROR_CODE
-
-/** Store the value as an error code and checks if an error occurred.
- *
- * @param[in] value The value to be checked. May be a function call.
- * @return False if the value indicates success (EOK).
- * @return True otherwise.
- *
- */
-#ifdef CONFIG_DEBUG
-
-#define ERROR_OCCURRED(value) \
-	(((ERROR_CODE = (value)) != EOK) \
-	&& ({ \
-		fprintf(stderr, "libsocket error at %s:%d (%s)\n", \
-		__FILE__, __LINE__, str_error(ERROR_CODE)); \
-		1; \
-	}))
-
-#else
-
-#define ERROR_OCCURRED(value)  ((ERROR_CODE = (value)) != EOK)
-
-#endif
-
-/** Error propagation
- *
- * Check if an error occurred and immediately exit the actual
- * function returning the error code.
- *
- * @param[in] value The value to be checked. May be a function call.
- *
- */
-
-#define ERROR_PROPAGATE(value) \
-	if (ERROR_OCCURRED(value)) \
-		return ERROR_CODE
-
-#endif
-
-/** @}
- */
Index: uspace/lib/packet/include/socket_errno.h
===================================================================
--- uspace/lib/packet/include/socket_errno.h	(revision 109d55cf4b5cb06ac7111270941a58a4f3a48b11)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Socket error codes.
- *  Based on BSD.
- */
-
-#ifndef __NET_SOCKET_ERR_H__
-#define __NET_SOCKET_ERR_H__
-
-#include <errno.h>
-
-/** @name Socket error codes definitions
- */
-/*@{*/
-
-////#define EINTR			(-10004)
-////#define EBADF			(-10009)
-//#define EACCES			(-10013)
-//#define EFAULT			(-10014)
-////#define EINVAL			(-10022)
-////#define EMFILE			(-10024)
-//#define EWOULDBLOCK		(-10035)
-
-/** An API function is called while another blocking function is in progress.
- */
-#define EINPROGRESS		(-10036)
-
-//#define EALREADY		(-10037)
-
-/** The socket identifier is not valid.
- */
-#define ENOTSOCK		(-10038)
-
-/** The destination address required.
- */
-#define EDESTADDRREQ	(-10039)
-
-//#define EMSGSIZE		(-10040)
-//#define EPROTOTYPE		(-10041)
-//#define ENOPROTOOPT		(-10042)
-
-/** Protocol is not supported.
- */
-#define EPROTONOSUPPORT	(-10043)
-
-/** Socket type is not supported.
- */
-#define ESOCKTNOSUPPORT	(-10044)
-
-//#define EOPNOTSUPP		(-10045)
-
-/** Protocol family is not supported.
- */
-#define EPFNOSUPPORT	(-10046)
-
-/** Address family is not supported.
- */
-#define EAFNOSUPPORT	(-10047)
-
-/** Address is already in use.
- */
-#define EADDRINUSE		(-10048)
-
-//#define EADDRNOTAVAIL	(-10049)
-/* May be reported at any time if the implementation detects an underlying failure.
- */
-//#define ENETDOWN		(-10050)
-//#define ENETUNREACH		(-10051)
-//#define ENETRESET		(-10052)
-//#define ECONNABORTED	(-10053)
-//#define ECONNRESET		(-10054)
-//#define ENOBUFS			(-10055)
-//#define EISCONN			(-10056)
-
-/** The socket is not connected or bound.
- */
-#define ENOTCONN		(-10057)
-
-//#define ESHUTDOWN		(-10058)
-//#define ETOOMANYREFS	(-10059)
-//#define ETIMEDOUT		(-10060)
-//#define ECONNREFUSED	(-10061)
-//#define ELOOP			(-10062)
-////#define ENAMETOOLONG	(-10063)
-//#define EHOSTDOWN		(-10064)
-//#define EHOSTUNREACH	(-10065)
-//#define HOST_NOT_FOUND	(-11001)
-
-/** The requested operation was not performed.
- *  Try again later.
- */
-#define TRY_AGAIN		(-11002)
-
-//#define NO_RECOVERY		(-11003)
-
-/** No data.
- */
-#define NO_DATA			(-11004)
-
-/*@}*/
-
-#endif
-
-/** @}
- */
