/* CMTP implementation for Linux Bluetooth stack (BlueZ). Copyright (C) 2002-2003 Marcel Holtmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ #ifndef __CMTP_H #define __CMTP_H #include #include #define BTNAMSIZ 18 /* CMTP ioctl defines */ #define CMTPCONNADD _IOW('C', 200, int) #define CMTPCONNDEL _IOW('C', 201, int) #define CMTPGETCONNLIST _IOR('C', 210, int) #define CMTPGETCONNINFO _IOR('C', 211, int) #define CMTP_LOOPBACK 0 struct cmtp_connadd_req { int sock; /* Connected socket */ __u32 flags; }; struct cmtp_conndel_req { bdaddr_t bdaddr; __u32 flags; }; struct cmtp_conninfo { bdaddr_t bdaddr; __u32 flags; __u16 state; int num; }; struct cmtp_connlist_req { __u32 cnum; struct cmtp_conninfo __user *ci; }; int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock); int cmtp_del_connection(struct cmtp_conndel_req *req); int cmtp_get_connlist(struct cmtp_connlist_req *req); int cmtp_get_conninfo(struct cmtp_conninfo *ci); /* CMTP session defines */ #define CMTP_INTEROP_TIMEOUT (HZ * 5) #define CMTP_INITIAL_MSGNUM 0xff00 struct cmtp_session { struct list_head list; struct socket *sock; bdaddr_t bdaddr; unsigned long state; unsigned long flags; uint mtu; char name[BTNAMSIZ]; atomic_t terminate; struct task_struct *task; wait_queue_head_t wait; int ncontroller; int num; struct capi_ctr ctrl; struct list_head applications; unsigned long blockids; int msgnum; struct sk_buff_head transmit; struct sk_buff *reassembly[16]; }; struct cmtp_application { struct list_head list; unsigned long state; int err; __u16 appl; __u16 mapping; __u16 msgnum; }; struct cmtp_scb { int id; int data; }; int cmtp_attach_device(struct cmtp_session *session); void cmtp_detach_device(struct cmtp_session *session); void cmtp_recv_capimsg(struct cmtp_session *session, struct sk_buff *skb); /* CMTP init defines */ int cmtp_init_sockets(void); void cmtp_cleanup_sockets(void); #endif /* __CMTP_H */ sm-generic?id=64679e565a4a099c5d5dc2ecf103dcaf039ef8c7&showmsg=1'>asm-generic
AgeCommit message (Collapse)AuthorFilesLines
2017-02-03modversions: treat symbol CRCs as 32 bit quantitiesArd Biesheuvel1-5/+6
The modversion symbol CRCs are emitted as ELF symbols, which allows us to easily populate the kcrctab sections by relying on the linker to associate each kcrctab slot with the correct value. This has a couple of downsides: - Given that the CRCs are treated as memory addresses, we waste 4 bytes for each CRC on 64 bit architectures, - On architectures that support runtime relocation, a R_<arch>_RELATIVE relocation entry is emitted for each CRC value, which identifies it as a quantity that requires fixing up based on the actual runtime load offset of the kernel. This results in corrupted CRCs unless we explicitly undo the fixup (and this is currently being handled in the core module code) - Such runtime relocation entries take up 24 bytes of __init space each, resulting in a x8 overhead in [uncompressed] kernel size for CRCs. Switching to explicit 32 bit values on 64 bit architectures fixes most of these issues, given that 32 bit values are not treated as quantities that require fixing up based on the actual runtime load offset. Note that on some ELF64 architectures [such as PPC64], these 32-bit values are still emitted as [absolute] runtime relocatable quantities, even if the value resolves to a build time constant. Since relative relocations are always resolved at build time, this patch enables MODULE_REL_CRCS on powerpc when CONFIG_RELOCATABLE=y, which turns the absolute CRC references into relative references into .rodata where the actual CRC value is stored. So redefine all CRC fields and variables as u32, and redefine the __CRC_SYMBOL() macro for 64 bit builds to emit the CRC reference using inline assembler (which is necessary since 64-bit C code cannot use 32-bit types to hold memory addresses, even if they are ultimately resolved using values that do not exceed 0xffffffff). To avoid potential problems with legacy 32-bit architectures using legacy toolchains, the equivalent C definition of the kcrctab entry is retained for 32-bit architectures. Note that this mostly reverts commit d4703aefdbc8 ("module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y") Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>