linux-sg2042/arch/xtensa/include/asm
Pavel Emelyanov a8fc927780 sk-filter: Add ability to get socket filter program (v2)
The SO_ATTACH_FILTER option is set only. I propose to add the get
ability by using SO_ATTACH_FILTER in getsockopt. To be less
irritating to eyes the SO_GET_FILTER alias to it is declared. This
ability is required by checkpoint-restore project to be able to
save full state of a socket.

There are two issues with getting filter back.

First, kernel modifies the sock_filter->code on filter load, thus in
order to return the filter element back to user we have to decode it
into user-visible constants. Fortunately the modification in question
is interconvertible.

Second, the BPF_S_ALU_DIV_K code modifies the command argument k to
speed up the run-time division by doing kernel_k = reciprocal(user_k).
Bad news is that different user_k may result in same kernel_k, so we
can't get the original user_k back. Good news is that we don't have
to do it. What we need to is calculate a user2_k so, that

  reciprocal(user2_k) == reciprocal(user_k) == kernel_k

i.e. if it's re-loaded back the compiled again value will be exactly
the same as it was. That said, the user2_k can be calculated like this

  user2_k = reciprocal(kernel_k)

with an exception, that if kernel_k == 0, then user2_k == 1.

The optlen argument is treated like this -- when zero, kernel returns
the amount of sock_fprog elements in filter, otherwise it should be
large enough for the sock_fprog array.

changes since v1:
* Declared SO_GET_FILTER in all arch headers
* Added decode of vlan-tag codes

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-11-01 11:17:15 -04:00
..
Kbuild Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-10-10 12:02:25 +09:00
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
asmmacro.h
atomic.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
auxvec.h
barrier.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
bitops.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
bitsperlong.h asm-generic: introduce asm/bitsperlong.h 2009-06-11 21:02:14 +02:00
bootparam.h
bug.h
bugs.h
byteorder.h byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
cache.h dma-mapping: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN 2010-08-11 08:59:21 -07:00
cacheasm.h
cacheflush.h xtensa: Fix FLUSH_DCACHE macro for some variants. 2010-05-01 22:55:21 -07:00
checksum.h xtensa: Fix checksum header file 2009-05-11 21:48:23 -07:00
cmpxchg.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
coprocessor.h xtensa: Add missing include in coprocessor.h 2010-05-03 01:06:43 -07:00
cputime.h
current.h
delay.h
device.h
div64.h
dma-mapping.h dma-mapping: remove dma_is_consistent API 2010-08-11 08:59:21 -07:00
dma.h Fix common misspellings 2011-03-31 11:26:23 -03:00
elf.h cross-arch: don't corrupt personality flags upon exec() 2012-10-06 03:04:47 +09:00
emergency-restart.h
errno.h
fb.h
fcntl.h
flat.h xtensa: add flat support 2009-04-02 23:41:29 -07:00
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
futex.h
gpio.h gpiolib/arches: Centralise bolierplate asm/gpio.h 2012-05-11 18:00:14 -06:00
hardirq.h xtensa: fix build fail on undefined ack_bad_irq 2012-04-26 18:35:32 -04:00
highmem.h
hw_irq.h
io.h xtensa: adopt generic io routines 2012-10-03 15:11:42 -07:00
ioctl.h
ioctls.h xtensa: fix TIOCGSERIAL and TIOCSSERIAL definitions 2012-10-03 15:13:03 -07:00
ipcbuf.h
irq.h xtensa: allow variant to initialize own irq chips 2009-06-22 02:36:59 -07:00
irq_regs.h
irqflags.h Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
kdebug.h
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
kvm_para.h kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
linkage.h
local.h
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
mman.h coredump: add VM_NODUMP, MADV_NODUMP, MADV_CLEAR_NODUMP 2012-03-23 16:58:42 -07:00
mmu.h xtensa: nommu support 2009-04-02 23:41:50 -07:00
mmu_context.h xtensa: nommu support 2009-04-02 23:41:50 -07:00
module.h Make most arch asm/module.h files use asm-generic/module.h 2012-09-28 14:31:03 +09:30
msgbuf.h
mutex.h
nommu.h xtensa: nommu support 2009-04-02 23:41:50 -07:00
nommu_context.h xtensa: nommu support 2009-04-02 23:41:50 -07:00
page.h xtensa/mm: remove WANT_PAGE_VIRTUAL 2011-05-25 08:39:02 -07:00
param.h
pci-bridge.h
pci.h PCI: Xtensa: convert pcibios_set_master() to a non-inlined function 2012-01-06 12:10:41 -08:00
percpu.h
pgalloc.h xtensa: Shuffle include statements to fix linker script 2010-05-02 01:05:13 -07:00
pgtable.h mm: remove pte_*map_nested() 2010-10-26 16:52:08 -07:00
platform.h xtensa: remove platform rtc hooks 2009-04-02 23:45:07 -07:00
poll.h
posix_types.h xtensa: Use generic posix_types.h 2012-02-14 12:01:30 -08:00
processor.h fork: move the real prepare_to_copy() users to arch_dup_task_struct() 2012-05-16 15:16:26 -07:00
ptrace.h ptrace: unify show_regs() prototype 2011-07-26 16:49:43 -07:00
regs.h xtensa: rename MISC SR definition to avoid name clashes 2012-10-03 15:12:43 -07:00
resource.h
rwsem.h rwsem: Move duplicate function prototypes to linux/rwsem.h 2011-01-27 12:30:39 +01:00
scatterlist.h remove needless ISA_DMA_THRESHOLD 2010-08-07 18:15:50 +02:00
sections.h
segment.h
sembuf.h
serial.h
setup.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h xtensa: xtensa_sigaction doesn't exist 2012-05-21 23:59:20 -04:00
smp.h
socket.h sk-filter: Add ability to get socket filter program (v2) 2012-11-01 11:17:15 -04:00
sockios.h
spinlock.h
stat.h
statfs.h
string.h xtensa: fix memscan() 2012-02-03 16:16:40 -08:00
swab.h headers_check fix: xtensa, swab.h 2009-02-01 11:01:30 +05:30
switch_to.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
syscall.h fixups for signal breakage 2012-06-04 17:47:34 -04:00
termbits.h tty: Add EXTPROC support for LINEMODE 2010-08-10 13:47:39 -07:00
termios.h
thread_info.h bury the rest of TIF_IRET 2012-10-01 09:58:13 -04:00
timex.h xtensa: fix wrong extern declaration renamed in code using it 2009-05-11 22:00:11 -07:00
tlb.h mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
tlbflush.h
topology.h
types.h consolidate umode_t declarations 2012-01-03 22:55:17 -05:00
uaccess.h Disintegrate asm/system.h for Xtensa 2012-03-28 18:30:03 +01:00
ucontext.h
unaligned.h
unistd.h xtensa: switch to generic rt_sigsuspend(2) 2012-05-21 23:58:06 -04:00
user.h
vga.h
xor.h