diff options
Diffstat (limited to 'src/neigh_cache.c')
-rw-r--r-- | src/neigh_cache.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/src/neigh_cache.c b/src/neigh_cache.c index 3217f408..129e40b9 100644 --- a/src/neigh_cache.c +++ b/src/neigh_cache.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <string.h> @@ -73,7 +69,7 @@ static void neigh_cache_schedule_cleanup(struct neigh_cache *cache) } else { timespecsub(&threshold, &now, &result); } - osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec*1000); + osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec / 1000); } struct neigh_cache *neigh_cache_alloc(void *ctx, unsigned int keep_time_sec) @@ -93,6 +89,26 @@ void neigh_cache_set_keep_time_interval(struct neigh_cache *cache, unsigned int neigh_cache_schedule_cleanup(cache); } +static struct neigh_cache_entry *neigh_cache_lookup_entry(struct neigh_cache *cache, + const struct neigh_cache_entry_key *key) +{ + struct neigh_cache_entry *tmp; + llist_for_each_entry(tmp, &cache->list, list) { + if (neigh_cache_entry_key_eq(&tmp->key, key)) + return tmp; + } + return NULL; +} + +const struct osmo_cell_global_id_ps *neigh_cache_lookup_value(struct neigh_cache *cache, + const struct neigh_cache_entry_key *key) +{ + struct neigh_cache_entry *it = neigh_cache_lookup_entry(cache, key); + if (it) + return &it->value; + return NULL; +} + struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache, const struct neigh_cache_entry_key *key, const struct osmo_cell_global_id_ps *value) @@ -123,26 +139,6 @@ struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache, return it; } -struct neigh_cache_entry *neigh_cache_lookup_entry(struct neigh_cache *cache, - const struct neigh_cache_entry_key *key) -{ - struct neigh_cache_entry *tmp; - llist_for_each_entry(tmp, &cache->list, list) { - if (neigh_cache_entry_key_eq(&tmp->key, key)) - return tmp; - } - return NULL; -} - -const struct osmo_cell_global_id_ps *neigh_cache_lookup_value(struct neigh_cache *cache, - const struct neigh_cache_entry_key *key) -{ - struct neigh_cache_entry *it = neigh_cache_lookup_entry(cache, key); - if (it) - return &it->value; - return NULL; -} - void neigh_cache_free(struct neigh_cache *cache) { struct neigh_cache_entry *it, *tmp; @@ -207,7 +203,7 @@ static void si_cache_schedule_cleanup(struct si_cache *cache) } else { timespecsub(&threshold, &now, &result); } - osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec*1000); + osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec / 1000); } struct si_cache *si_cache_alloc(void *ctx, unsigned int keep_time_sec) |