diff options
Diffstat (limited to 'net/irda/discovery.c')
-rw-r--r-- | net/irda/discovery.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/net/irda/discovery.c b/net/irda/discovery.c index 89fd2a2cbca6..789478bc3009 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: discovery.c | 3 | * Filename: discovery.c |
4 | * Version: 0.1 | 4 | * Version: 0.1 |
5 | * Description: Routines for handling discoveries at the IrLMP layer | 5 | * Description: Routines for handling discoveries at the IrLMP layer |
@@ -10,24 +10,24 @@ | |||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * Modified at: Fri May 28 3:11 CST 1999 | 11 | * Modified at: Fri May 28 3:11 CST 1999 |
12 | * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> | 12 | * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> |
13 | * | 13 | * |
14 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. | 14 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or | 16 | * This program is free software; you can redistribute it and/or |
17 | * modify it under the terms of the GNU General Public License as | 17 | * modify it under the terms of the GNU General Public License as |
18 | * published by the Free Software Foundation; either version 2 of | 18 | * published by the Free Software Foundation; either version 2 of |
19 | * the License, or (at your option) any later version. | 19 | * the License, or (at your option) any later version. |
20 | * | 20 | * |
21 | * This program is distributed in the hope that it will be useful, | 21 | * This program is distributed in the hope that it will be useful, |
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | * GNU General Public License for more details. | 24 | * GNU General Public License for more details. |
25 | * | 25 | * |
26 | * You should have received a copy of the GNU General Public License | 26 | * You should have received a copy of the GNU General Public License |
27 | * along with this program; if not, write to the Free Software | 27 | * along with this program; if not, write to the Free Software |
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | 28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
29 | * MA 02111-1307 USA | 29 | * MA 02111-1307 USA |
30 | * | 30 | * |
31 | ********************************************************************/ | 31 | ********************************************************************/ |
32 | 32 | ||
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
@@ -65,9 +65,9 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) | |||
65 | 65 | ||
66 | spin_lock_irqsave(&cachelog->hb_spinlock, flags); | 66 | spin_lock_irqsave(&cachelog->hb_spinlock, flags); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Remove all discoveries of devices that has previously been | 69 | * Remove all discoveries of devices that has previously been |
70 | * discovered on the same link with the same name (info), or the | 70 | * discovered on the same link with the same name (info), or the |
71 | * same daddr. We do this since some devices (mostly PDAs) change | 71 | * same daddr. We do this since some devices (mostly PDAs) change |
72 | * their device address between every discovery. | 72 | * their device address between every discovery. |
73 | */ | 73 | */ |
@@ -79,10 +79,10 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) | |||
79 | discovery = (discovery_t *) hashbin_get_next(cachelog); | 79 | discovery = (discovery_t *) hashbin_get_next(cachelog); |
80 | 80 | ||
81 | if ((node->data.saddr == new->data.saddr) && | 81 | if ((node->data.saddr == new->data.saddr) && |
82 | ((node->data.daddr == new->data.daddr) || | 82 | ((node->data.daddr == new->data.daddr) || |
83 | (strcmp(node->data.info, new->data.info) == 0))) | 83 | (strcmp(node->data.info, new->data.info) == 0))) |
84 | { | 84 | { |
85 | /* This discovery is a previous discovery | 85 | /* This discovery is a previous discovery |
86 | * from the same device, so just remove it | 86 | * from the same device, so just remove it |
87 | */ | 87 | */ |
88 | hashbin_remove_this(cachelog, (irda_queue_t *) node); | 88 | hashbin_remove_this(cachelog, (irda_queue_t *) node); |
@@ -134,7 +134,7 @@ void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log) | |||
134 | 134 | ||
135 | discovery = (discovery_t *) hashbin_remove_first(log); | 135 | discovery = (discovery_t *) hashbin_remove_first(log); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* Delete the now empty log */ | 138 | /* Delete the now empty log */ |
139 | hashbin_delete(log, (FREE_FUNC) kfree); | 139 | hashbin_delete(log, (FREE_FUNC) kfree); |
140 | } | 140 | } |
@@ -232,7 +232,7 @@ void irlmp_dump_discoveries(hashbin_t *log) | |||
232 | while (discovery != NULL) { | 232 | while (discovery != NULL) { |
233 | IRDA_DEBUG(0, "Discovery:\n"); | 233 | IRDA_DEBUG(0, "Discovery:\n"); |
234 | IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr); | 234 | IRDA_DEBUG(0, " daddr=%08x\n", discovery->data.daddr); |
235 | IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); | 235 | IRDA_DEBUG(0, " saddr=%08x\n", discovery->data.saddr); |
236 | IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info); | 236 | IRDA_DEBUG(0, " nickname=%s\n", discovery->data.info); |
237 | 237 | ||
238 | discovery = (discovery_t *) hashbin_get_next(log); | 238 | discovery = (discovery_t *) hashbin_get_next(log); |
@@ -321,26 +321,26 @@ static inline discovery_t *discovery_seq_idx(loff_t pos) | |||
321 | { | 321 | { |
322 | discovery_t *discovery; | 322 | discovery_t *discovery; |
323 | 323 | ||
324 | for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); | 324 | for (discovery = (discovery_t *) hashbin_get_first(irlmp->cachelog); |
325 | discovery != NULL; | 325 | discovery != NULL; |
326 | discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) { | 326 | discovery = (discovery_t *) hashbin_get_next(irlmp->cachelog)) { |
327 | if (pos-- == 0) | 327 | if (pos-- == 0) |
328 | break; | 328 | break; |
329 | } | 329 | } |
330 | 330 | ||
331 | return discovery; | 331 | return discovery; |
332 | } | 332 | } |
333 | 333 | ||
334 | static void *discovery_seq_start(struct seq_file *seq, loff_t *pos) | 334 | static void *discovery_seq_start(struct seq_file *seq, loff_t *pos) |
335 | { | 335 | { |
336 | spin_lock_irq(&irlmp->cachelog->hb_spinlock); | 336 | spin_lock_irq(&irlmp->cachelog->hb_spinlock); |
337 | return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; | 337 | return *pos ? discovery_seq_idx(*pos - 1) : SEQ_START_TOKEN; |
338 | } | 338 | } |
339 | 339 | ||
340 | static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 340 | static void *discovery_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
341 | { | 341 | { |
342 | ++*pos; | 342 | ++*pos; |
343 | return (v == SEQ_START_TOKEN) | 343 | return (v == SEQ_START_TOKEN) |
344 | ? (void *) hashbin_get_first(irlmp->cachelog) | 344 | ? (void *) hashbin_get_first(irlmp->cachelog) |
345 | : (void *) hashbin_get_next(irlmp->cachelog); | 345 | : (void *) hashbin_get_next(irlmp->cachelog); |
346 | } | 346 | } |
@@ -357,9 +357,9 @@ static int discovery_seq_show(struct seq_file *seq, void *v) | |||
357 | else { | 357 | else { |
358 | const discovery_t *discovery = v; | 358 | const discovery_t *discovery = v; |
359 | 359 | ||
360 | seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", | 360 | seq_printf(seq, "nickname: %s, hint: 0x%02x%02x", |
361 | discovery->data.info, | 361 | discovery->data.info, |
362 | discovery->data.hints[0], | 362 | discovery->data.hints[0], |
363 | discovery->data.hints[1]); | 363 | discovery->data.hints[1]); |
364 | #if 0 | 364 | #if 0 |
365 | if ( discovery->data.hints[0] & HINT_PNP) | 365 | if ( discovery->data.hints[0] & HINT_PNP) |
@@ -376,20 +376,20 @@ static int discovery_seq_show(struct seq_file *seq, void *v) | |||
376 | seq_puts(seq, "Fax "); | 376 | seq_puts(seq, "Fax "); |
377 | if ( discovery->data.hints[0] & HINT_LAN) | 377 | if ( discovery->data.hints[0] & HINT_LAN) |
378 | seq_puts(seq, "LAN Access "); | 378 | seq_puts(seq, "LAN Access "); |
379 | 379 | ||
380 | if ( discovery->data.hints[1] & HINT_TELEPHONY) | 380 | if ( discovery->data.hints[1] & HINT_TELEPHONY) |
381 | seq_puts(seq, "Telephony "); | 381 | seq_puts(seq, "Telephony "); |
382 | if ( discovery->data.hints[1] & HINT_FILE_SERVER) | 382 | if ( discovery->data.hints[1] & HINT_FILE_SERVER) |
383 | seq_puts(seq, "File Server "); | 383 | seq_puts(seq, "File Server "); |
384 | if ( discovery->data.hints[1] & HINT_COMM) | 384 | if ( discovery->data.hints[1] & HINT_COMM) |
385 | seq_puts(seq, "IrCOMM "); | 385 | seq_puts(seq, "IrCOMM "); |
386 | if ( discovery->data.hints[1] & HINT_OBEX) | 386 | if ( discovery->data.hints[1] & HINT_OBEX) |
387 | seq_puts(seq, "IrOBEX "); | 387 | seq_puts(seq, "IrOBEX "); |
388 | #endif | 388 | #endif |
389 | seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n", | 389 | seq_printf(seq,", saddr: 0x%08x, daddr: 0x%08x\n\n", |
390 | discovery->data.saddr, | 390 | discovery->data.saddr, |
391 | discovery->data.daddr); | 391 | discovery->data.daddr); |
392 | 392 | ||
393 | seq_putc(seq, '\n'); | 393 | seq_putc(seq, '\n'); |
394 | } | 394 | } |
395 | return 0; | 395 | return 0; |