/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include #include "proto.h" #include "protos.h" #include "pkt_buff.h" void empty(struct pkt_buff *pkt) {} static void _hex(uint8_t *ptr, size_t len) { if (!len) return; tprintf(" [ Hex "); for (; ptr && len-- > 0; ptr++) tprintf(" %.2x", *ptr); tprintf(" ]\n"); } void hex(struct pkt_buff *pkt) { size_t len = pkt_len(pkt); if (!len) return; _hex(pkt_pull(pkt, len), len); tprintf("\n"); } static void _ascii(uint8_t *ptr, size_t len) { if (!len) return; tprintf(" [ Chr "); for (; ptr && len-- > 0; ptr++) tprintf("%c", isprint(*ptr) ? *ptr : '.'); tprintf(" ]\n"); } void ascii(struct pkt_buff *pkt) { size_t len = pkt_len(pkt); if (!len) return; _ascii(pkt_pull(pkt, len), len); tprintf("\n"); } void hex_ascii(struct pkt_buff *pkt) { size_t len = pkt_len(pkt); uint8_t *ptr = pkt_pull(pkt, len); if (len) { _ascii(ptr, len); _hex(ptr, len); } tprintf("\n"); } static void none_less(struct pkt_buff *pkt) { tprintf("\n"); } struct protocol none_ops = { .key = 0x01, .print_full = hex_ascii, .print_less = none_less, }; cket-loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-07-25 10:43:13 +0200
committerTony Luck <tony.luck@intel.com>2016-07-25 09:55:32 -0700
commitfbb0e4da96f4503e65bc4fb627cf4e1d7c8c64e6 (patch)
tree7c17fa1f6f451a838974067ef63372818404c495 /Documentation
parent70f4f9352317ed8bc70cd7fe2bf34a3f9f7f21e3 (diff)
ia64: salinfo: use a waitqueue instead a sema down/up combo
The only purpose of down_try_lock() followed by up() seems to be to wake up a possible reader. This patch replaces it with a wake-queue. There is no locking around cpumask_empty() and the test is re-done in case there was no hit. With wait_event_interruptible_lock_irq(,&data_saved_lock) we would probably be able to get rid of the `retry` label. However we still can return CPU X which is valid now but later (after the lock dropped) the event may have been removed because the CPU went offline. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'Documentation')