From 685d1f5c4d865e814a4640f5f3270a82ea10e4b0 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 12 Jan 2010 22:25:31 +0800 Subject: [PATCH 1/1] More work on UDI, Added more Login VTerms --- Kernel/Makefile.BuildNum | 2 +- Modules/IPStack/main.c | 14 +++++++-- Modules/UDI/include/udi.h | 4 +++ Modules/UDI/include/udi_attr.h | 41 +++++++++++++++++++++++++++ Modules/UDI/include/udi_cb.h | 39 +++++++++++++++++++++++++ Modules/UDI/include/udi_init.h | 21 ++++++++------ Modules/UDI/include/udi_log.h | 34 ++++++++++++++++++++++ Usermode/Applications/init_src/main.c | 2 +- 8 files changed, 143 insertions(+), 14 deletions(-) create mode 100644 Modules/UDI/include/udi_attr.h create mode 100644 Modules/UDI/include/udi_cb.h create mode 100644 Modules/UDI/include/udi_log.h diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 662ae943..1f36a5a3 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 94 +BUILD_NUM = 1295 diff --git a/Modules/IPStack/main.c b/Modules/IPStack/main.c index cf9adf65..448381db 100644 --- a/Modules/IPStack/main.c +++ b/Modules/IPStack/main.c @@ -79,7 +79,7 @@ int IPStack_Install(char **Arguments) char *IPStack_ReadDir(tVFS_Node *Node, int Pos) { tInterface *iface; - char name[] = "ip0\0\0\0"; + char *name; ENTER("pNode iPos", Node, Pos); // Traverse the list @@ -91,23 +91,31 @@ char *IPStack_ReadDir(tVFS_Node *Node, int Pos) return NULL; } + name = malloc(6); + name[0] = 'i'; + name[1] = 'p'; + // Create the name Pos = iface->Node.ImplInt; - if(Pos < 10) + if(Pos < 10) { name[2] = '0' + Pos; + name[3] = '\0'; + } else if(Pos < 100) { name[2] = '0' + Pos/10; name[3] = '0' + Pos%10; + name[4] = '\0'; } else { name[2] = '0' + Pos/100; name[3] = '0' + (Pos/10)%10; name[4] = '0' + Pos%10; + name[5] = '\0'; } LEAVE('s', name); // Return the pre-generated name - return strdup(name); + return name; } /** diff --git a/Modules/UDI/include/udi.h b/Modules/UDI/include/udi.h index acfdebb8..136d42df 100644 --- a/Modules/UDI/include/udi.h +++ b/Modules/UDI/include/udi.h @@ -135,7 +135,11 @@ typedef const udi_ubit8_t udi_layout_t; * \} */ + // === INCLUDE SUB-SECTIONS === +#include "udi_log.h" // Management Metalanguage +#include "udi_attr.h" // Management Metalanguage +#include "udi_cb.h" // Management Metalanguage #include "udi_meta_mgmt.h" // Management Metalanguage #include "udi_init.h" // Init diff --git a/Modules/UDI/include/udi_attr.h b/Modules/UDI/include/udi_attr.h new file mode 100644 index 00000000..a63ce8a7 --- /dev/null +++ b/Modules/UDI/include/udi_attr.h @@ -0,0 +1,41 @@ +/** + * \file udi_attr.h + */ +#ifndef _UDI_ATTR_H_ +#define _UDI_ATTR_H_ + +typedef struct udi_instance_attr_list_s udi_instance_attr_list_t; +typedef udi_ubit8_t udi_instance_attr_type_t; + +/* Instance attribute limits */ +#define UDI_MAX_ATTR_NAMELEN 32 +#define UDI_MAX_ATTR_SIZE 64 + +/** + * \brief Instance Attribute + */ +struct udi_instance_attr_list_s +{ + char attr_name[UDI_MAX_ATTR_NAMELEN]; + udi_ubit8_t attr_value[UDI_MAX_ATTR_SIZE]; + udi_ubit8_t attr_length; + udi_instance_attr_type_t attr_type; +}; + + +/** + * \brief Instance Attribute Types + * \see ::udi_instance_attr_type_t + */ +enum +{ + UDI_ATTR_NONE, + UDI_ATTR_STRING, + UDI_ATTR_ARRAY8, + UDI_ATTR_UBIT32, + UDI_ATTR_BOOLEAN, + UDI_ATTR_FILE +}; + + +#endif diff --git a/Modules/UDI/include/udi_cb.h b/Modules/UDI/include/udi_cb.h new file mode 100644 index 00000000..1f26a593 --- /dev/null +++ b/Modules/UDI/include/udi_cb.h @@ -0,0 +1,39 @@ +/** + * \file udi_cb.h + */ +#ifndef _UDI_CB_H_ +#define _UDI_CB_H_ + +typedef struct udi_cb_s udi_cb_t; + +/** + * \brief Describes a generic control block + * \note Semi-opaque + */ +struct udi_cb_s +{ + /** + * \brief Channel associated with the control block + */ + udi_channel_t channel; + /** + * \brief Current state + * \note Driver changable + */ + void *context; + /** + * \brief CB's scratch area + */ + void *scratch; + /** + * \brief ??? + */ + void *initiator_context; + /** + * \brief Request Handle? + */ + udi_origin_t origin; +}; + + +#endif diff --git a/Modules/UDI/include/udi_init.h b/Modules/UDI/include/udi_init.h index cfc9e3ff..fc69950f 100644 --- a/Modules/UDI/include/udi_init.h +++ b/Modules/UDI/include/udi_init.h @@ -17,6 +17,9 @@ typedef struct udi_limits_s udi_limits_t; typedef struct udi_chan_context_s udi_chan_context_t; typedef struct udi_child_chan_context_s udi_child_chan_context_t; +typedef void udi_op_t(void); +typedef udi_op_t * const udi_ops_vector_t; + /** * \brief UDI Initialisation Structure * @@ -239,15 +242,6 @@ struct udi_gcb_init_s // === // === -/** - * \brief - */ -struct udi_init_context_s -{ - udi_index_t region_idx; - udi_limits_t limits; -}; - /** * \brief Environement Imposed Limits */ @@ -283,6 +277,15 @@ struct udi_limits_s udi_ubit32_t min_timer_res; }; +/** + * \brief Primary Region Context data + */ +struct udi_init_context_s +{ + udi_index_t region_idx; + udi_limits_t limits; +}; + /** * \brief Channel context data */ diff --git a/Modules/UDI/include/udi_log.h b/Modules/UDI/include/udi_log.h new file mode 100644 index 00000000..7a01ed45 --- /dev/null +++ b/Modules/UDI/include/udi_log.h @@ -0,0 +1,34 @@ +/** + * \file udi_log.h + */ +#ifndef _UDI_LOG_H_ +#define _UDI_LOG_H_ + +// Required Files +#include "udi_cb.h" + +/** + * \brief Trace Event + */ +typedef udi_ubit32_t udi_trevent_t; + +/** + * \brief Log Callback + */ +typedef void udi_log_write_call_t(udi_cb_t *gcb, udi_status_t correlated_status); + +/** + * \name Log Severities + * \brief Values for severity + * \{ + */ +#define UDI_LOG_DISASTER 1 +#define UDI_LOG_ERROR 2 +#define UDI_LOG_WARNING 3 +#define UDI_LOG_INFORMATION 4 +/** + * \} + */ + + +#endif diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index c1423315..50057089 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -5,7 +5,7 @@ // === CONSTANTS === #define NULL ((void*)0) -#define NUM_TERMS 1 +#define NUM_TERMS 4 #define DEFAULT_TERMINAL "/Devices/VTerm/0" #define DEFAULT_SHELL "/Acess/SBin/login" -- 2.20.1