Changeset 06295a9 in mainline
- Timestamp:
- 2012-02-06T12:43:31Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bc38578
- Parents:
- e2e56e67
- Location:
- uspace/srv/ethip
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ethip/Makefile
re2e56e67 r06295a9 31 31 32 32 SOURCES = \ 33 ethip.c 33 ethip.c \ 34 ethip_nic.c 34 35 35 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/ethip/ethip.c
re2e56e67 r06295a9 41 41 #include <loc.h> 42 42 #include <stdio.h> 43 #include <stdlib.h> 44 45 #include "ethip.h" 46 #include "ethip_nic.h" 43 47 44 48 #define NAME "eth" … … 58 62 }; 59 63 60 static iplink_srv_t test_srv;61 62 64 static int ethip_init(void) 63 65 { 64 66 int rc; 65 service_id_t sid;66 category_id_t iplink_cat;67 68 test_srv.ops = ðip_iplink_ops;69 test_srv.arg = NULL;70 67 71 68 async_set_client_connection(ethip_client_conn); … … 77 74 } 78 75 79 rc = loc_service_register("net/eth0", &sid); 76 rc = ethip_nic_discovery_start(); 77 if (rc != EOK) 78 return rc; 79 80 return EOK; 81 } 82 83 int ethip_iplink_init(ethip_nic_t *nic) 84 { 85 int rc; 86 service_id_t sid; 87 category_id_t iplink_cat; 88 static unsigned link_num = 0; 89 char *svc_name = NULL; 90 91 log_msg(LVL_DEBUG, "ethip_iplink_init()"); 92 93 nic->iplink.ops = ðip_iplink_ops; 94 nic->iplink.arg = nic; 95 96 rc = asprintf(&svc_name, "net/eth%u", ++link_num); 97 if (rc < 0) { 98 log_msg(LVL_ERROR, "Out of memory."); 99 goto error; 100 } 101 102 rc = loc_service_register(svc_name, &sid); 80 103 if (rc != EOK) { 81 log_msg(LVL_ERROR, "Failed registering service net/eth0.");82 return rc;104 log_msg(LVL_ERROR, "Failed registering service %s.", svc_name); 105 goto error; 83 106 } 84 107 … … 86 109 if (rc != EOK) { 87 110 log_msg(LVL_ERROR, "Failed resolving category 'iplink'."); 88 return rc;111 goto error; 89 112 } 90 113 91 114 rc = loc_service_add_to_cat(sid, iplink_cat); 92 115 if (rc != EOK) { 93 log_msg(LVL_ERROR, "Failed adding net/eth0 to category.");94 return rc;116 log_msg(LVL_ERROR, "Failed adding %s to category.", svc_name); 117 goto error; 95 118 } 96 119 97 120 return EOK; 121 122 error: 123 if (svc_name != NULL) 124 free(svc_name); 125 return rc; 98 126 } 99 127 100 128 static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 101 129 { 102 log_msg(LVL_DEBUG, "ethip_client_conn( )");103 i plink_conn(iid, icall, &test_srv);130 log_msg(LVL_DEBUG, "ethip_client_conn(%u)", (unsigned) IPC_GET_ARG1(*icall)); 131 if (0) iplink_conn(iid, icall, NULL); 104 132 } 105 133
Note:
See TracChangeset
for help on using the changeset viewer.