/* * Unified UUID/GUID definition * * Copyright (C) 2009, 2016 Intel Corp. * Huang Ying <ying.huang@intel.com> * * 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; * * This program is distributed in the hope that it will be useful, * 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. */ #include <linux/kernel.h> #include <linux/ctype.h> #include <linux/errno.h> #include <linux/export.h> #include <linux/uuid.h> #include <linux/random.h> const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; EXPORT_SYMBOL(uuid_le_index); const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; EXPORT_SYMBOL(uuid_be_index); /*************************************************************** * Random UUID interface * * Used here for a Boot ID, but can be useful for other kernel * drivers. ***************************************************************/ /* * Generate random UUID */ void generate_random_uuid(unsigned char uuid[16]) { get_random_bytes(uuid, 16); /* Set UUID version to 4 --- truly random generation */ uuid[6] = (uuid[6] & 0x0F) | 0x40; /* Set the UUID variant to DCE */ uuid[8] = (uuid[8] & 0x3F) | 0x80; } EXPORT_SYMBOL(generate_random_uuid); static void __uuid_gen_common(__u8 b[16]) { prandom_bytes(b, 16); /* reversion 0b10 */ b[8] = (b[8] & 0x3F) | 0x80; } void uuid_le_gen(uuid_le *lu) { __uuid_gen_common(lu->b); /* version 4 : random generation */ lu->b[7] = (lu->b[7] & 0x0F) | 0x40; } EXPORT_SYMBOL_GPL(uuid_le_gen); void uuid_be_gen(uuid_be *bu) { __uuid_gen_common(bu->b); /* version 4 : random generation */ bu->b[6] = (bu->b[6] & 0x0F) | 0x40; } EXPORT_SYMBOL_GPL(uuid_be_gen); /** * uuid_is_valid - checks if UUID string valid * @uuid: UUID string to check * * Description: * It checks if the UUID string is following the format: * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx * where x is a hex digit. * * Return: true if input is valid UUID string. */ bool uuid_is_valid(const char *uuid) { unsigned int i; for (i = 0; i < UUID_STRING_LEN; i++) { if (i == 8 || i == 13 || i == 18 || i == 23) { if (uuid[i] != '-') return false; } else if (!isxdigit(uuid[i])) { return false; } } return true; } EXPORT_SYMBOL(uuid_is_valid); static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16]) { static const u8 si[16] = {0,2,4,6,9,11,14,16,19,21,24,26,28,30,32,34}; unsigned int i; if (!uuid_is_valid(uuid)) return -EINVAL; for (i = 0; i < 16; i++) { int hi = hex_to_bin(uuid[si[i] + 0]); int lo = hex_to_bin(uuid[si[i] + 1]); b[ei[i]] = (hi << 4) | lo; } return 0; } int uuid_le_to_bin(const char *uuid, uuid_le *u) { return __uuid_to_bin(uuid, u->b, uuid_le_index); } EXPORT_SYMBOL(uuid_le_to_bin); int uuid_be_to_bin(const char *uuid, uuid_be *u) { return __uuid_to_bin(uuid, u->b, uuid_be_index); } EXPORT_SYMBOL(uuid_be_to_bin); /div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/ui/hist.c?id=4f2bd6b35b345523ac99b14ce9a1f4a98f21ebdb&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr> ' value='nds-private-remove'/><input type='hidden' name='id' value='aaaec6fc755447a1d056765b11b24d8ff2b81366'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>Thomas Gleixner <tglx@linutronix.de></td><td class='right'>2017-01-31 19:03:21 +0100</td></tr> <tr><th>committer</th><td>Thomas Gleixner <tglx@linutronix.de></td><td class='right'>2017-01-31 20:22:18 +0100</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/fs/afs/Makefile?h=nds-private-remove&id=aaaec6fc755447a1d056765b11b24d8ff2b81366'>aaaec6fc755447a1d056765b11b24d8ff2b81366</a> (<a href='/cgit.cgi/linux/net-next.git/patch/fs/afs/Makefile?id=aaaec6fc755447a1d056765b11b24d8ff2b81366'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?h=nds-private-remove&id=aaaec6fc755447a1d056765b11b24d8ff2b81366'>a7f4167960ee1df86739905b6ccdeb95465bfe5f</a> /<a href='/cgit.cgi/linux/net-next.git/tree/fs/afs/Makefile?h=nds-private-remove&id=aaaec6fc755447a1d056765b11b24d8ff2b81366'>fs/afs/Makefile</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/fs/afs/Makefile?h=nds-private-remove&id=08d85f3ea99f1eeafc4e8507936190e86a16ee8c'>08d85f3ea99f1eeafc4e8507936190e86a16ee8c</a> (<a href='/cgit.cgi/linux/net-next.git/diff/fs/afs/Makefile?h=nds-private-remove&id=aaaec6fc755447a1d056765b11b24d8ff2b81366&id2=08d85f3ea99f1eeafc4e8507936190e86a16ee8c'>diff</a>)</td></tr></table> <div class='commit-subject'>x86/irq: Make irq activate operations symmetric</div><div class='commit-msg'>The recent commit which prevents double activation of interrupts unearthed interesting code in x86. The code (ab)uses irq_domain_activate_irq() to reconfigure an already activated interrupt. That trips over the prevention code now. Fix it by deactivating the interrupt before activating the new configuration. Fixes: 08d85f3ea99f1 "irqdomain: Avoid activating interrupts more than once" Reported-and-tested-by: Mike Galbraith <efault@gmx.de> Reported-and-tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311901580.3457@nanos </div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&id=aaaec6fc755447a1d056765b11b24d8ff2b81366'>Diffstat</a> (limited to 'fs/afs/Makefile')</div><table summary='diffstat' class='diffstat'>