text
stringlengths
4
6.14k
/* * Copyright (C) 2010, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ConvolverNode_h #define ConvolverNode_h #include "AudioNode.h" #include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> namespace WebCore { class AudioBuffer; class Reverb; class ConvolverNode : public AudioNode { public: static PassRefPtr<ConvolverNode> create(AudioContext* context, double sampleRate) { return adoptRef(new ConvolverNode(context, sampleRate)); } virtual ~ConvolverNode(); // AudioNode virtual void process(size_t framesToProcess); virtual void reset(); virtual void initialize(); virtual void uninitialize(); // Impulse responses void setBuffer(AudioBuffer*); AudioBuffer* buffer(); private: ConvolverNode(AudioContext*, double sampleRate); OwnPtr<Reverb> m_reverb; RefPtr<AudioBuffer> m_buffer; // This synchronizes dynamic changes to the convolution impulse response with process(). mutable Mutex m_processLock; }; } // namespace WebCore #endif // ConvolverNode_h
/* * Driver for Digigram VXpocket soundcards * * VX-pocket mixer * * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <sound/driver.h> #include <sound/core.h> #include <sound/control.h> #include <sound/tlv.h> #include "vxpocket.h" #define MIC_LEVEL_MIN 0 #define MIC_LEVEL_MAX 8 /* * mic level control (for VXPocket) */ static int vx_mic_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = MIC_LEVEL_MAX; return 0; } static int vx_mic_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; ucontrol->value.integer.value[0] = chip->mic_level; return 0; } static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; mutex_lock(&_chip->mixer_mutex); if (chip->mic_level != ucontrol->value.integer.value[0]) { vx_set_mic_level(_chip, ucontrol->value.integer.value[0]); chip->mic_level = ucontrol->value.integer.value[0]; mutex_unlock(&_chip->mixer_mutex); return 1; } mutex_unlock(&_chip->mixer_mutex); return 0; } static const DECLARE_TLV_DB_SCALE(db_scale_mic, -21, 3, 0); static struct snd_kcontrol_new vx_control_mic_level = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ), .name = "Mic Capture Volume", .info = vx_mic_level_info, .get = vx_mic_level_get, .put = vx_mic_level_put, .tlv = { .p = db_scale_mic }, }; /* * mic boost level control (for VXP440) */ static int vx_mic_boost_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; return 0; } static int vx_mic_boost_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; ucontrol->value.integer.value[0] = chip->mic_level; return 0; } static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; mutex_lock(&_chip->mixer_mutex); if (chip->mic_level != ucontrol->value.integer.value[0]) { vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]); chip->mic_level = ucontrol->value.integer.value[0]; mutex_unlock(&_chip->mixer_mutex); return 1; } mutex_unlock(&_chip->mixer_mutex); return 0; } static struct snd_kcontrol_new vx_control_mic_boost = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Boost", .info = vx_mic_boost_info, .get = vx_mic_boost_get, .put = vx_mic_boost_put, }; int vxp_add_mic_controls(struct vx_core *_chip) { struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; int err; /* mute input levels */ chip->mic_level = 0; switch (_chip->type) { case VX_TYPE_VXPOCKET: vx_set_mic_level(_chip, 0); break; case VX_TYPE_VXP440: vx_set_mic_boost(_chip, 0); break; } /* mic level */ switch (_chip->type) { case VX_TYPE_VXPOCKET: if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_level, chip))) < 0) return err; break; case VX_TYPE_VXP440: if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_boost, chip))) < 0) return err; break; } return 0; }
/*************************************************************************/ /*! @File @Title System Description Header @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @Description This header provides system-specific declarations and macros @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #if !defined(__SYSINFO_H__) #define __SYSINFO_H__ #define SYS_RGX_DEV_VENDOR_ID (0x1010) #define SYS_RGX_DEV_DEVICE_ID (0x1CF2) /*!< System specific poll/timeout details */ #define MAX_HW_TIME_US (500000) #define DEVICES_WATCHDOG_POWER_ON_SLEEP_TIMEOUT (10000) #define DEVICES_WATCHDOG_POWER_OFF_SLEEP_TIMEOUT (3600000) #define WAIT_TRY_COUNT (10000) /* RGX, DISPLAY (external), BUFFER (external) */ #define SYS_DEVICE_COUNT (3) /* This should be one higher than the highest possible physical heap ID */ #define SYS_PHYS_HEAP_COUNT 2 #if defined(__linux__) #define SYS_RGX_DEV_NAME "apollo_rogue" #endif /* defined(__linux__) */ #define SYS_RGX_LMA_RESERVED_SIZE (32*1024*1024) #endif /* !defined(__SYSINFO_H__) */
/* { dg-require-effective-target vect_int } */ #include <stdarg.h> #include "tree-vect.h" #define N 16 __attribute__ ((noinline)) int main1 () { int arr1[N]; int k = 0; int m = 3, i = 0; /* Vectorization of induction that is used after the loop. Currently vectorizable because scev_ccp disconnects the use-after-the-loop from the iv def inside the loop. */ do { k = k + 2; arr1[i] = k; m = m + k; i++; } while (i < N); /* check results: */ for (i = 0; i < N; i++) { if (arr1[i] != 2+2*i) abort (); } return m + k; } int main (void) { int res; check_vect (); res = main1 (); if (res != 32 + 275) abort (); return 0; } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
#include <linux/types.h> #include <net/net_namespace.h> #include <linux/netfilter/nf_conntrack_common.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_conntrack_extend.h> #include <uapi/linux/netfilter/xt_connlabel.h> #define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE) struct nf_conn_labels { unsigned long bits[NF_CT_LABELS_MAX_SIZE / sizeof(long)]; }; static inline struct nf_conn_labels *nf_ct_labels_find(const struct nf_conn *ct) { #ifdef CONFIG_NF_CONNTRACK_LABELS return nf_ct_ext_find(ct, NF_CT_EXT_LABELS); #else return NULL; #endif } static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct) { #ifdef CONFIG_NF_CONNTRACK_LABELS struct net *net = nf_ct_net(ct); if (net->ct.labels_used == 0) return NULL; return nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS, sizeof(struct nf_conn_labels), GFP_ATOMIC); #else return NULL; #endif } int nf_connlabels_replace(struct nf_conn *ct, const u32 *data, const u32 *mask, unsigned int words); #ifdef CONFIG_NF_CONNTRACK_LABELS int nf_conntrack_labels_init(void); void nf_conntrack_labels_fini(void); int nf_connlabels_get(struct net *net, unsigned int bit); void nf_connlabels_put(struct net *net); #else static inline int nf_conntrack_labels_init(void) { return 0; } static inline void nf_conntrack_labels_fini(void) {} static inline int nf_connlabels_get(struct net *net, unsigned int bit) { return 0; } static inline void nf_connlabels_put(struct net *net) {} #endif
/* Copyright (C) 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. 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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Character set configuration (hard-coded) */ #define HAVE_CHARSET_armscii8 1 #define HAVE_CHARSET_ascii 1 #define HAVE_CHARSET_big5 1 #define HAVE_CHARSET_cp1250 1 #define HAVE_CHARSET_cp1251 1 #define HAVE_CHARSET_cp1256 1 #define HAVE_CHARSET_cp1257 1 #define HAVE_CHARSET_cp850 1 #define HAVE_CHARSET_cp852 1 #define HAVE_CHARSET_cp866 1 #define HAVE_CHARSET_cp932 1 #define HAVE_CHARSET_dec8 1 #define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gbk 1 #define HAVE_CHARSET_greek 1 #define HAVE_CHARSET_hebrew 1 #define HAVE_CHARSET_hp8 1 #define HAVE_CHARSET_keybcs2 1 #define HAVE_CHARSET_koi8r 1 #define HAVE_CHARSET_koi8u 1 #define HAVE_CHARSET_latin1 1 #define HAVE_CHARSET_latin2 1 #define HAVE_CHARSET_latin5 1 #define HAVE_CHARSET_latin7 1 #define HAVE_CHARSET_macce 1 #define HAVE_CHARSET_macroman 1 #define HAVE_CHARSET_sjis 1 #define HAVE_CHARSET_swe7 1 #define HAVE_CHARSET_tis620 1 #define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf16 1 #define HAVE_CHARSET_utf32 1 #define HAVE_CHARSET_utf8mb3 1 #define HAVE_CHARSET_utf8mb4 1 #define HAVE_UCA_COLLATIONS 1 #define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" #define USE_MB 1
// RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s // Check for C99 6.10.3.4p2. #define f(a) f(x * (a)) #define x 2 #define z z[0] f(f(z)); // CHECK: f(2 * (f(2 * (z[0])))); #define A A B C #define B B C A #define C C A B A // CHECK: A B C A B A C A B C A // PR1820 #define i(x) h(x #define h(x) x(void) extern int i(i)); // CHECK: int i(void) #define M_0(x) M_ ## x #define M_1(x) x + M_0(0) #define M_2(x) x + M_1(1) #define M_3(x) x + M_2(2) #define M_4(x) x + M_3(3) #define M_5(x) x + M_4(4) a: M_0(1)(2)(3)(4)(5); b: M_0(5)(4)(3)(2)(1); // CHECK: a: 2 + M_0(3)(4)(5); // CHECK: b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1); #define n(v) v #define l m #define m l a c: n(m) X // CHECK: c: m a X
/* * Copyright (C) 1999 WIDE Project. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef HAVE_PORTABLE_PROTOTYPE #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #else #define __P(protos) () /* traditional C preprocessor */ #endif #endif /* !HAVE_PORTABLE_PROTOTYPE */
#ifndef ___ASM_SPARC_MC146818RTC_H #define ___ASM_SPARC_MC146818RTC_H #if defined(__sparc__) && defined(__arch64__) #include <asm/mc146818rtc_64.h> #else #include <asm/mc146818rtc_32.h> #endif #endif
/******************************************************************************* * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of Maxim Integrated * Products, Inc. shall not be used except as stated in the Maxim Integrated * Products, Inc. Branding Policy. * * The mere transfer of this software does not imply any licenses * of trade secrets, proprietary technology, copyrights, patents, * trademarks, maskwork rights, or any other form of intellectual * property whatsoever. Maxim Integrated Products, Inc. retains all * ownership rights. * * $Date: 2016-04-27 09:05:41 -0500 (Wed, 27 Apr 2016) $ * $Revision: 22529 $ * ******************************************************************************/ #include <stddef.h> #include "mxc_config.h" #include "ioman.h" /******************************************************************************/ int IOMAN_Config(const ioman_cfg_t *cfg) { if(cfg == NULL) { return E_NULL_PTR; } if ((cfg->req_reg == &MXC_IOMAN->i2cm0_req) || (cfg->req_reg == &MXC_IOMAN->i2cm1_req)) { /* Request pin mapping */ *cfg->req_reg = cfg->req_val.value; /* Check for acknowledgment */ /* Mask the I2CM SCL push/pull bit because it does not have an ack bit*/ if (*cfg->ack_reg != (cfg->req_val.value & ~(MXC_F_IOMAN_I2CM0_REQ_SCL_PUSH_PULL))) { return E_BUSY; } } else { if (*cfg->ack_reg != cfg->req_val.value) { /* Request pin mapping */ *cfg->req_reg = cfg->req_val.value; /* Check for acknowledgment */ if (*cfg->ack_reg != cfg->req_val.value) { return E_BUSY; } } } return E_NO_ERROR; }
/* * NET4: Sysctl interface to net af_unix subsystem. * * Authors: Mike Shaver. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/mm.h> #include <linux/sysctl.h> #include <net/af_unix.h> static ctl_table unix_table[] = { { .ctl_name = NET_UNIX_MAX_DGRAM_QLEN, .procname = "max_dgram_qlen", .data = &sysctl_unix_max_dgram_qlen, .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dointvec }, { .ctl_name = 0 } }; static ctl_table unix_net_table[] = { { .ctl_name = NET_UNIX, .procname = "unix", .mode = 0555, .child = unix_table }, { .ctl_name = 0 } }; static ctl_table unix_root_table[] = { { .ctl_name = CTL_NET, .procname = "net", .mode = 0555, .child = unix_net_table }, { .ctl_name = 0 } }; static struct ctl_table_header * unix_sysctl_header; void unix_sysctl_register(void) { unix_sysctl_header = register_sysctl_table(unix_root_table); } void unix_sysctl_unregister(void) { unregister_sysctl_table(unix_sysctl_header); }
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ #define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ #include "base/bind.h" #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/bluetooth_profile_service_provider.h" #include "dbus/file_descriptor.h" #include "dbus/object_path.h" namespace chromeos { // FakeBluetoothProfileServiceProvider simulates the behavior of a local // Bluetooth agent object and is used both in test cases in place of a // mock and on the Linux desktop. class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider : public BluetoothProfileServiceProvider { public: FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path, Delegate *delegate); virtual ~FakeBluetoothProfileServiceProvider(); // Each of these calls the equivalent // BluetoothProfileServiceProvider::Delegate method on the object passed on // construction. virtual void Release(); virtual void NewConnection( const dbus::ObjectPath& device_path, scoped_ptr<dbus::FileDescriptor> fd, const Delegate::Options& options, const Delegate::ConfirmationCallback& callback); virtual void RequestDisconnection( const dbus::ObjectPath& device_path, const Delegate::ConfirmationCallback& callback); virtual void Cancel(); private: friend class FakeBluetoothProfileManagerClient; // D-Bus object path we are faking. dbus::ObjectPath object_path_; // All incoming method calls are passed on to the Delegate and a callback // passed to generate the reply. |delegate_| is generally the object that // owns this one, and must outlive it. Delegate* delegate_; }; } // namespace chromeos #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
/* linux/arch/arm/mach-exynos/include/mach/gpio-midas.h * * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. * http://www.samsung.com * * EXYNOS4 - MIDAS GPIO lib * * 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. */ #ifndef __ASM_ARCH_GPIO_MIDAS_H #define __ASM_ARCH_GPIO_MIDAS_H __FILE__ /* MACH_MIDAS_01_BD nor MACH_MIDAS_01_BD nomore exists but SLP use GPIO_MIDAS_01_BD, GPIO_MIDAS_02_BD */ #if defined(CONFIG_GPIO_MIDAS_01_BD) #include "gpio-rev01-midas.h" #elif defined(CONFIG_GPIO_MIDAS_02_BD) #include "gpio-rev02-midas.h" #elif defined(CONFIG_MACH_IRON) #include "gpio-iron.h" #elif defined(CONFIG_MACH_GRANDE) #include "gpio-rev00-m0grandectc.h" #elif defined(CONFIG_MACH_M0_CTC) #include "gpio-rev00-m0ctc.h" #elif defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_SLP_PQ) #include "gpio-rev00-m0.h" #elif defined(CONFIG_MACH_C1) && !defined(CONFIG_TARGET_LOCALE_KOR) #include "gpio-rev00-c1.h" #elif defined(CONFIG_MACH_C1) && defined(CONFIG_TARGET_LOCALE_KOR) #include "gpio-rev03-c1kor.h" #elif defined(CONFIG_MACH_SLP_PQ_LTE) && !defined(CONFIG_TARGET_LOCALE_KOR) #include "gpio-rev00-c1vzw.h" #elif defined(CONFIG_MACH_M3) #include "gpio-rev00-m3.h" #elif defined(CONFIG_GPIO_NAPLES_00_BD) #include "gpio-rev00-naples.h" #elif defined(CONFIG_MACH_P4NOTE) #include "gpio-rev00-p4notepq.h" #elif defined(CONFIG_MACH_KONA) && defined(CONFIG_KONA_00_BD) #include "gpio-rev00-kona.h" #elif defined(CONFIG_MACH_KONA) && defined(CONFIG_KONA_01_BD) #include "gpio-rev01-kona.h" #elif defined(CONFIG_MACH_SF2) #include "gpio-rev00-sf2.h" #elif defined(CONFIG_MACH_GC1) #include "gpio-rev00-gc1.h" #elif defined(CONFIG_MACH_T0_CHN_CTC) #include "gpio-rev00-t0ctc.h" #elif defined(CONFIG_MACH_T0_CHN_CU_DUOS) || \ defined(CONFIG_MACH_T0_CHN_OPEN_DUOS) #include "gpio-rev00-t0cu-duos.h" #elif defined(CONFIG_MACH_T0) || defined(CONFIG_MACH_SLP_T0_LTE) #include "gpio-rev00-t0.h" #elif defined(CONFIG_MACH_BAFFIN) #include "gpio-rev00-baffin.h" #elif defined(CONFIG_MACH_TAB3) #include "gpio-rev00-tab3.h" #elif defined(CONFIG_MACH_HD) #include "gpio-rev00-hd.h" #elif defined(CONFIG_MACH_GD2) #include "gpio-rev01-gd2.h" #elif defined(CONFIG_MACH_ZEST) #include "gpio-rev00-zest.h" #elif defined(CONFIG_MACH_SP7160LTE) #include "gpio-rev00-sp7160lte.h" #elif defined(CONFIG_MACH_IPCAM) #include "gpio-rev00-ipcam.h" #elif defined(CONFIG_MACH_GC2PD) #include "gpio-rev00-gc2pd.h" #elif defined(CONFIG_MACH_WATCH) && defined(CONFIG_WATCH_00_BD) #include "gpio-rev00-watch.h" #elif defined(CONFIG_MACH_WATCH) #include "gpio-rev01-watch.h" #endif #endif /* __ASM_ARCH_GPIO_MIDAS_H */
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Author: kenton@google.com (Kenton Varda) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ #include <map> #include <string> #include <google/protobuf/compiler/cpp/cpp_field.h> namespace google { namespace protobuf { namespace compiler { namespace cpp { class PrimitiveFieldGenerator : public FieldGenerator { public: explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor, const Options& options); ~PrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateSerializeWithCachedSizes(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; protected: const FieldDescriptor* descriptor_; map<string, string> variables_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); }; class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { public: explicit PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, const Options& options); ~PrimitiveOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateMergeFromCodedStream(io::Printer* printer) const; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); }; class RepeatedPrimitiveFieldGenerator : public FieldGenerator { public: explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, const Options& options); ~RepeatedPrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const; void GenerateAccessorDeclarations(io::Printer* printer) const; void GenerateInlineAccessorDefinitions(io::Printer* printer) const; void GenerateClearingCode(io::Printer* printer) const; void GenerateMergingCode(io::Printer* printer) const; void GenerateSwappingCode(io::Printer* printer) const; void GenerateConstructorCode(io::Printer* printer) const; void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; void GenerateSerializeWithCachedSizes(io::Printer* printer) const; void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; void GenerateByteSize(io::Printer* printer) const; private: const FieldDescriptor* descriptor_; map<string, string> variables_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); }; } // namespace cpp } // namespace compiler } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_FCNTL_H #define _UAPI_LINUX_FCNTL_H #include <asm/fcntl.h> #include <linux/openat2.h> #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) /* * Cancel a blocking posix lock; internal use only until we expose an * asynchronous lock api to userspace: */ #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5) /* Create a file descriptor with FD_CLOEXEC set. */ #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) /* * Request nofications on a directory. * See below for events that may be notified. */ #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) /* * Set and get of pipe page size array */ #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) /* * Set/Get seals */ #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) /* * Types of seals */ #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ #define F_SEAL_GROW 0x0004 /* prevent file from growing */ #define F_SEAL_WRITE 0x0008 /* prevent writes */ #define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */ /* (1U << 31) is reserved for signed error codes */ /* * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on * the specific file. */ #define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) /* * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be * used to clear any hints previously set. */ #define RWH_WRITE_LIFE_NOT_SET 0 #define RWH_WRITE_LIFE_NONE 1 #define RWH_WRITE_LIFE_SHORT 2 #define RWH_WRITE_LIFE_MEDIUM 3 #define RWH_WRITE_LIFE_LONG 4 #define RWH_WRITE_LIFE_EXTREME 5 /* * The originally introduced spelling is remained from the first * versions of the patch set that introduced the feature, see commit * v4.13-rc1~212^2~51. */ #define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET /* * Types of directory notifications that may be requested. */ #define DN_ACCESS 0x00000001 /* File accessed */ #define DN_MODIFY 0x00000002 /* File modified */ #define DN_CREATE 0x00000004 /* File created */ #define DN_DELETE 0x00000008 /* File removed */ #define DN_RENAME 0x00000010 /* File renamed */ #define DN_ATTRIB 0x00000020 /* File changed attibutes */ #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ #define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */ #define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ #define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ #define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ #endif /* _UAPI_LINUX_FCNTL_H */
// @(#)root/quadp:$Id$ // Author: Eddy Offermann May 2004 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ /************************************************************************* * Parts of this file are copied from the OOQP distribution and * * are subject to the following license: * * * * COPYRIGHT 2001 UNIVERSITY OF CHICAGO * * * * The copyright holder hereby grants you royalty-free rights to use, * * reproduce, prepare derivative works, and to redistribute this software* * to others, provided that any changes are clearly documented. This * * software was authored by: * * * * E. MICHAEL GERTZ gertz@mcs.anl.gov * * Mathematics and Computer Science Division * * Argonne National Laboratory * * 9700 S. Cass Avenue * * Argonne, IL 60439-4844 * * * * STEPHEN J. WRIGHT swright@cs.wisc.edu * * Computer Sciences Department * * University of Wisconsin * * 1210 West Dayton Street * * Madison, WI 53706 FAX: (608)262-9777 * * * * Any questions or comments may be directed to one of the authors. * * * * ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES OF * * ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT, AND * * OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A CONTRACT * * WITH THE DEPARTMENT OF ENERGY. * *************************************************************************/ #ifndef ROOT_TMehrotraSolver #define ROOT_TMehrotraSolver #include "TQpSolverBase.h" /////////////////////////////////////////////////////////////////////////// // // // Derived class of TQpSolverBase implementing the original Mehrotra // // predictor-corrector algorithm // // // /////////////////////////////////////////////////////////////////////////// class TMehrotraSolver : public TQpSolverBase { protected: Int_t fPrintlevel; // parameter in range [0,100] determines verbosity. (Higher value // => more verbose.) Double_t fTsig; // exponent in Mehrotra's centering parameter, which is usually // chosen to me (muaff/mu)^tsig, where muaff is the predicted // complementarity gap obtained from an affine-scaling step, while // mu is the current complementarity gap TQpVar *fStep; // storage for step vectors TQpProbBase *fFactory; public: TMehrotraSolver(); TMehrotraSolver(TQpProbBase *of,TQpDataBase *prob,Int_t verbose=0); TMehrotraSolver(const TMehrotraSolver &another); virtual ~TMehrotraSolver(); virtual Int_t Solve (TQpDataBase *prob,TQpVar *iterate,TQpResidual *resid); virtual void DefMonitor (TQpDataBase *data,TQpVar *vars,TQpResidual *resids, Double_t alpha,Double_t sigma,Int_t i,Double_t mu, Int_t status_code,Int_t level); TMehrotraSolver &operator=(const TMehrotraSolver &source); ClassDef(TMehrotraSolver,1) // Mehrotra Qp Solver class }; #endif
/* { dg-do run } */ /* { dg-options "-O2 -mavx512bw -mavx512vl" } */ /* { dg-require-effective-target avx512vl } */ /* { dg-require-effective-target avx512bw } */ #define AVX512VL #define AVX512F_LEN 256 #define AVX512F_LEN_HALF 128 #include "avx512bw-vpminsb-2.c" #undef AVX512F_LEN #undef AVX512F_LEN_HALF #define AVX512F_LEN 128 #define AVX512F_LEN_HALF 128 #include "avx512bw-vpminsb-2.c"
/* Test AAPCS layout (VFP variant) */ /* { dg-do run { target arm_eabi } } */ /* { dg-require-effective-target arm_hard_vfp_ok } */ /* { dg-require-effective-target arm32 } */ /* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */ #ifndef IN_FRAMEWORK #define VFP #define TESTFILE "vfp7.c" __complex__ x = 1.0+2.0i; struct y { int p; int q; int r; int s; } v = { 1, 2, 3, 4 }; struct z { double x[4]; }; struct z a = { 5.0, 6.0, 7.0, 8.0 }; struct z b = { 9.0, 10.0, 11.0, 12.0 }; #include "abitest.h" #else ARG(struct z, a, D0) ARG(struct z, b, D4) ARG(double, 0.5, STACK) ARG(int, 7, R0) LAST_ARG(struct y, v, STACK+8) #endif
/* * Copyright (c) 2015 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef VPX_PORTS_VPX_ONCE_H_ #define VPX_PORTS_VPX_ONCE_H_ #include "vpx_config.h" /* Implement a function wrapper to guarantee initialization * thread-safety for library singletons. * * NOTE: These functions use static locks, and can only be * used with one common argument per compilation unit. So * * file1.c: * vpx_once(foo); * ... * vpx_once(foo); * * file2.c: * vpx_once(bar); * * will ensure foo() and bar() are each called only once, but in * * file1.c: * vpx_once(foo); * vpx_once(bar): * * bar() will never be called because the lock is used up * by the call to foo(). */ #if CONFIG_MULTITHREAD && defined(_WIN32) #include <windows.h> #include <stdlib.h> /* Declare a per-compilation-unit state variable to track the progress * of calling func() only once. This must be at global scope because * local initializers are not thread-safe in MSVC prior to Visual * Studio 2015. * * As a static, once_state will be zero-initialized as program start. */ static LONG once_state; static void once(void (*func)(void)) { /* Try to advance once_state from its initial value of 0 to 1. * Only one thread can succeed in doing so. */ if (InterlockedCompareExchange(&once_state, 1, 0) == 0) { /* We're the winning thread, having set once_state to 1. * Call our function. */ func(); /* Now advance once_state to 2, unblocking any other threads. */ InterlockedIncrement(&once_state); return; } /* We weren't the winning thread, but we want to block on * the state variable so we don't return before func() * has finished executing elsewhere. * * Try to advance once_state from 2 to 2, which is only possible * after the winning thead advances it from 1 to 2. */ while (InterlockedCompareExchange(&once_state, 2, 2) != 2) { /* State isn't yet 2. Try again. * * We are used for singleton initialization functions, * which should complete quickly. Contention will likewise * be rare, so it's worthwhile to use a simple but cpu- * intensive busy-wait instead of successive backoff, * waiting on a kernel object, or another heavier-weight scheme. * * We can at least yield our timeslice. */ Sleep(0); } /* We've seen once_state advance to 2, so we know func() * has been called. And we've left once_state as we found it, * so other threads will have the same experience. * * It's safe to return now. */ return; } #elif CONFIG_MULTITHREAD && defined(__OS2__) #define INCL_DOS #include <os2.h> static void once(void (*func)(void)) { static int done; /* If the initialization is complete, return early. */ if(done) return; /* Causes all other threads in the process to block themselves * and give up their time slice. */ DosEnterCritSec(); if (!done) { func(); done = 1; } /* Restores normal thread dispatching for the current process. */ DosExitCritSec(); } #elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H #include <pthread.h> static void once(void (*func)(void)) { static pthread_once_t lock = PTHREAD_ONCE_INIT; pthread_once(&lock, func); } #else /* No-op version that performs no synchronization. *_rtcd() is idempotent, * so as long as your platform provides atomic loads/stores of pointers * no synchronization is strictly necessary. */ static void once(void (*func)(void)) { static int done; if(!done) { func(); done = 1; } } #endif #endif // VPX_PORTS_VPX_ONCE_H_
/* * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. */ /* * 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. */ #ifndef __MACH_MXS_COMMON_H__ #define __MACH_MXS_COMMON_H__ struct clk; extern const u32 *mxs_get_ocotp(void); extern int mxs_reset_block(void __iomem *); extern void mxs_timer_init(struct clk *, int); extern void mxs_restart(char, const char *); extern int mxs_saif_clkmux_select(unsigned int clkmux); extern int mx23_register_gpios(void); extern int mx23_clocks_init(void); extern void mx23_map_io(void); extern void mx23_init_irq(void); extern int mx28_register_gpios(void); extern int mx28_clocks_init(void); extern void mx28_map_io(void); extern void mx28_init_irq(void); extern void icoll_init_irq(void); #endif /* __MACH_MXS_COMMON_H__ */
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2018 Intel Corporation * Copyright 2018 Google LLC. * * Author: Tomasz Figa <tfiga@chromium.org> * Author: Yong Zhi <yong.zhi@intel.com> */ #include <linux/vmalloc.h> #include "ipu3.h" #include "ipu3-css-pool.h" #include "ipu3-mmu.h" #include "ipu3-dmamap.h" /* * Free a buffer allocated by imgu_dmamap_alloc_buffer() */ static void imgu_dmamap_free_buffer(struct page **pages, size_t size) { int count = size >> PAGE_SHIFT; while (count--) __free_page(pages[count]); kvfree(pages); } /* * Based on the implementation of __iommu_dma_alloc_pages() * defined in drivers/iommu/dma-iommu.c */ static struct page **imgu_dmamap_alloc_buffer(size_t size, gfp_t gfp) { struct page **pages; unsigned int i = 0, count = size >> PAGE_SHIFT; unsigned int order_mask = 1; const gfp_t high_order_gfp = __GFP_NOWARN | __GFP_NORETRY; /* Allocate mem for array of page ptrs */ pages = kvmalloc_array(count, sizeof(*pages), GFP_KERNEL); if (!pages) return NULL; gfp |= __GFP_HIGHMEM | __GFP_ZERO; while (count) { struct page *page = NULL; unsigned int order_size; for (order_mask &= (2U << __fls(count)) - 1; order_mask; order_mask &= ~order_size) { unsigned int order = __fls(order_mask); order_size = 1U << order; page = alloc_pages((order_mask - order_size) ? gfp | high_order_gfp : gfp, order); if (!page) continue; if (!order) break; if (!PageCompound(page)) { split_page(page, order); break; } __free_pages(page, order); } if (!page) { imgu_dmamap_free_buffer(pages, i << PAGE_SHIFT); return NULL; } count -= order_size; while (order_size--) pages[i++] = page++; } return pages; } /** * imgu_dmamap_alloc - allocate and map a buffer into KVA * @imgu: struct device pointer * @map: struct to store mapping variables * @len: size required * * Returns: * KVA on success * %NULL on failure */ void *imgu_dmamap_alloc(struct imgu_device *imgu, struct imgu_css_map *map, size_t len) { unsigned long shift = iova_shift(&imgu->iova_domain); struct device *dev = &imgu->pci_dev->dev; size_t size = PAGE_ALIGN(len); struct page **pages; dma_addr_t iovaddr; struct iova *iova; int i, rval; dev_dbg(dev, "%s: allocating %zu\n", __func__, size); iova = alloc_iova(&imgu->iova_domain, size >> shift, imgu->mmu->aperture_end >> shift, 0); if (!iova) return NULL; pages = imgu_dmamap_alloc_buffer(size, GFP_KERNEL); if (!pages) goto out_free_iova; /* Call IOMMU driver to setup pgt */ iovaddr = iova_dma_addr(&imgu->iova_domain, iova); for (i = 0; i < size / PAGE_SIZE; ++i) { rval = imgu_mmu_map(imgu->mmu, iovaddr, page_to_phys(pages[i]), PAGE_SIZE); if (rval) goto out_unmap; iovaddr += PAGE_SIZE; } /* Now grab a virtual region */ map->vma = __get_vm_area(size, VM_USERMAP, VMALLOC_START, VMALLOC_END); if (!map->vma) goto out_unmap; map->vma->pages = pages; /* And map it in KVA */ if (map_vm_area(map->vma, PAGE_KERNEL, pages)) goto out_vunmap; map->size = size; map->daddr = iova_dma_addr(&imgu->iova_domain, iova); map->vaddr = map->vma->addr; dev_dbg(dev, "%s: allocated %zu @ IOVA %pad @ VA %p\n", __func__, size, &map->daddr, map->vma->addr); return map->vma->addr; out_vunmap: vunmap(map->vma->addr); out_unmap: imgu_dmamap_free_buffer(pages, size); imgu_mmu_unmap(imgu->mmu, iova_dma_addr(&imgu->iova_domain, iova), i * PAGE_SIZE); map->vma = NULL; out_free_iova: __free_iova(&imgu->iova_domain, iova); return NULL; } void imgu_dmamap_unmap(struct imgu_device *imgu, struct imgu_css_map *map) { struct iova *iova; iova = find_iova(&imgu->iova_domain, iova_pfn(&imgu->iova_domain, map->daddr)); if (WARN_ON(!iova)) return; imgu_mmu_unmap(imgu->mmu, iova_dma_addr(&imgu->iova_domain, iova), iova_size(iova) << iova_shift(&imgu->iova_domain)); __free_iova(&imgu->iova_domain, iova); } /* * Counterpart of imgu_dmamap_alloc */ void imgu_dmamap_free(struct imgu_device *imgu, struct imgu_css_map *map) { struct vm_struct *area = map->vma; dev_dbg(&imgu->pci_dev->dev, "%s: freeing %zu @ IOVA %pad @ VA %p\n", __func__, map->size, &map->daddr, map->vaddr); if (!map->vaddr) return; imgu_dmamap_unmap(imgu, map); if (WARN_ON(!area) || WARN_ON(!area->pages)) return; imgu_dmamap_free_buffer(area->pages, map->size); vunmap(map->vaddr); map->vaddr = NULL; } int imgu_dmamap_map_sg(struct imgu_device *imgu, struct scatterlist *sglist, int nents, struct imgu_css_map *map) { unsigned long shift = iova_shift(&imgu->iova_domain); struct scatterlist *sg; struct iova *iova; size_t size = 0; int i; for_each_sg(sglist, sg, nents, i) { if (sg->offset) return -EINVAL; if (i != nents - 1 && !PAGE_ALIGNED(sg->length)) return -EINVAL; size += sg->length; } size = iova_align(&imgu->iova_domain, size); dev_dbg(&imgu->pci_dev->dev, "dmamap: mapping sg %d entries, %zu pages\n", nents, size >> shift); iova = alloc_iova(&imgu->iova_domain, size >> shift, imgu->mmu->aperture_end >> shift, 0); if (!iova) return -ENOMEM; dev_dbg(&imgu->pci_dev->dev, "dmamap: iova low pfn %lu, high pfn %lu\n", iova->pfn_lo, iova->pfn_hi); if (imgu_mmu_map_sg(imgu->mmu, iova_dma_addr(&imgu->iova_domain, iova), sglist, nents) < size) goto out_fail; memset(map, 0, sizeof(*map)); map->daddr = iova_dma_addr(&imgu->iova_domain, iova); map->size = size; return 0; out_fail: __free_iova(&imgu->iova_domain, iova); return -EFAULT; } int imgu_dmamap_init(struct imgu_device *imgu) { unsigned long order, base_pfn; int ret = iova_cache_get(); if (ret) return ret; order = __ffs(IPU3_PAGE_SIZE); base_pfn = max_t(unsigned long, 1, imgu->mmu->aperture_start >> order); init_iova_domain(&imgu->iova_domain, 1UL << order, base_pfn); return 0; } void imgu_dmamap_exit(struct imgu_device *imgu) { put_iova_domain(&imgu->iova_domain); iova_cache_put(); }
// Copyright 2009 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <string> #include <vector> // Returns a pointer to an array of strings with the device names std::vector<std::string> cdio_get_devices(); // Returns true if device is cdrom/dvd bool cdio_is_cdrom(std::string device);
#ifndef _ASM_IA64_AGP_H #define _ASM_IA64_AGP_H /* * IA-64 specific AGP definitions. * * Copyright (C) 2002-2003 Hewlett-Packard Co * David Mosberger-Tang <davidm@hpl.hp.com> */ /* * To avoid memory-attribute aliasing issues, we require that the AGPGART engine operate * in coherent mode, which lets us map the AGP memory as normal (write-back) memory * (unlike x86, where it gets mapped "write-coalescing"). */ #define map_page_into_agp(page) /* nothing */ #define unmap_page_from_agp(page) /* nothing */ #define flush_agp_mappings() /* nothing */ #define flush_agp_cache() mb() /* Convert a physical address to an address suitable for the GART. */ #define phys_to_gart(x) (x) #define gart_to_phys(x) (x) /* GATT allocation. Returns/accepts GATT kernel virtual address. */ #define alloc_gatt_pages(order) \ ((char *)__get_free_pages(GFP_KERNEL, (order))) #define free_gatt_pages(table, order) \ free_pages((unsigned long)(table), (order)) #endif /* _ASM_IA64_AGP_H */
#ifndef _LINUX_IRQ_SIM_H #define _LINUX_IRQ_SIM_H /* * Copyright (C) 2017 Bartosz Golaszewski <brgl@bgdev.pl> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/irq_work.h> #include <linux/device.h> /* * Provides a framework for allocating simulated interrupts which can be * requested like normal irqs and enqueued from process context. */ struct irq_sim_work_ctx { struct irq_work work; int irq; }; struct irq_sim_irq_ctx { int irqnum; bool enabled; }; struct irq_sim { struct irq_sim_work_ctx work_ctx; int irq_base; unsigned int irq_count; struct irq_sim_irq_ctx *irqs; }; int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs); int devm_irq_sim_init(struct device *dev, struct irq_sim *sim, unsigned int num_irqs); void irq_sim_fini(struct irq_sim *sim); void irq_sim_fire(struct irq_sim *sim, unsigned int offset); int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset); #endif /* _LINUX_IRQ_SIM_H */
#ifndef _LINUX_VIRTIO_H #define _LINUX_VIRTIO_H /* Everything a virtio driver needs to work with any particular virtio * implementation. */ #include <linux/types.h> #include <linux/scatterlist.h> #include <linux/spinlock.h> #include <linux/device.h> #include <linux/mod_devicetable.h> #include <linux/gfp.h> /** * virtqueue - a queue to register buffers for sending or receiving. * @list: the chain of virtqueues for this device * @callback: the function to call when buffers are consumed (can be NULL). * @name: the name of this virtqueue (mainly for debugging) * @vdev: the virtio device this queue was created for. * @priv: a pointer for the virtqueue implementation to use. * @index: the zero-based ordinal number for this queue. * @num_free: number of elements we expect to be able to fit. * * A note on @num_free: with indirect buffers, each buffer needs one * element in the queue, otherwise a buffer will need one element per * sg element. */ struct virtqueue { struct list_head list; void (*callback)(struct virtqueue *vq); const char *name; struct virtio_device *vdev; unsigned int index; unsigned int num_free; void *priv; }; int virtqueue_add_buf(struct virtqueue *vq, struct scatterlist sg[], unsigned int out_num, unsigned int in_num, void *data, gfp_t gfp); void virtqueue_kick(struct virtqueue *vq); bool virtqueue_kick_prepare(struct virtqueue *vq); void virtqueue_notify(struct virtqueue *vq); void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); void virtqueue_disable_cb(struct virtqueue *vq); bool virtqueue_enable_cb(struct virtqueue *vq); bool virtqueue_enable_cb_delayed(struct virtqueue *vq); void *virtqueue_detach_unused_buf(struct virtqueue *vq); unsigned int virtqueue_get_vring_size(struct virtqueue *vq); /* FIXME: Obsolete accessor, but required for virtio_net merge. */ static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) { return vq->index; } /** * virtio_device - representation of a device using virtio * @index: unique position on the virtio bus * @dev: underlying device. * @id: the device type identification (used to match it with a driver). * @config: the configuration ops for this device. * @vqs: the list of virtqueues for this device. * @features: the features supported by both driver and device. * @priv: private pointer for the driver's use. */ struct virtio_device { int index; struct device dev; struct virtio_device_id id; struct virtio_config_ops *config; struct list_head vqs; /* Note that this is a Linux set_bit-style bitmap. */ unsigned long features[1]; void *priv; }; static inline struct virtio_device *dev_to_virtio(struct device *_dev) { return container_of(_dev, struct virtio_device, dev); } int register_virtio_device(struct virtio_device *dev); void unregister_virtio_device(struct virtio_device *dev); /** * virtio_driver - operations for a virtio I/O driver * @driver: underlying device driver (populate name and owner). * @id_table: the ids serviced by this driver. * @feature_table: an array of feature numbers supported by this driver. * @feature_table_size: number of entries in the feature table array. * @probe: the function to call when a device is found. Returns 0 or -errno. * @remove: the function to call when a device is removed. * @config_changed: optional function to call when the device configuration * changes; may be called in interrupt context. */ struct virtio_driver { struct device_driver driver; const struct virtio_device_id *id_table; const unsigned int *feature_table; unsigned int feature_table_size; int (*probe)(struct virtio_device *dev); void (*scan)(struct virtio_device *dev); void (*remove)(struct virtio_device *dev); void (*config_changed)(struct virtio_device *dev); #ifdef CONFIG_PM int (*freeze)(struct virtio_device *dev); int (*restore)(struct virtio_device *dev); #endif }; static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv) { return container_of(drv, struct virtio_driver, driver); } int register_virtio_driver(struct virtio_driver *drv); void unregister_virtio_driver(struct virtio_driver *drv); #endif /* _LINUX_VIRTIO_H */
/* * * Copyright (c) 2009, Microsoft Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Authors: * Haiyang Zhang <haiyangz@microsoft.com> * Hank Janssen <hjanssen@microsoft.com> * */ #include <linux/kernel.h> #include <linux/mm.h> #include "osd.h" #include "storvsc.c" static const char *g_blk_driver_name = "blkvsc"; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ static const struct hv_guid g_blk_device_type = { .data = { 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 } }; static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info) { struct storvsc_device_info *device_info; int ret = 0; device_info = (struct storvsc_device_info *)additional_info; ret = stor_vsc_on_device_add(device, additional_info); if (ret != 0) return ret; /* * We need to use the device instance guid to set the path and target * id. For IDE devices, the device instance id is formatted as * <bus id> * - <device id> - 8899 - 000000000000. */ device_info->path_id = device->deviceInstance.data[3] << 24 | device->deviceInstance.data[2] << 16 | device->deviceInstance.data[1] << 8 | device->deviceInstance.data[0]; device_info->target_id = device->deviceInstance.data[5] << 8 | device->deviceInstance.data[4]; return ret; } int blk_vsc_initialize(struct hv_driver *driver) { struct storvsc_driver_object *stor_driver; int ret = 0; stor_driver = (struct storvsc_driver_object *)driver; /* Make sure we are at least 2 pages since 1 page is used for control */ /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */ driver->name = g_blk_driver_name; memcpy(&driver->deviceType, &g_blk_device_type, sizeof(struct hv_guid)); stor_driver->request_ext_size = sizeof(struct storvsc_request_extension); /* * Divide the ring buffer data size (which is 1 page less than the ring * buffer size since that page is reserved for the ring buffer indices) * by the max request size (which is * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) */ stor_driver->max_outstanding_req_per_channel = ((stor_driver->ring_buffer_size - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64), sizeof(u64))); DPRINT_INFO(BLKVSC, "max io outstd %u", stor_driver->max_outstanding_req_per_channel); /* Setup the dispatch table */ stor_driver->base.OnDeviceAdd = blk_vsc_on_device_add; stor_driver->base.OnDeviceRemove = stor_vsc_on_device_remove; stor_driver->base.OnCleanup = stor_vsc_on_cleanup; stor_driver->on_io_request = stor_vsc_on_io_request; return ret; }
/* * OpenBIOS - free your system! * ( firmware/flash device driver for Linux ) * * bios.h - compile time configuration and globals * * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * * Copyright (C) 1998-2004 Stefan Reinauer, <stepan@openbios.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA * */ #include <linux/spinlock.h> #define BIOS_MAJOR 104 #define BIOS_MAXDEV 8 #define BIOS_VERSION "0.4rc1" // #define UTC_BIOS extern int write; extern unsigned char *bios; extern spinlock_t bios_lock;
// UIKit+AFNetworking.h // // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // 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. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #if TARGET_OS_IOS || TARGET_OS_TV #import <UIKit/UIKit.h> #ifndef _UIKIT_AFNETWORKING_ #define _UIKIT_AFNETWORKING_ #if TARGET_OS_IOS #import "AFAutoPurgingImageCache.h" #import "AFImageDownloader.h" #import "AFNetworkActivityIndicatorManager.h" #import "UIRefreshControl+AFNetworking.h" #import "UIWebView+AFNetworking.h" #endif #import "UIActivityIndicatorView+AFNetworking.h" #import "UIButton+AFNetworking.h" #import "UIImageView+AFNetworking.h" #import "UIProgressView+AFNetworking.h" #endif /* _UIKIT_AFNETWORKING_ */ #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SYNC_BACKEND_UNRECOVERABLE_ERROR_HANDLER_H_ #define CHROME_BROWSER_SYNC_BACKEND_UNRECOVERABLE_ERROR_HANDLER_H_ #include <string> #include "base/location.h" #include "base/memory/weak_ptr.h" #include "sync/internal_api/public/util/unrecoverable_error_handler.h" #include "sync/internal_api/public/util/weak_handle.h" class ProfileSyncService; namespace browser_sync { class BackendUnrecoverableErrorHandler : public syncer::UnrecoverableErrorHandler { public: BackendUnrecoverableErrorHandler( const syncer::WeakHandle<ProfileSyncService>& service); virtual ~BackendUnrecoverableErrorHandler(); virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, const std::string& message) OVERRIDE; private: syncer::WeakHandle<ProfileSyncService> service_; }; } // namespace browser_sync #endif // CHROME_BROWSER_SYNC_BACKEND_UNRECOVERABLE_ERROR_HANDLER_H_
#ifdef BLOG_CURRENT_CHANNEL #undef BLOG_CURRENT_CHANNEL #endif #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv6_addr_in_network
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1994 - 2001, 2003 by Ralf Baechle * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc. */ #ifndef _ASM_PGALLOC_H #define _ASM_PGALLOC_H #include <linux/highmem.h> #include <linux/mm.h> #include <linux/sched.h> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) { set_pmd(pmd, __pmd((unsigned long)pte)); } static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t pte) { set_pmd(pmd, __pmd((unsigned long)page_address(pte))); } #define pmd_pgtable(pmd) pmd_page(pmd) /* * Initialize a new pmd table with invalid pointers. */ extern void pmd_init(unsigned long page, unsigned long pagetable); #ifndef __PAGETABLE_PMD_FOLDED static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) { set_pud(pud, __pud((unsigned long)pmd)); } #endif /* * Initialize a new pgd / pmd table with invalid pointers. */ extern void pgd_init(unsigned long page); static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *ret, *init; ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); if (ret) { init = pgd_offset(&init_mm, 0UL); pgd_init((unsigned long)ret); memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); } return ret; } static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { free_pages((unsigned long)pgd, PGD_ORDER); } static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { return (pte_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER); } static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { struct page *pte; pte = alloc_pages(GFP_KERNEL, PTE_ORDER); if (!pte) return NULL; clear_highpage(pte); if (!pgtable_page_ctor(pte)) { __free_page(pte); return NULL; } return pte; } static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { free_pages((unsigned long)pte, PTE_ORDER); } static inline void pte_free(struct mm_struct *mm, pgtable_t pte) { pgtable_page_dtor(pte); __free_pages(pte, PTE_ORDER); } #define __pte_free_tlb(tlb,pte,address) \ do { \ pgtable_page_dtor(pte); \ tlb_remove_page((tlb), pte); \ } while (0) #ifndef __PAGETABLE_PMD_FOLDED static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER); if (pmd) pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); return pmd; } static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { free_pages((unsigned long)pmd, PMD_ORDER); } #define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x) #endif #define check_pgt_cache() do { } while (0) extern void pagetable_init(void); #endif /* _ASM_PGALLOC_H */
/* * Copyright (C) 2016 ARM Limited * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __ASM_SECTIONS_H #define __ASM_SECTIONS_H #include <asm-generic/sections.h> extern char __alt_instructions[], __alt_instructions_end[]; extern char __exception_text_start[], __exception_text_end[]; extern char __hibernate_exit_text_start[], __hibernate_exit_text_end[]; extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[]; extern char __hyp_text_start[], __hyp_text_end[]; extern char __idmap_text_start[], __idmap_text_end[]; extern char __initdata_begin[], __initdata_end[]; extern char __inittext_begin[], __inittext_end[]; extern char __irqentry_text_start[], __irqentry_text_end[]; extern char __mmuoff_data_start[], __mmuoff_data_end[]; #endif /* __ASM_SECTIONS_H */
/* ** linux/amiga/chipram.c ** ** Modified 03-May-94 by Geert Uytterhoeven <geert@linux-m68k.org> ** - 64-bit aligned allocations for full AGA compatibility ** ** Rewritten 15/9/2000 by Geert to use resource management */ #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/slab.h> #include <linux/string.h> #include <linux/module.h> #include <asm/atomic.h> #include <asm/page.h> #include <asm/amigahw.h> unsigned long amiga_chip_size; EXPORT_SYMBOL(amiga_chip_size); static struct resource chipram_res = { .name = "Chip RAM", .start = CHIP_PHYSADDR }; static atomic_t chipavail; void __init amiga_chip_init(void) { if (!AMIGAHW_PRESENT(CHIP_RAM)) return; chipram_res.end = CHIP_PHYSADDR + amiga_chip_size - 1; request_resource(&iomem_resource, &chipram_res); atomic_set(&chipavail, amiga_chip_size); } void *amiga_chip_alloc(unsigned long size, const char *name) { struct resource *res; void *p; res = kzalloc(sizeof(struct resource), GFP_KERNEL); if (!res) return NULL; res->name = name; p = amiga_chip_alloc_res(size, res); if (!p) { kfree(res); return NULL; } return p; } EXPORT_SYMBOL(amiga_chip_alloc); /* * Warning: * amiga_chip_alloc_res is meant only for drivers that need to * allocate Chip RAM before kmalloc() is functional. As a consequence, * those drivers must not free that Chip RAM afterwards. */ void *amiga_chip_alloc_res(unsigned long size, struct resource *res) { int error; /* round up */ size = PAGE_ALIGN(size); pr_debug("amiga_chip_alloc_res: allocate %lu bytes\n", size); error = allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL); if (error < 0) { pr_err("amiga_chip_alloc_res: allocate_resource() failed %d!\n", error); return NULL; } atomic_sub(size, &chipavail); pr_debug("amiga_chip_alloc_res: returning %pR\n", res); return (void *)ZTWO_VADDR(res->start); } void amiga_chip_free(void *ptr) { unsigned long start = ZTWO_PADDR(ptr); struct resource *res; unsigned long size; res = lookup_resource(&chipram_res, start); if (!res) { pr_err("amiga_chip_free: trying to free nonexistent region at " "%p\n", ptr); return; } size = resource_size(res); pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr); atomic_add(size, &chipavail); release_resource(res); kfree(res); } EXPORT_SYMBOL(amiga_chip_free); unsigned long amiga_chip_avail(void) { unsigned long n = atomic_read(&chipavail); pr_debug("amiga_chip_avail : %lu bytes\n", n); return n; } EXPORT_SYMBOL(amiga_chip_avail);
/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * 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. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include "mxms.h" #define ROM16(x) get_unaligned_le16(&(x)) #define ROM32(x) get_unaligned_le32(&(x)) static u8 * mxms_data(struct nvkm_mxm *mxm) { return mxm->mxms; } u16 mxms_version(struct nvkm_mxm *mxm) { u8 *mxms = mxms_data(mxm); u16 version = (mxms[4] << 8) | mxms[5]; switch (version ) { case 0x0200: case 0x0201: case 0x0300: return version; default: break; } nvkm_debug(&mxm->subdev, "unknown version %d.%d\n", mxms[4], mxms[5]); return 0x0000; } u16 mxms_headerlen(struct nvkm_mxm *mxm) { return 8; } u16 mxms_structlen(struct nvkm_mxm *mxm) { return *(u16 *)&mxms_data(mxm)[6]; } bool mxms_checksum(struct nvkm_mxm *mxm) { u16 size = mxms_headerlen(mxm) + mxms_structlen(mxm); u8 *mxms = mxms_data(mxm), sum = 0; while (size--) sum += *mxms++; if (sum) { nvkm_debug(&mxm->subdev, "checksum invalid\n"); return false; } return true; } bool mxms_valid(struct nvkm_mxm *mxm) { u8 *mxms = mxms_data(mxm); if (*(u32 *)mxms != 0x5f4d584d) { nvkm_debug(&mxm->subdev, "signature invalid\n"); return false; } if (!mxms_version(mxm) || !mxms_checksum(mxm)) return false; return true; } bool mxms_foreach(struct nvkm_mxm *mxm, u8 types, bool (*exec)(struct nvkm_mxm *, u8 *, void *), void *info) { struct nvkm_subdev *subdev = &mxm->subdev; u8 *mxms = mxms_data(mxm); u8 *desc = mxms + mxms_headerlen(mxm); u8 *fini = desc + mxms_structlen(mxm) - 1; while (desc < fini) { u8 type = desc[0] & 0x0f; u8 headerlen = 0; u8 recordlen = 0; u8 entries = 0; switch (type) { case 0: /* Output Device Structure */ if (mxms_version(mxm) >= 0x0300) headerlen = 8; else headerlen = 6; break; case 1: /* System Cooling Capability Structure */ case 2: /* Thermal Structure */ case 3: /* Input Power Structure */ headerlen = 4; break; case 4: /* GPIO Device Structure */ headerlen = 4; recordlen = 2; entries = (ROM32(desc[0]) & 0x01f00000) >> 20; break; case 5: /* Vendor Specific Structure */ headerlen = 8; break; case 6: /* Backlight Control Structure */ if (mxms_version(mxm) >= 0x0300) { headerlen = 4; recordlen = 8; entries = (desc[1] & 0xf0) >> 4; } else { headerlen = 8; } break; case 7: /* Fan Control Structure */ headerlen = 8; recordlen = 4; entries = desc[1] & 0x07; break; default: nvkm_debug(subdev, "unknown descriptor type %d\n", type); return false; } if (mxm->subdev.debug >= NV_DBG_DEBUG && (exec == NULL)) { static const char * mxms_desc[] = { "ODS", "SCCS", "TS", "IPS", "GSD", "VSS", "BCS", "FCS", }; u8 *dump = desc; char data[32], *ptr; int i, j; for (j = headerlen - 1, ptr = data; j >= 0; j--) ptr += sprintf(ptr, "%02x", dump[j]); dump += headerlen; nvkm_debug(subdev, "%4s: %s\n", mxms_desc[type], data); for (i = 0; i < entries; i++, dump += recordlen) { for (j = recordlen - 1, ptr = data; j >= 0; j--) ptr += sprintf(ptr, "%02x", dump[j]); nvkm_debug(subdev, " %s\n", data); } } if (types & (1 << type)) { if (!exec(mxm, desc, info)) return false; } desc += headerlen + (entries * recordlen); } return true; } void mxms_output_device(struct nvkm_mxm *mxm, u8 *pdata, struct mxms_odev *desc) { u64 data = ROM32(pdata[0]); if (mxms_version(mxm) >= 0x0300) data |= (u64)ROM16(pdata[4]) << 32; desc->outp_type = (data & 0x00000000000000f0ULL) >> 4; desc->ddc_port = (data & 0x0000000000000f00ULL) >> 8; desc->conn_type = (data & 0x000000000001f000ULL) >> 12; desc->dig_conn = (data & 0x0000000000780000ULL) >> 19; }
/* * Copyright (C) 2013 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef EventPathWalker_h #define EventPathWalker_h namespace WebCore { class Node; class EventPathWalker { public: explicit EventPathWalker(const Node*); static Node* parent(const Node*); void moveToParent(); Node* node() const { return const_cast<Node*>(m_node); } bool isVisitingInsertionPointInReprojection() { return m_isVisitingInsertionPointInReprojection; } private: const Node* m_node; const Node* m_distributedNode; bool m_isVisitingInsertionPointInReprojection; }; } // namespace #endif
/* * Media device node * * Copyright (C) 2010 Nokia Corporation * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * -- * * Common functions for media-related drivers to register and unregister media * device nodes. */ #ifndef _MEDIA_DEVNODE_H #define _MEDIA_DEVNODE_H #include <linux/poll.h> #include <linux/fs.h> #include <linux/device.h> #include <linux/cdev.h> #define MEDIA_FLAG_REGISTERED 0 struct media_file_operations { struct module *owner; ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); unsigned int (*poll) (struct file *, struct poll_table_struct *); long (*ioctl) (struct file *, unsigned int, unsigned long); int (*open) (struct file *); int (*release) (struct file *); }; struct media_devnode { const struct media_file_operations *fops; struct device dev; struct cdev cdev; struct device *parent; int minor; unsigned long flags; void (*release)(struct media_devnode *mdev); }; #define to_media_devnode(cd) container_of(cd, struct media_devnode, dev) int __must_check media_devnode_register(struct media_devnode *mdev); void media_devnode_unregister(struct media_devnode *mdev); static inline struct media_devnode *media_devnode_data(struct file *filp) { return filp->private_data; } static inline int media_devnode_is_registered(struct media_devnode *mdev) { return test_bit(MEDIA_FLAG_REGISTERED, &mdev->flags); } #endif
/* gzclose.c -- zlib gzclose() function * Copyright (C) 2004, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" /* gzclose() is in a separate file so that it is linked in only if it is used. That way the other gzclose functions can be used instead to avoid linking in unneeded compression or decompression routines. */ int ZEXPORT gzclose(file) gzFile file; { #ifndef NO_GZCOMPRESS gz_statep state; if (file == NULL) return Z_STREAM_ERROR; state = (gz_statep)file; return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); #else return gzclose_r(file); #endif }
/* * Linux driver model AC97 bus interface * * Author: Nicolas Pitre * Created: Jan 14, 2005 * Copyright: (C) MontaVista Software Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include <linux/module.h> #include <linux/init.h> #include <linux/device.h> #include <linux/string.h> #include <sound/ac97_codec.h> /* * Let drivers decide whether they want to support given codec from their * probe method. Drivers have direct access to the struct snd_ac97 * structure and may decide based on the id field amongst other things. */ static int ac97_bus_match(struct device *dev, struct device_driver *drv) { return 1; } #ifdef CONFIG_PM static int ac97_bus_suspend(struct device *dev, pm_message_t state) { int ret = 0; if (dev->driver && dev->driver->suspend) ret = dev->driver->suspend(dev, state); return ret; } static int ac97_bus_resume(struct device *dev) { int ret = 0; if (dev->driver && dev->driver->resume) ret = dev->driver->resume(dev); return ret; } #endif /* CONFIG_PM */ struct bus_type ac97_bus_type = { .name = "ac97", .match = ac97_bus_match, #ifdef CONFIG_PM .suspend = ac97_bus_suspend, .resume = ac97_bus_resume, #endif /* CONFIG_PM */ }; static int __init ac97_bus_init(void) { return bus_register(&ac97_bus_type); } subsys_initcall(ac97_bus_init); static void __exit ac97_bus_exit(void) { bus_unregister(&ac97_bus_type); } module_exit(ac97_bus_exit); EXPORT_SYMBOL(ac97_bus_type); MODULE_LICENSE("GPL");
/* * Copyright 1996 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ /*$Header*/ /* Generate code to pack a bit array from a name:#bits description, * WAV #49 style. */ #include <stdio.h> #include "taste.h" #include "proto.h" #include <limits.h> /* This module goes back to one Jeff Chilton used for his implementation * of the #49 WAV GSM format. (In his original patch 8, it replaced * bitter.c.) * * In Microsoft's WAV #49 version of the GSM format, two 32 1/2 * byte GSM frames are packed together to make one WAV frame, and * the GSM parameters are packed into bytes right-to-left rather * than left-to-right. * * That is, where toast's GSM format writes * * aaaaaabb bbbbcccc cdddddee ... * ___1____ ___2____ ___3____ * * for parameters a (6 bits), b (6 bits), c (5 bits), d (5 bits), e .. * the WAV format has * * bbaaaaaa ccccbbbb eedddddc ... * ___1____ ___2____ ___3____ * * (This format looks a lot prettier if one pictures octets coming * in through a fifo queue from the left, rather than waiting in the * right-hand remainder of a C array.) */ #define WORD_BITS 16 /* sizeof(uword) * CHAR_BIT on the * target architecture---if this isn't 16, * you're in trouble with this library anyway. */ #define BYTE_BITS 8 /* CHAR_BIT on the target architecture--- * if this isn't 8, you're in *deep* trouble. */ void write_code P2((s_spex, n_spex), struct spex * s_spex, int n_spex) { struct spex * sp = s_spex; int n_in = 0; printf("uword sr = 0;\n"); for (; n_spex > 0; n_spex--, sp++) { /* insert old * new var value unused * here * * [____________xxxxxx**********] * * <----- n_in ------> */ printf("sr = sr >> %d | %s << %d;\n", sp->varsize, sp->var, WORD_BITS - sp->varsize); n_in += sp->varsize; while (n_in >= BYTE_BITS) { printf("*c++ = sr >> %d;\n", WORD_BITS - n_in); n_in -= BYTE_BITS; } } while (n_in >= BYTE_BITS) { printf("*c++ = sr >> %d;\n", WORD_BITS - n_in); n_in -= BYTE_BITS; } if (n_in > 0) { fprintf(stderr, "warning: %d bits left over\n", n_in); } }
#ifndef __NVKM_GPIO_H__ #define __NVKM_GPIO_H__ #include <subdev/gpio.h> #define nouveau_gpio_create(p,e,o,d) \ nouveau_gpio_create_((p), (e), (o), sizeof(**d), (void **)d) #define nouveau_gpio_destroy(p) ({ \ struct nouveau_gpio *gpio = (p); \ _nouveau_gpio_dtor(nv_object(gpio)); \ }) #define nouveau_gpio_init(p) ({ \ struct nouveau_gpio *gpio = (p); \ _nouveau_gpio_init(nv_object(gpio)); \ }) #define nouveau_gpio_fini(p,s) ({ \ struct nouveau_gpio *gpio = (p); \ _nouveau_gpio_fini(nv_object(gpio), (s)); \ }) int nouveau_gpio_create_(struct nouveau_object *, struct nouveau_object *, struct nouveau_oclass *, int, void **); int _nouveau_gpio_ctor(struct nouveau_object *, struct nouveau_object *, struct nouveau_oclass *, void *, u32, struct nouveau_object **); void _nouveau_gpio_dtor(struct nouveau_object *); int _nouveau_gpio_init(struct nouveau_object *); int _nouveau_gpio_fini(struct nouveau_object *, bool); struct nouveau_gpio_impl { struct nouveau_oclass base; int lines; /* read and ack pending interrupts, returning only data * for lines that have not been masked off, while still * performing the ack for anything that was pending. */ void (*intr_stat)(struct nouveau_gpio *, u32 *, u32 *); /* mask on/off interrupts for hi/lo transitions on a * given set of gpio lines */ void (*intr_mask)(struct nouveau_gpio *, u32, u32, u32); /* configure gpio direction and output value */ int (*drive)(struct nouveau_gpio *, int line, int dir, int out); /* sense current state of given gpio line */ int (*sense)(struct nouveau_gpio *, int line); /*XXX*/ void (*reset)(struct nouveau_gpio *, u8); }; void nv50_gpio_reset(struct nouveau_gpio *, u8); int nv50_gpio_drive(struct nouveau_gpio *, int, int, int); int nv50_gpio_sense(struct nouveau_gpio *, int); void nv92_gpio_intr_stat(struct nouveau_gpio *, u32 *, u32 *); void nv92_gpio_intr_mask(struct nouveau_gpio *, u32, u32, u32); void nvd0_gpio_reset(struct nouveau_gpio *, u8); int nvd0_gpio_drive(struct nouveau_gpio *, int, int, int); int nvd0_gpio_sense(struct nouveau_gpio *, int); #endif
/* (C) Copyright IBM Corp. 2008 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of IBM nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* SPU clock stop library service. */ #include <spu_timer.h> #include "spu_timer_internal.h" /* Stops the SPU clock: * decrements clock start count * when count is zero, disables the decrementer event and stops the decrementer Returns 0 on success and <0 on failure: * SPU_CLOCK_ERR_NOT_RUNNING - clock was already off * SPU_CLOCK_ERR_TIMERS_ACTIVE - active timers exist * SPU_CLOCK_ERR_STILL_RUNNING - start count was decremented but clock was not stopped */ int spu_clock_stop (void) { if (__spu_clock_startcnt == 0) return SPU_CLOCK_ERR_NOT_RUNNING; if (__spu_clock_startcnt == 1 && (__spu_timers_active || __spu_timers_handled)) return SPU_CLOCK_ERR_TIMERS_ACTIVE; /* Don't stop clock if the clock is still in use. */ if (--__spu_clock_startcnt != 0) return SPU_CLOCK_ERR_STILL_RUNNING; /* Clock stopped, stop decrementer. */ __disable_spu_decr (); /* Clock is enabled on clock start - restore to original state (saved at start). */ if (__likely (!__spu_clock_state_was_enabled)) { spu_idisable (); } return 0; }
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only 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. */ #ifndef __MSM_ISP_UTIL_H__ #define __MSM_ISP_UTIL_H__ #include "msm_isp.h" #include <soc/qcom/camera2.h> /* #define CONFIG_MSM_ISP_DBG 1 */ #ifdef CONFIG_MSM_ISP_DBG #define ISP_DBG(fmt, args...) printk(fmt, ##args) #else #define ISP_DBG(fmt, args...) pr_debug(fmt, ##args) #endif #define ALT_VECTOR_IDX(x) {x = 3 - x; } struct msm_isp_bandwidth_info { uint32_t active; uint64_t ab; uint64_t ib; }; enum msm_isp_hw_client { ISP_VFE0, ISP_VFE1, ISP_CPP, MAX_ISP_CLIENT, }; struct msm_isp_bandwidth_mgr { uint32_t bus_client; uint32_t bus_vector_active_idx; uint32_t use_count; struct msm_isp_bandwidth_info client_info[MAX_ISP_CLIENT]; }; uint32_t msm_isp_get_framedrop_period( enum msm_vfe_frame_skip_pattern frame_skip_pattern); int msm_isp_init_bandwidth_mgr(enum msm_isp_hw_client client); int msm_isp_update_bandwidth(enum msm_isp_hw_client client, uint64_t ab, uint64_t ib); void msm_isp_deinit_bandwidth_mgr(enum msm_isp_hw_client client); int msm_isp_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub); int msm_isp_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub); int msm_isp_proc_cmd(struct vfe_device *vfe_dev, void *arg); int msm_isp_send_event(struct vfe_device *vfe_dev, uint32_t type, struct msm_isp_event_data *event_data); int msm_isp_cal_word_per_line(uint32_t output_format, uint32_t pixel_per_line); int msm_isp_get_bit_per_pixel(uint32_t output_format); enum msm_isp_pack_fmt msm_isp_get_pack_format(uint32_t output_format); irqreturn_t msm_isp_process_irq(int irq_num, void *data); int msm_isp_set_src_state(struct vfe_device *vfe_dev, void *arg); void msm_isp_do_tasklet(unsigned long data); void msm_isp_update_error_frame_count(struct vfe_device *vfe_dev); void msm_isp_process_error_info(struct vfe_device *vfe_dev); int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh); int msm_isp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh); long msm_isp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg); int msm_isp_proc_cmd_list(struct vfe_device *vfe_dev, void *arg); int msm_isp_get_clk_info(struct vfe_device *vfe_dev, struct platform_device *pdev, struct msm_cam_clk_info *vfe_clk_info); #endif /* __MSM_ISP_UTIL_H__ */
// SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; #define DUMMY_STORAGE_VALUE 0xdeadbeef int monitored_pid = 0; int inode_storage_result = -1; int sk_storage_result = -1; struct local_storage { struct inode *exec_inode; __u32 value; struct bpf_spin_lock lock; }; struct { __uint(type, BPF_MAP_TYPE_INODE_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, struct local_storage); } inode_storage_map SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC | BPF_F_CLONE); __type(key, int); __type(value, struct local_storage); } sk_storage_map SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, struct local_storage); } task_storage_map SEC(".maps"); SEC("lsm/inode_unlink") int BPF_PROG(unlink_hook, struct inode *dir, struct dentry *victim) { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; bool is_self_unlink; if (pid != monitored_pid) return 0; storage = bpf_task_storage_get(&task_storage_map, bpf_get_current_task_btf(), 0, 0); if (storage) { /* Don't let an executable delete itself */ bpf_spin_lock(&storage->lock); is_self_unlink = storage->exec_inode == victim->d_inode; bpf_spin_unlock(&storage->lock); if (is_self_unlink) return -EPERM; } return 0; } SEC("lsm/inode_rename") int BPF_PROG(inode_rename, struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; int err; /* new_dentry->d_inode can be NULL when the inode is renamed to a file * that did not exist before. The helper should be able to handle this * NULL pointer. */ bpf_inode_storage_get(&inode_storage_map, new_dentry->d_inode, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); storage = bpf_inode_storage_get(&inode_storage_map, old_dentry->d_inode, 0, 0); if (!storage) return 0; bpf_spin_lock(&storage->lock); if (storage->value != DUMMY_STORAGE_VALUE) inode_storage_result = -1; bpf_spin_unlock(&storage->lock); err = bpf_inode_storage_delete(&inode_storage_map, old_dentry->d_inode); if (!err) inode_storage_result = err; return 0; } SEC("lsm/socket_bind") int BPF_PROG(socket_bind, struct socket *sock, struct sockaddr *address, int addrlen) { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; int err; if (pid != monitored_pid) return 0; storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return 0; bpf_spin_lock(&storage->lock); if (storage->value != DUMMY_STORAGE_VALUE) sk_storage_result = -1; bpf_spin_unlock(&storage->lock); err = bpf_sk_storage_delete(&sk_storage_map, sock->sk); if (!err) sk_storage_result = err; return 0; } SEC("lsm/socket_post_create") int BPF_PROG(socket_post_create, struct socket *sock, int family, int type, int protocol, int kern) { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; if (pid != monitored_pid) return 0; storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return 0; bpf_spin_lock(&storage->lock); storage->value = DUMMY_STORAGE_VALUE; bpf_spin_unlock(&storage->lock); return 0; } /* This uses the local storage to remember the inode of the binary that a * process was originally executing. */ SEC("lsm/bprm_committed_creds") void BPF_PROG(exec, struct linux_binprm *bprm) { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; if (pid != monitored_pid) return; storage = bpf_task_storage_get(&task_storage_map, bpf_get_current_task_btf(), 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (storage) { bpf_spin_lock(&storage->lock); storage->exec_inode = bprm->file->f_inode; bpf_spin_unlock(&storage->lock); } storage = bpf_inode_storage_get(&inode_storage_map, bprm->file->f_inode, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return; bpf_spin_lock(&storage->lock); storage->value = DUMMY_STORAGE_VALUE; bpf_spin_unlock(&storage->lock); }
/* * 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. * * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> * Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com> * Copyright (C) 2013 John Crispin <blogic@openwrt.org> */ #include <linux/string.h> #include <linux/of_fdt.h> #include <linux/of_platform.h> #include <asm/bootinfo.h> #include <asm/addrspace.h> #include "common.h" struct ralink_soc_info soc_info; const char *get_system_type(void) { return soc_info.sys_type; } static __init void prom_init_cmdline(int argc, char **argv) { int i; pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n", (unsigned int)fw_arg0, (unsigned int)fw_arg1, (unsigned int)fw_arg2, (unsigned int)fw_arg3); argc = fw_arg0; argv = (char **) KSEG1ADDR(fw_arg1); if (!argv) { pr_debug("argv=%p is invalid, skipping\n", argv); return; } for (i = 0; i < argc; i++) { char *p = (char *) KSEG1ADDR(argv[i]); if (CPHYSADDR(p) && *p) { pr_debug("argv[%d]: %s\n", i, p); strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline)); strlcat(arcs_cmdline, p, sizeof(arcs_cmdline)); } } } void __init prom_init(void) { int argc; char **argv; prom_soc_init(&soc_info); pr_info("SoC Type: %s\n", get_system_type()); prom_init_cmdline(argc, argv); } void __init prom_free_prom_memory(void) { }
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License version 2. */ #include <linux/sched.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/kallsyms.h> #include <linux/gfs2_ondisk.h> #include "gfs2.h" #include "incore.h" #include "glock.h" #include "log.h" #include "lops.h" #include "meta_io.h" #include "trans.h" #include "util.h" #include "trace_gfs2.h" int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, unsigned int revokes) { struct gfs2_trans *tr; int error; BUG_ON(current->journal_info); BUG_ON(blocks == 0 && revokes == 0); if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) return -EROFS; tr = kzalloc(sizeof(struct gfs2_trans), GFP_NOFS); if (!tr) return -ENOMEM; tr->tr_ip = (unsigned long)__builtin_return_address(0); tr->tr_blocks = blocks; tr->tr_revokes = revokes; tr->tr_reserved = 1; if (blocks) tr->tr_reserved += 6 + blocks; if (revokes) tr->tr_reserved += gfs2_struct2blk(sdp, revokes, sizeof(u64)); sb_start_intwrite(sdp->sd_vfs); gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); error = gfs2_glock_nq(&tr->tr_t_gh); if (error) goto fail_holder_uninit; error = gfs2_log_reserve(sdp, tr->tr_reserved); if (error) goto fail_gunlock; current->journal_info = tr; return 0; fail_gunlock: gfs2_glock_dq(&tr->tr_t_gh); fail_holder_uninit: sb_end_intwrite(sdp->sd_vfs); gfs2_holder_uninit(&tr->tr_t_gh); kfree(tr); return error; } /** * gfs2_log_release - Release a given number of log blocks * @sdp: The GFS2 superblock * @blks: The number of blocks * */ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) { atomic_add(blks, &sdp->sd_log_blks_free); trace_gfs2_log_blocks(sdp, blks); gfs2_assert_withdraw(sdp, atomic_read(&sdp->sd_log_blks_free) <= sdp->sd_jdesc->jd_blocks); up_read(&sdp->sd_log_flush_lock); } static void gfs2_print_trans(const struct gfs2_trans *tr) { print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n", tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched); printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n", tr->tr_num_buf_new, tr->tr_num_buf_rm, tr->tr_num_databuf_new, tr->tr_num_databuf_rm, tr->tr_num_revoke, tr->tr_num_revoke_rm); } void gfs2_trans_end(struct gfs2_sbd *sdp) { struct gfs2_trans *tr = current->journal_info; s64 nbuf; BUG_ON(!tr); current->journal_info = NULL; if (!tr->tr_touched) { gfs2_log_release(sdp, tr->tr_reserved); if (tr->tr_t_gh.gh_gl) { gfs2_glock_dq(&tr->tr_t_gh); gfs2_holder_uninit(&tr->tr_t_gh); kfree(tr); } sb_end_intwrite(sdp->sd_vfs); return; } nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new; nbuf -= tr->tr_num_buf_rm; nbuf -= tr->tr_num_databuf_rm; if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) && (tr->tr_num_revoke <= tr->tr_revokes))) gfs2_print_trans(tr); gfs2_log_commit(sdp, tr); if (tr->tr_t_gh.gh_gl) { gfs2_glock_dq(&tr->tr_t_gh); gfs2_holder_uninit(&tr->tr_t_gh); kfree(tr); } if (sdp->sd_vfs->s_flags & MS_SYNCHRONOUS) gfs2_log_flush(sdp, NULL); sb_end_intwrite(sdp->sd_vfs); } /** * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction * @gl: the glock the buffer belongs to * @bh: The buffer to add * @meta: True in the case of adding metadata * */ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta) { struct gfs2_sbd *sdp = gl->gl_sbd; struct gfs2_bufdata *bd; lock_buffer(bh); gfs2_log_lock(sdp); bd = bh->b_private; if (bd) gfs2_assert(sdp, bd->bd_gl == gl); else { gfs2_log_unlock(sdp); unlock_buffer(bh); gfs2_attach_bufdata(gl, bh, meta); bd = bh->b_private; lock_buffer(bh); gfs2_log_lock(sdp); } lops_add(sdp, bd); gfs2_log_unlock(sdp); unlock_buffer(bh); } void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) { BUG_ON(!list_empty(&bd->bd_list)); BUG_ON(!list_empty(&bd->bd_ail_st_list)); BUG_ON(!list_empty(&bd->bd_ail_gl_list)); lops_init_le(bd, &gfs2_revoke_lops); lops_add(sdp, bd); } void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) { struct gfs2_bufdata *bd, *tmp; struct gfs2_trans *tr = current->journal_info; unsigned int n = len; gfs2_log_lock(sdp); list_for_each_entry_safe(bd, tmp, &sdp->sd_log_le_revoke, bd_list) { if ((bd->bd_blkno >= blkno) && (bd->bd_blkno < (blkno + len))) { list_del_init(&bd->bd_list); gfs2_assert_withdraw(sdp, sdp->sd_log_num_revoke); sdp->sd_log_num_revoke--; kmem_cache_free(gfs2_bufdata_cachep, bd); tr->tr_num_revoke_rm++; if (--n == 0) break; } } gfs2_log_unlock(sdp); }
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_xml_stream_XMLEventReaderImpl__ #define __gnu_xml_stream_XMLEventReaderImpl__ #pragma interface #include <java/lang/Object.h> extern "Java" { namespace gnu { namespace xml { namespace stream { class XMLEventReaderImpl; } } } namespace javax { namespace xml { namespace stream { class XMLStreamReader; namespace events { class XMLEvent; } namespace util { class XMLEventAllocator; } } } } } class gnu::xml::stream::XMLEventReaderImpl : public ::java::lang::Object { public: // actually protected XMLEventReaderImpl(::javax::xml::stream::XMLStreamReader *, ::javax::xml::stream::util::XMLEventAllocator *, ::java::lang::String *); public: virtual ::javax::xml::stream::events::XMLEvent * nextEvent(); virtual ::java::lang::Object * next(); virtual jboolean hasNext(); virtual ::javax::xml::stream::events::XMLEvent * peek(); virtual ::java::lang::String * getElementText(); virtual ::javax::xml::stream::events::XMLEvent * nextTag(); virtual ::java::lang::Object * getProperty(::java::lang::String *); virtual void close(); virtual void remove(); public: // actually protected ::javax::xml::stream::XMLStreamReader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) reader; ::javax::xml::stream::util::XMLEventAllocator * allocator; ::java::lang::String * systemId; ::javax::xml::stream::events::XMLEvent * peekEvent; public: static ::java::lang::Class class$; }; #endif // __gnu_xml_stream_XMLEventReaderImpl__
/* * Copyright (c) 2012 Analog Devices, Inc. * Author: Lars-Peter Clausen <lars@metafoo.de> * * 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. */ #include <linux/kernel.h> #include <linux/export.h> #include <linux/module.h> #include <linux/iio/iio.h> #include <linux/iio/buffer.h> #include <linux/iio/kfifo_buf.h> #include <linux/iio/triggered_buffer.h> #include <linux/iio/trigger_consumer.h> static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = { .postenable = &iio_triggered_buffer_postenable, .predisable = &iio_triggered_buffer_predisable, }; /** * iio_triggered_buffer_setup() - Setup triggered buffer and pollfunc * @indio_dev: IIO device structure * @pollfunc_bh: Function which will be used as pollfunc bottom half * @pollfunc_th: Function which will be used as pollfunc top half * @setup_ops: Buffer setup functions to use for this device. * If NULL the default setup functions for triggered * buffers will be used. * * This function combines some common tasks which will normally be performed * when setting up a triggered buffer. It will allocate the buffer and the * pollfunc, as well as register the buffer with the IIO core. * * Before calling this function the indio_dev structure should already be * completely initialized, but not yet registered. In practice this means that * this function should be called right before iio_device_register(). * * To free the resources allocated by this function call * iio_triggered_buffer_cleanup(). */ int iio_triggered_buffer_setup(struct iio_dev *indio_dev, irqreturn_t (*pollfunc_bh)(int irq, void *p), irqreturn_t (*pollfunc_th)(int irq, void *p), const struct iio_buffer_setup_ops *setup_ops) { struct iio_buffer *buffer; int ret; buffer = iio_kfifo_allocate(indio_dev); if (!buffer) { ret = -ENOMEM; goto error_ret; } iio_device_attach_buffer(indio_dev, buffer); indio_dev->pollfunc = iio_alloc_pollfunc(pollfunc_bh, pollfunc_th, IRQF_ONESHOT, indio_dev, "%s_consumer%d", indio_dev->name, indio_dev->id); if (indio_dev->pollfunc == NULL) { ret = -ENOMEM; goto error_kfifo_free; } /* Ring buffer functions - here trigger setup related */ if (setup_ops) indio_dev->setup_ops = setup_ops; else indio_dev->setup_ops = &iio_triggered_buffer_setup_ops; /* Flag that polled ring buffering is possible */ indio_dev->modes |= INDIO_BUFFER_TRIGGERED; ret = iio_buffer_register(indio_dev, indio_dev->channels, indio_dev->num_channels); if (ret) goto error_dealloc_pollfunc; return 0; error_dealloc_pollfunc: iio_dealloc_pollfunc(indio_dev->pollfunc); error_kfifo_free: iio_kfifo_free(indio_dev->buffer); error_ret: return ret; } EXPORT_SYMBOL(iio_triggered_buffer_setup); /** * iio_triggered_buffer_cleanup() - Free resources allocated by iio_triggered_buffer_setup() * @indio_dev: IIO device structure */ void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev) { iio_buffer_unregister(indio_dev); iio_dealloc_pollfunc(indio_dev->pollfunc); iio_kfifo_free(indio_dev->buffer); } EXPORT_SYMBOL(iio_triggered_buffer_cleanup); MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); MODULE_DESCRIPTION("IIO helper functions for setting up triggered buffers"); MODULE_LICENSE("GPL");
#ifndef _LINUX_BLK_MQ_RDMA_H #define _LINUX_BLK_MQ_RDMA_H struct blk_mq_tag_set; struct ib_device; int blk_mq_rdma_map_queues(struct blk_mq_tag_set *set, struct ib_device *dev, int first_vec); #endif /* _LINUX_BLK_MQ_RDMA_H */
extern void abort (void); typedef short __v2hi __attribute ((vector_size(4))); typedef __v2hi fract2x16; typedef short fract16; fract2x16 foo (fract2x16 f, short n) { return __builtin_bfin_shl_fr2x16 (f, n); } int main () { fract2x16 a, t; fract16 t1, t2; a = __builtin_bfin_compose_2x16 (0xcfff, 0xffff); t = foo (a, 4); t1 = __builtin_bfin_extract_hi (t); t2 = __builtin_bfin_extract_lo (t); if (t1 != 0xffff8000 || t2 != 0xfffffff0) abort (); return 0; }
/* @(#)s_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* cos(x) * Return cosine function of x. * * kernel function: * __kernel_sin ... sine function on [-pi/4,pi/4] * __kernel_cos ... cosine function on [-pi/4,pi/4] * __ieee754_rem_pio2 ... argument reduction routine * * Method. * Let S,C and T denote the sin, cos and tan respectively on * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * * n sin(x) cos(x) tan(x) * ---------------------------------------------------------- * 0 S C T * 1 C -S -1/T * 2 -S -C T * 3 -C S -1/T * ---------------------------------------------------------- * * Special cases: * Let trig be any of sin, cos, or tan. * trig(+-INF) is NaN, with signals; * trig(NaN) is that NaN; * * Accuracy: * TRIG(x) returns trig(x) nearly rounded */ #include "fdlibm.h" #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ double cos(double x) #else double cos(x) double x; #endif { double y[2],z=0.0; __int32_t n,ix; /* High word of x. */ GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ ix &= 0x7fffffff; if(ix <= 0x3fe921fb) return __kernel_cos(x,z); /* cos(Inf or NaN) is NaN */ else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ else { n = __ieee754_rem_pio2(x,y); switch(n&3) { case 0: return __kernel_cos(y[0],y[1]); case 1: return -__kernel_sin(y[0],y[1],1); case 2: return -__kernel_cos(y[0],y[1]); default: return __kernel_sin(y[0],y[1],1); } } } #endif /* _DOUBLE_IS_32BITS */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/objects.h> #include <openssl/comp.h> COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) { COMP_CTX *ret; if ((ret = (COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) { /* ZZZZZZZZZZZZZZZZ */ return (NULL); } memset(ret, 0, sizeof(COMP_CTX)); ret->meth = meth; if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { OPENSSL_free(ret); ret = NULL; } return (ret); } void COMP_CTX_free(COMP_CTX *ctx) { if (ctx == NULL) return; if (ctx->meth->finish != NULL) ctx->meth->finish(ctx); OPENSSL_free(ctx); } int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen) { int ret; if (ctx->meth->compress == NULL) { /* ZZZZZZZZZZZZZZZZZ */ return (-1); } ret = ctx->meth->compress(ctx, out, olen, in, ilen); if (ret > 0) { ctx->compress_in += ilen; ctx->compress_out += ret; } return (ret); } int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, unsigned char *in, int ilen) { int ret; if (ctx->meth->expand == NULL) { /* ZZZZZZZZZZZZZZZZZ */ return (-1); } ret = ctx->meth->expand(ctx, out, olen, in, ilen); if (ret > 0) { ctx->expand_in += ilen; ctx->expand_out += ret; } return (ret); }
/* { dg-do run } */ /* { dg-require-effective-target avx } */ /* { dg-options "-O2 -mavx" } */ #define CHECK_H "avx-check.h" #define TEST avx_test #include "sse-movhlps-1.c"
#ifndef NO_LABEL_VALUES x (int i) { void *j[] = {&&x, &&y, &&z}; goto *j[i]; x:return 2; y:return 3; z:return 5; } main () { if (x (0) != 2 || x (1) != 3 || x (2) != 5) abort(); exit(0); } #else main(){ exit (0); } #endif
/* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.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; 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. */ #ifdef CONFIG_BT_MGMT #include "sco_mgmt.h" #elif defined(CONFIG_BT_TIZEN) #include "tizen/sco.h" #else #ifndef __SCO_H #define __SCO_H /* SCO defaults */ #define SCO_DEFAULT_MTU 500 #define SCO_DEFAULT_FLUSH_TO 0xFFFF #define SCO_CONN_TIMEOUT (HZ * 40) #define SCO_DISCONN_TIMEOUT (HZ * 2) #define SCO_CONN_IDLE_TIMEOUT (HZ * 60) /* SCO socket address */ struct sockaddr_sco { sa_family_t sco_family; bdaddr_t sco_bdaddr; __u16 sco_pkt_type; }; /* SCO socket options */ #define SCO_OPTIONS 0x01 struct sco_options { __u16 mtu; }; #define SCO_CONNINFO 0x02 struct sco_conninfo { __u16 hci_handle; __u8 dev_class[3]; }; /* ---- SCO connections ---- */ struct sco_conn { struct hci_conn *hcon; bdaddr_t *dst; bdaddr_t *src; spinlock_t lock; struct sock *sk; unsigned int mtu; }; #define sco_conn_lock(c) spin_lock(&c->lock); #define sco_conn_unlock(c) spin_unlock(&c->lock); /* ----- SCO socket info ----- */ #define sco_pi(sk) ((struct sco_pinfo *) sk) struct sco_pinfo { struct bt_sock bt; __u16 pkt_type; struct sco_conn *conn; }; #endif /* __SCO_H */ #endif /* CONFIG_BT_MGMT */
#ifndef _IPT_OWNER_H #define _IPT_OWNER_H /* match and invert flags */ #define IPT_OWNER_UID 0x01 #define IPT_OWNER_GID 0x02 #define IPT_OWNER_PID 0x04 #define IPT_OWNER_SID 0x08 #define IPT_OWNER_COMM 0x10 struct ipt_owner_info { uid_t uid; gid_t gid; pid_t pid; pid_t sid; char comm[16]; u_int8_t match, invert; /* flags */ }; #endif /*_IPT_OWNER_H*/
#ifndef _VME_BRIDGE_H_ #define _VME_BRIDGE_H_ #include <linux/vme.h> #define VME_CRCSR_BUF_SIZE (508*1024) /* * Resource structures */ struct vme_master_resource { struct list_head list; struct vme_bridge *parent; /* * We are likely to need to access the VME bus in interrupt context, so * protect master routines with a spinlock rather than a mutex. */ spinlock_t lock; int locked; int number; u32 address_attr; u32 cycle_attr; u32 width_attr; struct resource bus_resource; void __iomem *kern_base; }; struct vme_slave_resource { struct list_head list; struct vme_bridge *parent; struct mutex mtx; int locked; int number; u32 address_attr; u32 cycle_attr; }; struct vme_dma_pattern { u32 pattern; u32 type; }; struct vme_dma_pci { dma_addr_t address; }; struct vme_dma_vme { unsigned long long address; u32 aspace; u32 cycle; u32 dwidth; }; struct vme_dma_list { struct list_head list; struct vme_dma_resource *parent; struct list_head entries; struct mutex mtx; }; struct vme_dma_resource { struct list_head list; struct vme_bridge *parent; struct mutex mtx; int locked; int number; struct list_head pending; struct list_head running; u32 route_attr; }; struct vme_lm_resource { struct list_head list; struct vme_bridge *parent; struct mutex mtx; int locked; int number; int monitors; }; struct vme_error_handler { struct list_head list; unsigned long long start; /* Beginning of error window */ unsigned long long end; /* End of error window */ unsigned long long first_error; /* Address of the first error */ u32 aspace; /* Address space of error window*/ unsigned num_errors; /* Number of errors */ }; struct vme_callback { void (*func)(int, int, void*); void *priv_data; }; struct vme_irq { int count; struct vme_callback callback[VME_NUM_STATUSID]; }; /* Allow 16 characters for name (including null character) */ #define VMENAMSIZ 16 /* This structure stores all the information about one bridge * The structure should be dynamically allocated by the driver and one instance * of the structure should be present for each VME chip present in the system. */ struct vme_bridge { char name[VMENAMSIZ]; int num; struct list_head master_resources; struct list_head slave_resources; struct list_head dma_resources; struct list_head lm_resources; /* List for registered errors handlers */ struct list_head vme_error_handlers; /* List of devices on this bridge */ struct list_head devices; /* Bridge Info - XXX Move to private structure? */ struct device *parent; /* Parent device (eg. pdev->dev for PCI) */ void *driver_priv; /* Private pointer for the bridge driver */ struct list_head bus_list; /* list of VME buses */ /* Interrupt callbacks */ struct vme_irq irq[7]; /* Locking for VME irq callback configuration */ struct mutex irq_mtx; /* Slave Functions */ int (*slave_get) (struct vme_slave_resource *, int *, unsigned long long *, unsigned long long *, dma_addr_t *, u32 *, u32 *); int (*slave_set) (struct vme_slave_resource *, int, unsigned long long, unsigned long long, dma_addr_t, u32, u32); /* Master Functions */ int (*master_get) (struct vme_master_resource *, int *, unsigned long long *, unsigned long long *, u32 *, u32 *, u32 *); int (*master_set) (struct vme_master_resource *, int, unsigned long long, unsigned long long, u32, u32, u32); ssize_t (*master_read) (struct vme_master_resource *, void *, size_t, loff_t); ssize_t (*master_write) (struct vme_master_resource *, void *, size_t, loff_t); unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int, unsigned int, unsigned int, loff_t); /* DMA Functions */ int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *, struct vme_dma_attr *, size_t); int (*dma_list_exec) (struct vme_dma_list *); int (*dma_list_empty) (struct vme_dma_list *); /* Interrupt Functions */ void (*irq_set) (struct vme_bridge *, int, int, int); int (*irq_generate) (struct vme_bridge *, int, int); /* Location monitor functions */ int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32); int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *, u32 *); int (*lm_attach)(struct vme_lm_resource *, int, void (*callback)(void *), void *); int (*lm_detach) (struct vme_lm_resource *, int); /* CR/CSR space functions */ int (*slot_get) (struct vme_bridge *); /* Bridge parent interface */ void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *dma); void (*free_consistent)(struct device *dev, size_t size, void *vaddr, dma_addr_t dma); }; void vme_bus_error_handler(struct vme_bridge *bridge, unsigned long long address, int am); void vme_irq_handler(struct vme_bridge *, int, int); struct vme_bridge *vme_init_bridge(struct vme_bridge *); int vme_register_bridge(struct vme_bridge *); void vme_unregister_bridge(struct vme_bridge *); struct vme_error_handler *vme_register_error_handler( struct vme_bridge *bridge, u32 aspace, unsigned long long address, size_t len); void vme_unregister_error_handler(struct vme_error_handler *handler); #endif /* _VME_BRIDGE_H_ */
/* Copyright Rene Rivera 2008-2013 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_PREDEF_OS_AMIGAOS_H #define BOOST_PREDEF_OS_AMIGAOS_H #include <boost/predef/version_number.h> #include <boost/predef/make.h> /*` [heading `BOOST_OS_AMIGAOS`] [@http://en.wikipedia.org/wiki/AmigaOS AmigaOS] operating system. [table [[__predef_symbol__] [__predef_version__]] [[`AMIGA`] [__predef_detection__]] [[`__amigaos__`] [__predef_detection__]] ] */ #define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_NOT_AVAILABLE #if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ defined(AMIGA) || defined(__amigaos__) \ ) # undef BOOST_OS_AMIGAOS # define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_AVAILABLE #endif #if BOOST_OS_AMIGAOS # define BOOST_OS_AMIGAOS_AVAILABLE # include <boost/predef/detail/os_detected.h> #endif #define BOOST_OS_AMIGAOS_NAME "AmigaOS" #include <boost/predef/detail/test.h> BOOST_PREDEF_DECLARE_TEST(BOOST_OS_AMIGAOS,BOOST_OS_AMIGAOS_NAME) #endif
/* * Copyright (c) 2014, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. */ #ifndef _DT_BINDINGS_CLK_APQ_MMCC_8084_H #define _DT_BINDINGS_CLK_APQ_MMCC_8084_H #define MMSS_AHB_CLK_SRC 0 #define MMSS_AXI_CLK_SRC 1 #define MMPLL0 2 #define MMPLL0_VOTE 3 #define MMPLL1 4 #define MMPLL1_VOTE 5 #define MMPLL2 6 #define MMPLL3 7 #define MMPLL4 8 #define CSI0_CLK_SRC 9 #define CSI1_CLK_SRC 10 #define CSI2_CLK_SRC 11 #define CSI3_CLK_SRC 12 #define VCODEC0_CLK_SRC 13 #define VFE0_CLK_SRC 14 #define VFE1_CLK_SRC 15 #define MDP_CLK_SRC 16 #define PCLK0_CLK_SRC 17 #define PCLK1_CLK_SRC 18 #define OCMEMNOC_CLK_SRC 19 #define GFX3D_CLK_SRC 20 #define JPEG0_CLK_SRC 21 #define JPEG1_CLK_SRC 22 #define JPEG2_CLK_SRC 23 #define EDPPIXEL_CLK_SRC 24 #define EXTPCLK_CLK_SRC 25 #define VP_CLK_SRC 26 #define CCI_CLK_SRC 27 #define CAMSS_GP0_CLK_SRC 28 #define CAMSS_GP1_CLK_SRC 29 #define MCLK0_CLK_SRC 30 #define MCLK1_CLK_SRC 31 #define MCLK2_CLK_SRC 32 #define MCLK3_CLK_SRC 33 #define CSI0PHYTIMER_CLK_SRC 34 #define CSI1PHYTIMER_CLK_SRC 35 #define CSI2PHYTIMER_CLK_SRC 36 #define CPP_CLK_SRC 37 #define BYTE0_CLK_SRC 38 #define BYTE1_CLK_SRC 39 #define EDPAUX_CLK_SRC 40 #define EDPLINK_CLK_SRC 41 #define ESC0_CLK_SRC 42 #define ESC1_CLK_SRC 43 #define HDMI_CLK_SRC 44 #define VSYNC_CLK_SRC 45 #define MMSS_RBCPR_CLK_SRC 46 #define RBBMTIMER_CLK_SRC 47 #define MAPLE_CLK_SRC 48 #define VDP_CLK_SRC 49 #define VPU_BUS_CLK_SRC 50 #define MMSS_CXO_CLK 51 #define MMSS_SLEEPCLK_CLK 52 #define AVSYNC_AHB_CLK 53 #define AVSYNC_EDPPIXEL_CLK 54 #define AVSYNC_EXTPCLK_CLK 55 #define AVSYNC_PCLK0_CLK 56 #define AVSYNC_PCLK1_CLK 57 #define AVSYNC_VP_CLK 58 #define CAMSS_AHB_CLK 59 #define CAMSS_CCI_CCI_AHB_CLK 60 #define CAMSS_CCI_CCI_CLK 61 #define CAMSS_CSI0_AHB_CLK 62 #define CAMSS_CSI0_CLK 63 #define CAMSS_CSI0PHY_CLK 64 #define CAMSS_CSI0PIX_CLK 65 #define CAMSS_CSI0RDI_CLK 66 #define CAMSS_CSI1_AHB_CLK 67 #define CAMSS_CSI1_CLK 68 #define CAMSS_CSI1PHY_CLK 69 #define CAMSS_CSI1PIX_CLK 70 #define CAMSS_CSI1RDI_CLK 71 #define CAMSS_CSI2_AHB_CLK 72 #define CAMSS_CSI2_CLK 73 #define CAMSS_CSI2PHY_CLK 74 #define CAMSS_CSI2PIX_CLK 75 #define CAMSS_CSI2RDI_CLK 76 #define CAMSS_CSI3_AHB_CLK 77 #define CAMSS_CSI3_CLK 78 #define CAMSS_CSI3PHY_CLK 79 #define CAMSS_CSI3PIX_CLK 80 #define CAMSS_CSI3RDI_CLK 81 #define CAMSS_CSI_VFE0_CLK 82 #define CAMSS_CSI_VFE1_CLK 83 #define CAMSS_GP0_CLK 84 #define CAMSS_GP1_CLK 85 #define CAMSS_ISPIF_AHB_CLK 86 #define CAMSS_JPEG_JPEG0_CLK 87 #define CAMSS_JPEG_JPEG1_CLK 88 #define CAMSS_JPEG_JPEG2_CLK 89 #define CAMSS_JPEG_JPEG_AHB_CLK 90 #define CAMSS_JPEG_JPEG_AXI_CLK 91 #define CAMSS_MCLK0_CLK 92 #define CAMSS_MCLK1_CLK 93 #define CAMSS_MCLK2_CLK 94 #define CAMSS_MCLK3_CLK 95 #define CAMSS_MICRO_AHB_CLK 96 #define CAMSS_PHY0_CSI0PHYTIMER_CLK 97 #define CAMSS_PHY1_CSI1PHYTIMER_CLK 98 #define CAMSS_PHY2_CSI2PHYTIMER_CLK 99 #define CAMSS_TOP_AHB_CLK 100 #define CAMSS_VFE_CPP_AHB_CLK 101 #define CAMSS_VFE_CPP_CLK 102 #define CAMSS_VFE_VFE0_CLK 103 #define CAMSS_VFE_VFE1_CLK 104 #define CAMSS_VFE_VFE_AHB_CLK 105 #define CAMSS_VFE_VFE_AXI_CLK 106 #define MDSS_AHB_CLK 107 #define MDSS_AXI_CLK 108 #define MDSS_BYTE0_CLK 109 #define MDSS_BYTE1_CLK 110 #define MDSS_EDPAUX_CLK 111 #define MDSS_EDPLINK_CLK 112 #define MDSS_EDPPIXEL_CLK 113 #define MDSS_ESC0_CLK 114 #define MDSS_ESC1_CLK 115 #define MDSS_EXTPCLK_CLK 116 #define MDSS_HDMI_AHB_CLK 117 #define MDSS_HDMI_CLK 118 #define MDSS_MDP_CLK 119 #define MDSS_MDP_LUT_CLK 120 #define MDSS_PCLK0_CLK 121 #define MDSS_PCLK1_CLK 122 #define MDSS_VSYNC_CLK 123 #define MMSS_RBCPR_AHB_CLK 124 #define MMSS_RBCPR_CLK 125 #define MMSS_SPDM_AHB_CLK 126 #define MMSS_SPDM_AXI_CLK 127 #define MMSS_SPDM_CSI0_CLK 128 #define MMSS_SPDM_GFX3D_CLK 129 #define MMSS_SPDM_JPEG0_CLK 130 #define MMSS_SPDM_JPEG1_CLK 131 #define MMSS_SPDM_JPEG2_CLK 132 #define MMSS_SPDM_MDP_CLK 133 #define MMSS_SPDM_PCLK0_CLK 134 #define MMSS_SPDM_PCLK1_CLK 135 #define MMSS_SPDM_VCODEC0_CLK 136 #define MMSS_SPDM_VFE0_CLK 137 #define MMSS_SPDM_VFE1_CLK 138 #define MMSS_SPDM_RM_AXI_CLK 139 #define MMSS_SPDM_RM_OCMEMNOC_CLK 140 #define MMSS_MISC_AHB_CLK 141 #define MMSS_MMSSNOC_AHB_CLK 142 #define MMSS_MMSSNOC_BTO_AHB_CLK 143 #define MMSS_MMSSNOC_AXI_CLK 144 #define MMSS_S0_AXI_CLK 145 #define OCMEMCX_AHB_CLK 146 #define OCMEMCX_OCMEMNOC_CLK 147 #define OXILI_OCMEMGX_CLK 148 #define OXILI_GFX3D_CLK 149 #define OXILI_RBBMTIMER_CLK 150 #define OXILICX_AHB_CLK 151 #define VENUS0_AHB_CLK 152 #define VENUS0_AXI_CLK 153 #define VENUS0_CORE0_VCODEC_CLK 154 #define VENUS0_CORE1_VCODEC_CLK 155 #define VENUS0_OCMEMNOC_CLK 156 #define VENUS0_VCODEC0_CLK 157 #define VPU_AHB_CLK 158 #define VPU_AXI_CLK 159 #define VPU_BUS_CLK 160 #define VPU_CXO_CLK 161 #define VPU_MAPLE_CLK 162 #define VPU_SLEEP_CLK 163 #define VPU_VDP_CLK 164 /* GDSCs */ #define VENUS0_GDSC 0 #define VENUS0_CORE0_GDSC 1 #define VENUS0_CORE1_GDSC 2 #define MDSS_GDSC 3 #define CAMSS_JPEG_GDSC 4 #define CAMSS_VFE_GDSC 5 #define OXILI_GDSC 6 #define OXILICX_GDSC 7 #endif
/* * Copyright (c) 2014 Patrick McHardy <kaber@trash.net> * * 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. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h> #include <linux/netlink.h> #include <linux/netfilter.h> #include <linux/netfilter/nf_tables.h> #include <net/netfilter/nf_tables.h> #include <net/netfilter/nft_reject.h> #include <net/netfilter/ipv4/nf_reject.h> #include <net/netfilter/ipv6/nf_reject.h> static void nft_reject_inet_eval(const struct nft_expr *expr, struct nft_data data[NFT_REG_MAX + 1], const struct nft_pktinfo *pkt) { struct nft_reject *priv = nft_expr_priv(expr); struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); switch (pkt->ops->pf) { case NFPROTO_IPV4: switch (priv->type) { case NFT_REJECT_ICMP_UNREACH: nf_send_unreach(pkt->skb, priv->icmp_code); break; case NFT_REJECT_TCP_RST: nf_send_reset(pkt->skb, pkt->ops->hooknum); break; case NFT_REJECT_ICMPX_UNREACH: nf_send_unreach(pkt->skb, nft_reject_icmp_code(priv->icmp_code)); break; } break; case NFPROTO_IPV6: switch (priv->type) { case NFT_REJECT_ICMP_UNREACH: nf_send_unreach6(net, pkt->skb, priv->icmp_code, pkt->ops->hooknum); break; case NFT_REJECT_TCP_RST: nf_send_reset6(net, pkt->skb, pkt->ops->hooknum); break; case NFT_REJECT_ICMPX_UNREACH: nf_send_unreach6(net, pkt->skb, nft_reject_icmpv6_code(priv->icmp_code), pkt->ops->hooknum); break; } break; } data[NFT_REG_VERDICT].verdict = NF_DROP; } static int nft_reject_inet_init(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nlattr * const tb[]) { struct nft_reject *priv = nft_expr_priv(expr); int icmp_code; if (tb[NFTA_REJECT_TYPE] == NULL) return -EINVAL; priv->type = ntohl(nla_get_be32(tb[NFTA_REJECT_TYPE])); switch (priv->type) { case NFT_REJECT_ICMP_UNREACH: case NFT_REJECT_ICMPX_UNREACH: if (tb[NFTA_REJECT_ICMP_CODE] == NULL) return -EINVAL; icmp_code = nla_get_u8(tb[NFTA_REJECT_ICMP_CODE]); if (priv->type == NFT_REJECT_ICMPX_UNREACH && icmp_code > NFT_REJECT_ICMPX_MAX) return -EINVAL; priv->icmp_code = icmp_code; break; case NFT_REJECT_TCP_RST: break; default: return -EINVAL; } return 0; } static int nft_reject_inet_dump(struct sk_buff *skb, const struct nft_expr *expr) { const struct nft_reject *priv = nft_expr_priv(expr); if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type))) goto nla_put_failure; switch (priv->type) { case NFT_REJECT_ICMP_UNREACH: case NFT_REJECT_ICMPX_UNREACH: if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) goto nla_put_failure; break; } return 0; nla_put_failure: return -1; } static struct nft_expr_type nft_reject_inet_type; static const struct nft_expr_ops nft_reject_inet_ops = { .type = &nft_reject_inet_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_reject)), .eval = nft_reject_inet_eval, .init = nft_reject_inet_init, .dump = nft_reject_inet_dump, }; static struct nft_expr_type nft_reject_inet_type __read_mostly = { .family = NFPROTO_INET, .name = "reject", .ops = &nft_reject_inet_ops, .policy = nft_reject_policy, .maxattr = NFTA_REJECT_MAX, .owner = THIS_MODULE, }; static int __init nft_reject_inet_module_init(void) { return nft_register_expr(&nft_reject_inet_type); } static void __exit nft_reject_inet_module_exit(void) { nft_unregister_expr(&nft_reject_inet_type); } module_init(nft_reject_inet_module_init); module_exit(nft_reject_inet_module_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); MODULE_ALIAS_NFT_AF_EXPR(1, "reject");
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __MTD_NFTL_USER_H__ #define __MTD_NFTL_USER_H__ #include <linux/types.h> /* Block Control Information */ struct nftl_bci { unsigned char ECCSig[6]; __u8 Status; __u8 Status1; }__attribute__((packed)); /* Unit Control Information */ struct nftl_uci0 { __u16 VirtUnitNum; __u16 ReplUnitNum; __u16 SpareVirtUnitNum; __u16 SpareReplUnitNum; } __attribute__((packed)); struct nftl_uci1 { __u32 WearInfo; __u16 EraseMark; __u16 EraseMark1; } __attribute__((packed)); struct nftl_uci2 { __u16 FoldMark; __u16 FoldMark1; __u32 unused; } __attribute__((packed)); union nftl_uci { struct nftl_uci0 a; struct nftl_uci1 b; struct nftl_uci2 c; }; struct nftl_oob { struct nftl_bci b; union nftl_uci u; }; /* NFTL Media Header */ struct NFTLMediaHeader { char DataOrgID[6]; __u16 NumEraseUnits; __u16 FirstPhysicalEUN; __u32 FormattedSize; unsigned char UnitSizeFactor; } __attribute__((packed)); #define MAX_ERASE_ZONES (8192 - 512) #define ERASE_MARK 0x3c69 #define SECTOR_FREE 0xff #define SECTOR_USED 0x55 #define SECTOR_IGNORE 0x11 #define SECTOR_DELETED 0x00 #define FOLD_MARK_IN_PROGRESS 0x5555 #define ZONE_GOOD 0xff #define ZONE_BAD_ORIGINAL 0 #define ZONE_BAD_MARKED 7 #endif /* __MTD_NFTL_USER_H__ */
/* * Clock driver for the ARM Integrator/IM-PD1 board * Copyright (C) 2012-2013 Linus Walleij * * 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. */ #include <linux/clk-provider.h> #include <linux/clk.h> #include <linux/clkdev.h> #include <linux/err.h> #include <linux/io.h> #include <linux/platform_data/clk-integrator.h> #include <mach/impd1.h> #include "clk-icst.h" struct impd1_clk { char *vco1name; struct clk *vco1clk; char *vco2name; struct clk *vco2clk; struct clk *mmciclk; char *uartname; struct clk *uartclk; char *spiname; struct clk *spiclk; char *scname; struct clk *scclk; struct clk_lookup *clks[6]; }; /* One entry for each connected IM-PD1 LM */ static struct impd1_clk impd1_clks[4]; /* * There are two VCO's on the IM-PD1 */ static const struct icst_params impd1_vco1_params = { .ref = 24000000, /* 24 MHz */ .vco_max = ICST525_VCO_MAX_3V, .vco_min = ICST525_VCO_MIN, .vd_min = 12, .vd_max = 519, .rd_min = 3, .rd_max = 120, .s2div = icst525_s2div, .idx2s = icst525_idx2s, }; static const struct clk_icst_desc impd1_icst1_desc = { .params = &impd1_vco1_params, .vco_offset = IMPD1_OSC1, .lock_offset = IMPD1_LOCK, }; static const struct icst_params impd1_vco2_params = { .ref = 24000000, /* 24 MHz */ .vco_max = ICST525_VCO_MAX_3V, .vco_min = ICST525_VCO_MIN, .vd_min = 12, .vd_max = 519, .rd_min = 3, .rd_max = 120, .s2div = icst525_s2div, .idx2s = icst525_idx2s, }; static const struct clk_icst_desc impd1_icst2_desc = { .params = &impd1_vco2_params, .vco_offset = IMPD1_OSC2, .lock_offset = IMPD1_LOCK, }; /** * integrator_impd1_clk_init() - set up the integrator clock tree * @base: base address of the logic module (LM) * @id: the ID of this LM */ void integrator_impd1_clk_init(void __iomem *base, unsigned int id) { struct impd1_clk *imc; struct clk *clk; int i; if (id > 3) { pr_crit("no more than 4 LMs can be attached\n"); return; } imc = &impd1_clks[id]; imc->vco1name = kasprintf(GFP_KERNEL, "lm%x-vco1", id); clk = icst_clk_register(NULL, &impd1_icst1_desc, imc->vco1name, base); imc->vco1clk = clk; imc->clks[0] = clkdev_alloc(clk, NULL, "lm%x:01000", id); /* VCO2 is also called "CLK2" */ imc->vco2name = kasprintf(GFP_KERNEL, "lm%x-vco2", id); clk = icst_clk_register(NULL, &impd1_icst2_desc, imc->vco2name, base); imc->vco2clk = clk; /* MMCI uses CLK2 right off */ imc->clks[1] = clkdev_alloc(clk, NULL, "lm%x:00700", id); /* UART reference clock divides CLK2 by a fixed factor 4 */ imc->uartname = kasprintf(GFP_KERNEL, "lm%x-uartclk", id); clk = clk_register_fixed_factor(NULL, imc->uartname, imc->vco2name, CLK_IGNORE_UNUSED, 1, 4); imc->uartclk = clk; imc->clks[2] = clkdev_alloc(clk, NULL, "lm%x:00100", id); imc->clks[3] = clkdev_alloc(clk, NULL, "lm%x:00200", id); /* SPI PL022 clock divides CLK2 by a fixed factor 64 */ imc->spiname = kasprintf(GFP_KERNEL, "lm%x-spiclk", id); clk = clk_register_fixed_factor(NULL, imc->spiname, imc->vco2name, CLK_IGNORE_UNUSED, 1, 64); imc->clks[4] = clkdev_alloc(clk, NULL, "lm%x:00300", id); /* Smart Card clock divides CLK2 by a fixed factor 4 */ imc->scname = kasprintf(GFP_KERNEL, "lm%x-scclk", id); clk = clk_register_fixed_factor(NULL, imc->scname, imc->vco2name, CLK_IGNORE_UNUSED, 1, 4); imc->scclk = clk; imc->clks[5] = clkdev_alloc(clk, NULL, "lm%x:00600", id); for (i = 0; i < ARRAY_SIZE(imc->clks); i++) clkdev_add(imc->clks[i]); } void integrator_impd1_clk_exit(unsigned int id) { int i; struct impd1_clk *imc; if (id > 3) return; imc = &impd1_clks[id]; for (i = 0; i < ARRAY_SIZE(imc->clks); i++) clkdev_drop(imc->clks[i]); clk_unregister(imc->spiclk); clk_unregister(imc->uartclk); clk_unregister(imc->vco2clk); clk_unregister(imc->vco1clk); kfree(imc->scname); kfree(imc->spiname); kfree(imc->uartname); kfree(imc->vco2name); kfree(imc->vco1name); }
/* * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology * Author: Wu Zhangjin, wuzj@lemote.com * * Copyright (c) 2009 Zhang Le <r0bertz@gentoo.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/errno.h> #include <asm/bootinfo.h> #include <loongson.h> #include <machine.h> static const char *system_types[] = { [MACH_LOONGSON_UNKNOWN] "unknown loongson machine", [MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box", [MACH_LEMOTE_FL2F] "lemote-fuloong-2f-box", [MACH_LEMOTE_ML2F7] "lemote-mengloong-2f-7inches", [MACH_LEMOTE_YL2F89] "lemote-yeeloong-2f-8.9inches", [MACH_DEXXON_GDIUM2F10] "dexxon-gidum-2f-10inches", [MACH_LOONGSON_END] NULL, }; const char *get_system_type(void) { if (mips_machtype == MACH_UNKNOWN) mips_machtype = LOONGSON_MACHTYPE; return system_types[mips_machtype]; } static __init int machtype_setup(char *str) { int machtype = MACH_LEMOTE_FL2E; if (!str) return -EINVAL; for (; system_types[machtype]; machtype++) if (strstr(system_types[machtype], str)) { mips_machtype = machtype; break; } return 0; } __setup("machtype=", machtype_setup);
/* * 1-Wire implementation for the ds2760 chip * * Copyright © 2004-2005, Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> * * Use consistent with the GNU GPL is permitted, * provided that this copyright notice is * preserved in its entirety in all copies and derived works. * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> #include <linux/types.h> #include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/idr.h> #include <linux/gfp.h> #include "../w1.h" #include "../w1_int.h" #include "../w1_family.h" #include "w1_ds2760.h" static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, int io) { struct w1_slave *sl = container_of(dev, struct w1_slave, dev); if (!dev) return 0; mutex_lock(&sl->master->bus_mutex); if (addr > DS2760_DATA_SIZE || addr < 0) { count = 0; goto out; } if (addr + count > DS2760_DATA_SIZE) count = DS2760_DATA_SIZE - addr; if (!w1_reset_select_slave(sl)) { if (!io) { w1_write_8(sl->master, W1_DS2760_READ_DATA); w1_write_8(sl->master, addr); count = w1_read_block(sl->master, buf, count); } else { w1_write_8(sl->master, W1_DS2760_WRITE_DATA); w1_write_8(sl->master, addr); w1_write_block(sl->master, buf, count); /* XXX w1_write_block returns void, not n_written */ } } out: mutex_unlock(&sl->master->bus_mutex); return count; } int w1_ds2760_read(struct device *dev, char *buf, int addr, size_t count) { return w1_ds2760_io(dev, buf, addr, count, 0); } int w1_ds2760_write(struct device *dev, char *buf, int addr, size_t count) { return w1_ds2760_io(dev, buf, addr, count, 1); } static int w1_ds2760_eeprom_cmd(struct device *dev, int addr, int cmd) { struct w1_slave *sl = container_of(dev, struct w1_slave, dev); if (!dev) return -EINVAL; mutex_lock(&sl->master->bus_mutex); if (w1_reset_select_slave(sl) == 0) { w1_write_8(sl->master, cmd); w1_write_8(sl->master, addr); } mutex_unlock(&sl->master->bus_mutex); return 0; } int w1_ds2760_store_eeprom(struct device *dev, int addr) { return w1_ds2760_eeprom_cmd(dev, addr, W1_DS2760_COPY_DATA); } int w1_ds2760_recall_eeprom(struct device *dev, int addr) { return w1_ds2760_eeprom_cmd(dev, addr, W1_DS2760_RECALL_DATA); } static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); return w1_ds2760_read(dev, buf, off, count); } static BIN_ATTR_RO(w1_slave, DS2760_DATA_SIZE); static struct bin_attribute *w1_ds2760_bin_attrs[] = { &bin_attr_w1_slave, NULL, }; static const struct attribute_group w1_ds2760_group = { .bin_attrs = w1_ds2760_bin_attrs, }; static const struct attribute_group *w1_ds2760_groups[] = { &w1_ds2760_group, NULL, }; static DEFINE_IDA(bat_ida); static int w1_ds2760_add_slave(struct w1_slave *sl) { int ret; int id; struct platform_device *pdev; id = ida_simple_get(&bat_ida, 0, 0, GFP_KERNEL); if (id < 0) { ret = id; goto noid; } pdev = platform_device_alloc("ds2760-battery", id); if (!pdev) { ret = -ENOMEM; goto pdev_alloc_failed; } pdev->dev.parent = &sl->dev; ret = platform_device_add(pdev); if (ret) goto pdev_add_failed; dev_set_drvdata(&sl->dev, pdev); goto success; pdev_add_failed: platform_device_put(pdev); pdev_alloc_failed: ida_simple_remove(&bat_ida, id); noid: success: return ret; } static void w1_ds2760_remove_slave(struct w1_slave *sl) { struct platform_device *pdev = dev_get_drvdata(&sl->dev); int id = pdev->id; platform_device_unregister(pdev); ida_simple_remove(&bat_ida, id); } static struct w1_family_ops w1_ds2760_fops = { .add_slave = w1_ds2760_add_slave, .remove_slave = w1_ds2760_remove_slave, .groups = w1_ds2760_groups, }; static struct w1_family w1_ds2760_family = { .fid = W1_FAMILY_DS2760, .fops = &w1_ds2760_fops, }; static int __init w1_ds2760_init(void) { pr_info("1-Wire driver for the DS2760 battery monitor chip - (c) 2004-2005, Szabolcs Gyurko\n"); ida_init(&bat_ida); return w1_register_family(&w1_ds2760_family); } static void __exit w1_ds2760_exit(void) { w1_unregister_family(&w1_ds2760_family); ida_destroy(&bat_ida); } EXPORT_SYMBOL(w1_ds2760_read); EXPORT_SYMBOL(w1_ds2760_write); EXPORT_SYMBOL(w1_ds2760_store_eeprom); EXPORT_SYMBOL(w1_ds2760_recall_eeprom); module_init(w1_ds2760_init); module_exit(w1_ds2760_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>"); MODULE_DESCRIPTION("1-wire Driver Dallas 2760 battery monitor chip"); MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_DS2760));
// SPDX-License-Identifier: GPL-2.0-only #define TEST \ memcmp(small, large, sizeof(small) + 1) #include "test_fortify.h"
/* ISC license. */ #ifndef S6_ACCESSRULES_H #define S6_ACCESSRULES_H #include <sys/types.h> #include <skalibs/cdb.h> #include <skalibs/stralloc.h> #include <skalibs/ip46.h> typedef struct uidgid_s uidgid_t, *uidgid_t_ref ; struct uidgid_s { uid_t left ; gid_t right ; } ; typedef struct s6_accessrules_params_s s6_accessrules_params_t, *s6_accessrules_params_t_ref ; struct s6_accessrules_params_s { stralloc env ; stralloc exec ; } ; #define S6_ACCESSRULES_PARAMS_ZERO { .env = STRALLOC_ZERO, .exec = STRALLOC_ZERO } extern void s6_accessrules_params_free (s6_accessrules_params_t *) ; typedef enum s6_accessrules_result_e s6_accessrules_result_t, *s6_accessrules_result_t_ref ; enum s6_accessrules_result_e { S6_ACCESSRULES_ERROR = -1, S6_ACCESSRULES_DENY = 0, S6_ACCESSRULES_ALLOW = 1, S6_ACCESSRULES_NOTFOUND = 2 } ; typedef s6_accessrules_result_t s6_accessrules_backend_func (char const *, size_t, void const *, s6_accessrules_params_t *) ; typedef s6_accessrules_backend_func *s6_accessrules_backend_func_ref ; extern s6_accessrules_backend_func s6_accessrules_backend_fs ; extern s6_accessrules_backend_func s6_accessrules_backend_cdb ; typedef s6_accessrules_result_t s6_accessrules_keycheck_func (void const *, void const *, s6_accessrules_params_t *, s6_accessrules_backend_func_ref) ; typedef s6_accessrules_keycheck_func *s6_accessrules_keycheck_func_ref ; extern s6_accessrules_keycheck_func s6_accessrules_keycheck_uidgid ; extern s6_accessrules_keycheck_func s6_accessrules_keycheck_ip4 ; extern s6_accessrules_keycheck_func s6_accessrules_keycheck_ip6 ; extern s6_accessrules_keycheck_func s6_accessrules_keycheck_reversedns ; #define s6_accessrules_keycheck_ip46(key, data, params, f) (ip46_is6((ip46 const *)(key)) ? s6_accessrules_keycheck_ip6(((ip46 const *)(key))->ip, data, params, f) : s6_accessrules_keycheck_ip4(((ip46 const *)(key))->ip, data, params, f)) extern s6_accessrules_result_t s6_accessrules_uidgid_cdb (uid_t, gid_t, cdb const *, s6_accessrules_params_t *) ; extern s6_accessrules_result_t s6_accessrules_uidgid_fs (uid_t, gid_t, char const *, s6_accessrules_params_t *) ; #define s6_accessrules_ip4_cdb(ip4, c, params) s6_accessrules_keycheck_ip4(ip4, c, (params), &s6_accessrules_backend_cdb) #define s6_accessrules_ip4_fs(ip4, rulesdir, params) s6_accessrules_keycheck_ip4(ip4, rulesdir, (params), &s6_accessrules_backend_fs) #define s6_accessrules_ip6_cdb(ip6, c, params) s6_accessrules_keycheck_ip6(ip6, c, (params), &s6_accessrules_backend_cdb) #define s6_accessrules_ip6_fs(ip6, rulesdir, params) s6_accessrules_keycheck_ip6(ip6, rulesdir, (params), &s6_accessrules_backend_fs) #define s6_accessrules_ip46_cdb(ip, c, params) s6_accessrules_keycheck_ip46(ip, c, (params), &s6_accessrules_backend_cdb) #define s6_accessrules_ip46_fs(ip, rulesdir, params) s6_accessrules_keycheck_ip46(ip, rulesdir, (params), &s6_accessrules_backend_fs) #define s6_accessrules_reversedns_cdb(name, c, params) s6_accessrules_keycheck_reversedns(name, c, (params), &s6_accessrules_backend_cdb) #define s6_accessrules_reversedns_fs(name, c, params) s6_accessrules_keycheck_reversedns(name, c, (params), &s6_accessrules_backend_fs) #endif
/* See LICENSE file for copyright and license details. */ #include <check.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include "../src/processmanager.h" #include "../src/util.h" #include "tests.h" #define PATH_TEMPLATE "/tmp/processmanager.XXXXXX" static struct { const char *executable_path; char *executable_name; int exit_status; } spawn_testtable[] = { { "/bin/true", "true", 0 }, { "/bin/false", "false", EXIT_FAILURE }, { "/foo/bar", "bar", EXIT_FAILURE }, }; START_TEST(test_processmanager_spawn) { struct processmanager pm; char * const args[] = { spawn_testtable[_i].executable_name, NULL }; pid_t pid; int status; processmanager_init(&pm); int ret = processmanager_spawn(&pm, spawn_testtable[_i].executable_path, args, NULL, NULL, &pid); ck_assert_int_eq(ret, 0); ck_assert(processmanager_waitpid(&pm, pid, &status) == pid); ck_assert(WIFEXITED(status)); ck_assert(WEXITSTATUS(status) == spawn_testtable[_i].exit_status); processmanager_destroy(&pm); } END_TEST START_TEST(test_processmanager_tmpdircleanup) { struct processmanager pm; char * const args[] = { "true", NULL }; pid_t pid; int status; struct stat buf; char path[] = PATH_TEMPLATE; ck_assert(mkdtemp(path) != NULL); processmanager_init(&pm); int ret = processmanager_spawn(&pm, "/bin/true", args, path, NULL, &pid); assert_oom_cleanup(ret != ENOMEM, processmanager_destroy(&pm), remove_directory_recursively(path)); ck_assert_int_eq(ret, 0); ck_assert_int_eq(stat(path, &buf), 0); ck_assert(processmanager_waitpid(&pm, pid, &status) == pid); ck_assert_int_eq(stat(path, &buf), -1); processmanager_destroy(&pm); } END_TEST Suite *processmanager_suite(void) { Suite *suite; TCase *tcase; suite = suite_create("ProcessManager"); tcase = tcase_create("Core"); tcase_add_loop_test(tcase, test_processmanager_spawn, 0, sizeof(spawn_testtable)/sizeof(spawn_testtable[0])); tcase_add_test(tcase, test_processmanager_tmpdircleanup); suite_add_tcase(suite, tcase); return suite; }
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SYS_REFCOUNT_H #define _SYS_REFCOUNT_H #include <sys/inttypes.h> #include <sys/list.h> #include <sys/zfs_context.h> #ifdef __cplusplus extern "C" { #endif /* * If the reference is held only by the calling function and not any * particular object, use FTAG (which is a string) for the holder_tag. * Otherwise, use the object that holds the reference. */ #define FTAG ((char *)__func__) #if defined(DEBUG) || !defined(_KERNEL) typedef struct reference { list_node_t ref_link; const void *ref_holder; uint64_t ref_number; uint8_t *ref_removed; } reference_t; typedef struct refcount { kmutex_t rc_mtx; list_t rc_list; list_t rc_removed; int64_t rc_count; int64_t rc_removed_count; } refcount_t; /* Note: refcount_t must be initialized with refcount_create() */ void refcount_create(refcount_t *rc); void refcount_destroy(refcount_t *rc); void refcount_destroy_many(refcount_t *rc, uint64_t number); int refcount_is_zero(refcount_t *rc); int64_t refcount_count(refcount_t *rc); int64_t refcount_add(refcount_t *rc, const const void *holder_tag); int64_t refcount_remove(refcount_t *rc, const void *holder_tag); int64_t refcount_add_many(refcount_t *rc, uint64_t number, const void *holder_tag); int64_t refcount_remove_many(refcount_t *rc, uint64_t number, const void *holder_tag); void refcount_init(void); void refcount_fini(void); #else /* DEBUG */ typedef struct refcount { uint64_t rc_count; } refcount_t; #define refcount_create(rc) ((rc)->rc_count = 0) #define refcount_destroy(rc) ((rc)->rc_count = 0) #define refcount_destroy_many(rc, number) ((rc)->rc_count = 0) #define refcount_is_zero(rc) ((rc)->rc_count == 0) #define refcount_count(rc) ((rc)->rc_count) #define refcount_add(rc, holder) atomic_add_64_nv(&(rc)->rc_count, 1) #define refcount_remove(rc, holder) atomic_add_64_nv(&(rc)->rc_count, -1) #define refcount_add_many(rc, number, holder) \ atomic_add_64_nv(&(rc)->rc_count, number) #define refcount_remove_many(rc, number, holder) \ atomic_add_64_nv(&(rc)->rc_count, -number) #define refcount_transfer(dst, src) { \ uint64_t __tmp = (src)->rc_count; \ atomic_add_64(&(src)->rc_count, -__tmp); \ atomic_add_64(&(dst)->rc_count, __tmp); \ } #define refcount_init() #define refcount_fini() #endif /* DEBUG */ #ifdef __cplusplus } #endif #endif /* _SYS_REFCOUNT_H */
/* Copyright (c) 2020 Dennis Wölfing * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, 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. */ /* libc/src/wchar/wcscpy.c * Copy a wide character string. */ #include <wchar.h> wchar_t* wcscpy(wchar_t* restrict dest, const wchar_t* restrict src) { size_t i; for (i = 0; src[i]; i++) { dest[i] = src[i]; } dest[i] = '\0'; return dest; }
/* * MyContactListener.h * Tan Chess * * Created by Blue Bitch on 10-12-6. * Copyright 2010 __MyCompanyName__. All rights reserved. * */ #import "Box2D.h" #import <vector> #import <algorithm> #import "SimpleAudioEngine.h" #import "ChessmanSprite.h" struct MyContact { b2Fixture *fixtureA; b2Fixture *fixtureB; bool operator == (const MyContact& other) const { return (fixtureA == other.fixtureA) && (fixtureB == other.fixtureB); } }; class MyContactListener : public b2ContactListener { protected: b2Fixture *_hingeFixtureA; b2Fixture *_hingeFixtureB; bool _bodyAMove; bool _bodyBMove; b2Vec2 _waitingPos; protected: void resetImpulse( b2Body *bodyA, b2Body *bodyB ); void SetContactLock( b2Contact* contact ); void SetContactUnlock( b2Contact* contact ); public: //std::vector<MyContact>_contacts; void SetHingeFixture(b2Fixture *fixtureA, b2Fixture *fixtureB); virtual void BeginContact(b2Contact* contact); virtual void EndContact(b2Contact* contact); virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold); virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse); virtual void resetImpulsePlugin(b2Body *bodyA, b2Body *bodyB); virtual void showExplosion(CGPoint pos, float scale); virtual void addUpdateChessman(b2Contact* contact); public: bool _isResetImpulseLock; std::vector<ChessmanSprite *> _vContactChessman; };
// File created: 2012-10-06 18:42:52 #ifndef TAP_H #define TAP_H #include <stdbool.h> #include <stdio.h> #include <mush/cell.h> void tap_n(int); void tap_ok (const char*); void tap_not_ok(const char*); void tap_skip (const char*); void tap_skip_remaining(const char*); void tap_bool(bool, const char*, const char*); // TAP EQual Cells with custom message Strings void tap_eqcs (mushcell, mushcell, const char*, const char*); void tap_eqc93s(mushcell93, mushcell93, const char*, const char*); // TAP EQual Cell Vectors with custom message Strings void tap_eqcvs(const mushcell*, const mushcell*, uint8_t, const char*, const char*); void tap_eqc93vs(const mushcell93*, const mushcell93*, uint8_t, const char*, const char*); // Less than or EQual void tap_leqcvs(const mushcell*, const mushcell*, uint8_t, const char*, const char*); void tap_leqc93vs(const mushcell93*, const mushcell93*, uint8_t, const char*, const char*); // Greater than or EQual void tap_geqcvs(const mushcell*, const mushcell*, uint8_t, const char*, const char*); void tap_geqc93vs(const mushcell93*, const mushcell93*, uint8_t, const char*, const char*); #define tap_eqc93(a, b) tap_eqc93s((a), (b), #a " == " #b, #a " != " #b) #if defined(MUSHSPACE_93) && MUSHSPACE_93 #define tap_eqc tap_eqc93 #define tap_eqcs tap_eqc93s // TAP EQual COordinates with custom message Strings #define tap_eqcos(a, b, so, sn) \ tap_eqc93vs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #define tap_leqcos(a, b, so, sn) \ tap_leqc93vs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #define tap_geqcos(a, b, so, sn) \ tap_leqc93vs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #else #define tap_eqc(a, b) tap_eqcs((a), (b), #a " == " #b, #a " != " #b) #define tap_eqcos(a, b, so, sn) \ tap_eqcvs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #define tap_leqcos(a, b, so, sn) \ tap_leqcvs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #define tap_geqcos(a, b, so, sn) \ tap_geqcvs((a).v, (b).v, MUSHSPACE_DIM, (so), (sn)) #endif #define tap_eqco(a, b) tap_eqcos(a, b, #a " == " #b, #a " != " #b) #endif
// -*- mode: ObjC -*- // This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files. // Copyright (C) 1997-1998, 2000-2001, 2004-2013 Steve Nygard. @protocol CDTypeControllerDelegate; @class CDClassDump, CDType, CDTypeFormatter; @interface CDTypeController : NSObject - (id)initWithClassDump:(CDClassDump *)classDump; @property (weak) id <CDTypeControllerDelegate> delegate; @property (readonly) CDTypeFormatter *ivarTypeFormatter; @property (readonly) CDTypeFormatter *methodTypeFormatter; @property (readonly) CDTypeFormatter *propertyTypeFormatter; @property (readonly) CDTypeFormatter *structDeclarationTypeFormatter; @property (nonatomic, readonly) BOOL shouldShowIvarOffsets; @property (nonatomic, readonly) BOOL shouldShowMethodAddresses; @property (nonatomic, readonly) BOOL targetArchUses64BitABI; @property (nonatomic, assign) BOOL hasUnknownFunctionPointers; @property (nonatomic, assign) BOOL hasUnknownBlocks; - (CDType *)typeFormatter:(CDTypeFormatter *)typeFormatter replacementForType:(CDType *)type; - (NSString *)typeFormatter:(CDTypeFormatter *)typeFormatter typedefNameForStructure:(CDType *)structureType level:(NSUInteger)level; - (void)typeFormatter:(CDTypeFormatter *)typeFormatter didReferenceClassName:(NSString *)name; - (void)appendStructuresToString:(NSMutableString *)resultString; // Phase 0 - initiated from -[CDClassDump registerTypes] - (void)phase0RegisterStructure:(CDType *)structure usedInMethod:(BOOL)isUsedInMethod; // Run phase 1+ - (void)workSomeMagic; // Phase 1 - (void)phase1RegisterStructure:(CDType *)structure; - (void)endPhase:(NSUInteger)phase; - (CDType *)phase2ReplacementForType:(CDType *)type; - (void)phase3RegisterStructure:(CDType *)structure; - (CDType *)phase3ReplacementForType:(CDType *)type; - (BOOL)shouldShowName:(NSString *)name; - (BOOL)shouldExpandType:(CDType *)type; - (NSString *)typedefNameForType:(CDType *)type; @end #pragma mark - @protocol CDTypeControllerDelegate <NSObject> @optional - (void)typeController:(CDTypeController *)typeController didReferenceClassName:(NSString *)name; @end
// // CRYBeaconManager.h // Crystal // // Created by xcode on 20.03.14. // Copyright (c) 2014 Crystal Corp. All rights reserved. // #import <Foundation/Foundation.h> #import "ESTBeacon.h" #import "ESTBeaconManager.h" #import "ESTBeaconRegion.h" @protocol CRYBeaconManagerDelegate <NSObject> @end @interface CRYBeaconManager : NSObject<ESTBeaconManagerDelegate> -(instancetype)initWithUUID:(NSArray*) UUIDString majorNumber:(NSArray*) majorNumber minorNumber:(NSArray*)minorNumber identifier:(NSArray*)identifier; @property(nonatomic, strong) NSMutableArray* UUID; @property(nonatomic, strong) NSMutableArray* minor; @property(nonatomic, strong) NSMutableArray* major; @property(nonatomic, strong) ESTBeaconManager* beaconManager; @property(nonatomic, strong) NSMutableArray* beaconRegion; @property(nonatomic, strong) NSMutableArray* identifier; @property(nonatomic, assign) BOOL isBeaconInRange; @property(nonatomic, assign) BOOL isBeaconInRange2; @property(nonatomic, weak) NSObject<CRYBeaconManagerDelegate> *delegate; @end
// Combined include file for esp8266 #define ESP_CONST_DATA __attribute__((aligned(4))) __attribute__((section(".irom.text"))) #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef FREERTOS #include <stdint.h> #include <espressif/esp_common.h> #else #include <c_types.h> #include <ets_sys.h> #include <gpio.h> #include <mem.h> #include <osapi.h> #include <user_interface.h> #include <upgrade.h> #include <esp_sdk_ver.h> #endif #include "platform.h" // missing from sdk supplied include files void ets_isr_unmask(unsigned intr); void ets_isr_mask(unsigned intr);
/////////////////////////////////////////////////////////////////////////////// // \author (c) Marco Paland (info@paland.com) // 2014-2019, PALANDesign Hannover, Germany // // \license The MIT License (MIT) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // 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. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // \brief Tiny printf, sprintf and snprintf implementation, optimized for speed on // embedded systems with a very limited resources. // Use this instead of bloated standard/newlib printf. // These routines are thread safe and reentrant. // /////////////////////////////////////////////////////////////////////////////// #ifndef _PRINTF_H_ #define _PRINTF_H_ #include <stdarg.h> #include <stddef.h> #ifdef __cplusplus extern "C" { #endif /** * Output a character to a custom device like UART, used by the printf() function * This function is declared here only. You have to write your custom implementation somewhere * \param character Character to output */ void _putchar(char character); /** * Tiny printf implementation * You have to implement _putchar if you use printf() * To avoid conflicts with the regular printf() API it is overridden by macro defines * and internal underscore-appended functions like printf_() are used * \param format A string that specifies the format of the output * \return The number of characters that are written into the array, not counting the terminating null character */ #define printf printf_ int printf_(const char* format, ...); /** * Tiny sprintf implementation * Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD! * \param buffer A pointer to the buffer where to store the formatted string. MUST be big enough to store the output! * \param format A string that specifies the format of the output * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character */ #define sprintf sprintf_ int sprintf_(char* buffer, const char* format, ...); /** * Tiny snprintf/vsnprintf implementation * \param buffer A pointer to the buffer where to store the formatted string * \param count The maximum number of characters to store in the buffer, including a terminating null character * \param format A string that specifies the format of the output * \param va A value identifying a variable arguments list * \return The number of characters that COULD have been written into the buffer, not counting the terminating * null character. A value equal or larger than count indicates truncation. Only when the returned value * is non-negative and less than count, the string has been completely written. */ #define snprintf snprintf_ #define vsnprintf vsnprintf_ int snprintf_(char* buffer, size_t count, const char* format, ...); int vsnprintf_(char* buffer, size_t count, const char* format, va_list va); /** * Tiny vprintf implementation * \param format A string that specifies the format of the output * \param va A value identifying a variable arguments list * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character */ #define vprintf vprintf_ int vprintf_(const char* format, va_list va); /** * printf with output function * You may use this as dynamic alternative to printf() with its fixed _putchar() output * \param out An output function which takes one character and an argument pointer * \param arg An argument pointer for user data passed to output function * \param format A string that specifies the format of the output * \return The number of characters that are sent to the output function, not counting the terminating null character */ int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...); #ifdef __cplusplus } #endif #endif // _PRINTF_H_
#ifndef POST_PROCESS_MANAGER_H #define POST_PROCESS_MANAGER_H #include <SFML/Graphics.hpp> #include "stringImproved.h" #include "Updatable.h" #include "Renderable.h" class PostProcessor : public RenderChain { private: sf::Shader shader; sf::RenderTexture renderTexture; RenderChain* chain; static bool global_post_processor_enabled; public: bool enabled; PostProcessor(string name, RenderChain* chain); virtual ~PostProcessor() {} virtual void render(sf::RenderTarget& window); void setUniform(string name, float value); static void setEnable(bool enable) { global_post_processor_enabled = enable; } static bool isEnabled() { return global_post_processor_enabled; } }; #endif//POST_PROCESS_MANAGER_H
// // FBPromoViewController.h // Pods // // Created by Tony Sullivan on 6/6/16. // // #import <UIKit/UIKit.h> #import <StoreKit/StoreKit.h> #import "FBPartnerConfig.h" @protocol FBPromoViewControllerDelegate; @interface FBPromoViewController : UIViewController @property (nonatomic, weak) id<FBPromoViewControllerDelegate> delegate; - (void)setPartnerConfig:(FBPartnerConfig*)config; - (void)setShowCancelButton:(BOOL)showCancelButton; - (void)storeDidFinish; @end @protocol FBPromoViewControllerDelegate <NSObject> -(void)promoViewControllerDidFinish:(FBPromoViewController *)viewController; @end
#include "stdio.h" void barChartH(int[]); void barChartV(int[]); int max(int*); int main(void) { int data[] = {10,15,13,23,45,23,34,6,33,4,3,2,34,54,65}; char hOrV; printf("Horizontal or Vertical?\n"); scanf("%c",&hOrV); if (hOrV == 'h') barChartH(data); else if (hOrV == 'v') barChartV(data); return 0; } void barChartH(int data[]) { int i, j; for (i = max(data); i > 0; i--) { for (j = 0; j < 15; j++) { if (data[j] >= i) printf("*"); else printf(" "); } printf("\n"); } } void barChartV(int data[]) { int i, j; for (i = 0; i < 15; i++) { for (j = 0; j < data[i]; j++) printf("*"); printf("\n"); } } int max(int data[]) { int i, max = data[0]; for (i = 1; i < 15; i++) { if (data[i] > max) max = data[i]; } return max; }
/** @file * General info about digits. * * @author Cley Faye * Licensing informations in LICENSE.md file. */ #include <pebble.h> #include "digit_info.h" // =================== // PRIVATE VARIABLES = // =================== /** Segment resource identifiers for big digits */ const ResourceId big_segment_res_ids[SEGMENTS_ORIENTATION_COUNT] = { RESOURCE_ID_BIGDIGIT_VERTICAL, RESOURCE_ID_SEGMENT_BIG_0, RESOURCE_ID_SEGMENT_BIG_1, RESOURCE_ID_SEGMENT_BIG_2, RESOURCE_ID_SEGMENT_BIG_3, RESOURCE_ID_SEGMENT_BIG_4, RESOURCE_ID_SEGMENT_BIG_5, RESOURCE_ID_SEGMENT_BIG_6, RESOURCE_ID_SEGMENT_BIG_7, RESOURCE_ID_SEGMENT_BIG_8, RESOURCE_ID_BIGDIGIT_HORIZONTAL, RESOURCE_ID_SEGMENT_BIG_9, RESOURCE_ID_SEGMENT_BIG_10, RESOURCE_ID_SEGMENT_BIG_11, RESOURCE_ID_SEGMENT_BIG_12, RESOURCE_ID_SEGMENT_BIG_13, RESOURCE_ID_SEGMENT_BIG_14, RESOURCE_ID_SEGMENT_BIG_15, RESOURCE_ID_SEGMENT_BIG_16, RESOURCE_ID_SEGMENT_BIG_17 }; /** Segment resource identifiers for medium digits */ const ResourceId medium_segment_res_ids[SEGMENTS_ORIENTATION_COUNT] = { RESOURCE_ID_MEDIUMDIGIT_VERTICAL, RESOURCE_ID_SEGMENT_MEDIUM_0, RESOURCE_ID_SEGMENT_MEDIUM_1, RESOURCE_ID_SEGMENT_MEDIUM_2, RESOURCE_ID_SEGMENT_MEDIUM_3, RESOURCE_ID_SEGMENT_MEDIUM_4, RESOURCE_ID_SEGMENT_MEDIUM_5, RESOURCE_ID_SEGMENT_MEDIUM_6, RESOURCE_ID_SEGMENT_MEDIUM_7, RESOURCE_ID_SEGMENT_MEDIUM_8, RESOURCE_ID_MEDIUMDIGIT_HORIZONTAL, RESOURCE_ID_SEGMENT_MEDIUM_9, RESOURCE_ID_SEGMENT_MEDIUM_10, RESOURCE_ID_SEGMENT_MEDIUM_11, RESOURCE_ID_SEGMENT_MEDIUM_12, RESOURCE_ID_SEGMENT_MEDIUM_13, RESOURCE_ID_SEGMENT_MEDIUM_14, RESOURCE_ID_SEGMENT_MEDIUM_15, RESOURCE_ID_SEGMENT_MEDIUM_16, RESOURCE_ID_SEGMENT_MEDIUM_17 }; /** Segment resource identifiers for small digits */ const ResourceId small_segment_res_ids[SEGMENTS_ORIENTATION_COUNT] = { RESOURCE_ID_SMALLDIGIT_VERTICAL, RESOURCE_ID_SEGMENT_SMALL_0, RESOURCE_ID_SEGMENT_SMALL_1, RESOURCE_ID_SEGMENT_SMALL_2, RESOURCE_ID_SEGMENT_SMALL_3, RESOURCE_ID_SEGMENT_SMALL_4, RESOURCE_ID_SEGMENT_SMALL_5, RESOURCE_ID_SEGMENT_SMALL_6, RESOURCE_ID_SEGMENT_SMALL_7, RESOURCE_ID_SEGMENT_SMALL_8, RESOURCE_ID_SMALLDIGIT_HORIZONTAL, RESOURCE_ID_SEGMENT_SMALL_9, RESOURCE_ID_SEGMENT_SMALL_10, RESOURCE_ID_SEGMENT_SMALL_11, RESOURCE_ID_SEGMENT_SMALL_12, RESOURCE_ID_SEGMENT_SMALL_13, RESOURCE_ID_SEGMENT_SMALL_14, RESOURCE_ID_SEGMENT_SMALL_15, RESOURCE_ID_SEGMENT_SMALL_16, RESOURCE_ID_SEGMENT_SMALL_17 }; // ================== // PUBLIC VARIABLES = // ================== const GSize digit_dimensions[DIGITS_SIZE_COUNT] = { { .w = 46, .h = 83 }, { .w = 42, .h = 77 }, { .w = 16, .h = 33 } }; const ResourceId* const segment_res_ids[DIGITS_SIZE_COUNT] = { big_segment_res_ids, medium_segment_res_ids, small_segment_res_ids }; const unsigned digit_spacing[DIGITS_SIZE_COUNT] = {5, 3, 2};
#include <stdbool.h> #include <string.h> #include "sorting.h" void swap(int* arr, unsigned int ai, unsigned int bi) { int temp = arr[ai]; arr[ai] = arr[bi]; arr[bi] = temp; } void bubble_sort(int *arr, unsigned int len) { bool swapped = true; for (unsigned int i = len - 1; i >= 0 && swapped; i--) { swapped = false; for (unsigned int j = 0; j < i; j++) { if (arr[j] > arr[j + 1]) { swap(arr, j, j + 1); swapped = true; } } } } void insertion_sort(int *arr, unsigned int len) { for (unsigned int i = 1; i < len; i++) { int current = arr[i]; unsigned int j = i - 1; for ( ; j >= 0; j--) { if (arr[j] > current) arr[j + 1] = arr[j]; else break; } arr[j + 1] = current; } } void selection_sort(int *arr, unsigned int len) { for (unsigned int i = 0; i < len - 1; i++) { int min = i; for (unsigned int j = i + 1; j < len; j++) { if (arr[j] < arr[min]) min = j; } swap(arr, i, min); } } /* * Sorts an array using recursive merge sort with no additional memory allocations * up - pointer to array to sort * down - pointer to an empty array with the same size as 'up', used as buffer * left - pass 0 to sort an array from the very begining * right - pass the length of the 'up' - 1 to sort the whole array * returns: pointer to the sorted array, this will be equal to either 'up' or 'down' * Note: take notice that sorted version of the array may end up either in 'up' or 'down' */ int* merge_sort(int *up, int *down, unsigned int left, unsigned int right) { if (left == right) { down[left] = up[left]; return down; } unsigned int middle = (unsigned int)((left + right) * 0.5f); // divide and sort int *l_buff = merge_sort(up, down, left, middle); int *r_buff = merge_sort(up, down, middle + 1, right); // merge int *target = l_buff == up ? down : up; unsigned int l_cur = left, r_cur = middle + 1; for (unsigned int i = left; i <= right; i++) { if (l_cur <= middle && r_cur <= right) { if (l_buff[l_cur] < r_buff[r_cur]) { target[i] = l_buff[l_cur]; l_cur++; } else { target[i] = r_buff[r_cur]; r_cur++; } } else if (l_cur <= middle) { target[i] = l_buff[l_cur]; l_cur++; } else { target[i] = r_buff[r_cur]; r_cur++; } } return target; } void count_sort(int* arr, int* buff, unsigned int len, int min_num, int max_num) { unsigned int cnt_size = max_num - min_num + 1; int count[cnt_size]; memset(count, 0, cnt_size * sizeof(int)); // lets calculate number of appearances of each number for (unsigned int i = 0; i < len; i++) count[arr[i] - min_num]++; // now well calculate actual positions of the elements for (unsigned int i = 1; i < cnt_size; i++) count[i] += count[i - 1]; for (unsigned int i = 0; i < len; i++) { unsigned int position = --(count[arr[i] - min_num]); buff[position] = arr[i]; } }
// // SharingAppDelegate.h // Sharing // // Created by Zouhair Mahieddine on 12/10/11. // Copyright 2011 Zedenem. All rights reserved. // #import <UIKit/UIKit.h> @class RootViewController; @interface ZMSharingAppDelegate : NSObject <UIApplicationDelegate> @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet RootViewController *viewController; @end
// // BotManager.h // SpaceStationKeeper // // Created by Sean Dawson on 27/05/2014. // // #ifndef SpaceStationKeeper_BotManager_h #define SpaceStationKeeper_BotManager_h #include <set> #include <memory> #include <functional> #include "VecComparison.h" #include "Bot.h" #include "Job.h" #include "JobManager.h" #include "CoordSearch.h" #include "GameObject.h" using namespace std; using namespace ci; /*! The BotManager is class that helps the autonomous bots coordinate with other * bots and navigate. */ class BotManager : public GameComponent { public: // Constructors/Destructors BotManager(JobManagerRef jobManager); virtual ~BotManager(); // Methods void addCoord(Vec2i coord); void removeCoord(Vec2i coord); void addBot(BotRef bot); void removeBot(BotRef bot); float distanceTo(Vec2i source, Vec2i destination); float distanceTo(Vec2i source, Vec2i destination, int radius); CoordListRef getPath(Vec2i source, Vec2i destination); CoordListRef getPath(Vec2i source, Vec2i destination, int radius); bool isPassable(Vec2i coord); // GameComponent Methods void update(float deltaTime) override; protected: // Fields set<Vec2i, VecComparison> _passableCoords; set<BotRef> _bots; JobManagerRef _jobManager; map<BotRef, CoordListRef> _botPathCache; // Methods std::function<float(Vec2i)> getCostFunction(); void assignJobs(); void moveBots(); bool isSnappedToGrid(Vec3f location); }; typedef std::shared_ptr<BotManager> BotManagerRef; #endif
/* heatmap - High performance heatmap creation in C. * * The MIT License (MIT) * * Copyright (c) 2013 Lucas Beyer * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * 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. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <stdlib.h> #include <stdio.h> #include <time.h> #include "lodepng.h" #include "heatmap.h" int main() { static const size_t w = 256, h = 512, npoints = 1000; unsigned char image[256*512*4]; unsigned i; /* Create the heatmap object with the given dimensions (in pixel). */ heatmap_t* hm = heatmap_new(w, h); srand(time(NULL)); /* Add a bunch of random points to the heatmap now. */ for(i = 0 ; i < npoints ; ++i) { /* Fake a normal distribution. */ unsigned x = rand() % w/3 + rand() % w/3 + rand() % w/3; unsigned y = rand() % h/3 + rand() % h/3 + rand() % h/3; heatmap_add_point(hm, x, y); } /* This creates an image out of the heatmap. * `image` now contains the image data in 32-bit RGBA. */ heatmap_render_default_to(hm, image); /* Now that we've got a finished heatmap picture, * we don't need the map anymore. */ heatmap_free(hm); /* Finally, we use the fantastic lodepng library to save it as an image. */ { unsigned error = lodepng_encode32_file("heatmap.png", image, w, h); if(error) fprintf(stderr, "Error (%u) creating PNG file: %s\n", error, lodepng_error_text(error)); } return 0; }
// // RXSelfRequestManager.h // RXVerifyExample // // Created by Rush.D.Xzj on 2019/6/4. // Copyright © 2019 Rush.D.Xzj. All rights reserved. // #import <Foundation/Foundation.h> // http://blog.sunnyxx.com/2015/01/17/self-in-arc/ NS_ASSUME_NONNULL_BEGIN @interface RXSelfRequestManager : NSObject + (instancetype)sharedInstance; - (void)test; @end NS_ASSUME_NONNULL_END
// // CAMediaTimingFunction+Extends.h // AXAnimationChain // // Created by devedbox on 2017/1/3. // Copyright © 2017年 devedbox. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // 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. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #import <QuartzCore/QuartzCore.h> NS_ASSUME_NONNULL_BEGIN typedef double (^CAKeyframeValuesFunction)(double t, double b, double c, double d); typedef double (^AXCASpringValuesFunction)(double t, double b, double c, double d, double mass, double stiffness, double damping); /// Timing functions for easings: http://easings.net/zh-cn @interface CAMediaTimingFunction (Extends) // System default: + (instancetype)defaultTimingFunction; + (instancetype)linear; + (instancetype)easeIn; + (instancetype)easeOut; + (instancetype)easeInOut; /* + (instancetype)decay; */ + (instancetype)easeInSine; + (instancetype)easeOutSine; + (instancetype)easeInOutSine; + (instancetype)easeInQuad; + (instancetype)easeOutQuad; + (instancetype)easeInOutQuad; + (instancetype)easeInCubic; + (instancetype)easeOutCubic; + (instancetype)easeInOutCubic; + (instancetype)easeInQuart; + (instancetype)easeOutQuart; + (instancetype)easeInOutQuart; + (instancetype)easeInQuint; + (instancetype)easeOutQuint; + (instancetype)easeInOutQuint; + (instancetype)easeInExpo; + (instancetype)easeOutExpo; + (instancetype)easeInOutExpo; + (instancetype)easeInCirc; + (instancetype)easeOutCirc; + (instancetype)easeInOutCirc; + (instancetype)easeInBack; + (instancetype)easeOutBack; + (instancetype)easeInOutBack; - (CAKeyframeValuesFunction)valuesFuntion; + (AXCASpringValuesFunction)springValuesFunction __attribute__((unavailable)); + (CAKeyframeValuesFunction)easeInElasticValuesFuntion; + (CAKeyframeValuesFunction)easeOutElasticValuesFuntion; + (CAKeyframeValuesFunction)easeInOutElasticValuesFuntion; + (CAKeyframeValuesFunction)easeInBounceValuesFuntion; + (CAKeyframeValuesFunction)easeOutBounceValuesFuntion; + (CAKeyframeValuesFunction)easeInOutBounceValuesFuntion; // // Not affected by time. // + (CAKeyframeValuesFunction)gravityValuesFunction; + (CAKeyframeValuesFunction)decayValuesFunction __attribute__((unavailable)); @end NS_ASSUME_NONNULL_END
/** * \brief VP Stages. Output SDL stage declaration * \author Sylvain Gaeremynck <sylvain.gaeremynck@parrot.fr> * \author Aurelien Morelle <aurelien.morelle@parrot.fr> * \author Thomas Landais <thomas.landais@parrot.fr> * \version 2.0 * \date first release 16/03/2007 * \date modification 19/03/2007 */ #ifndef _VP_STAGES_O_SDL_H_ #define _VP_STAGES_O_SDL_H_ /** * @defgroup VP_SDK * @{ */ /** * @defgroup VP_Stages * @{ */ /** * @defgroup vp_stages_o_sdl output sdl stage * @{ */ #if !defined(__NDS__) /////////////////////////////////////////////// // INCLUDES #include <VP_Api/vp_api.h> #include <SDL/SDL.h> #if defined(_CK4215_) && defined(WIN32) #include <SDL/SDL_syswm.h> #endif /////////////////////////////////////////////// // TYEPDEFS typedef struct _vp_stages_output_sdl_config_ { uint32_t width; // in uint32_t height; // in uint32_t bpp; // in #if defined(_CK4215_) && defined(WIN32) uint32_t window_pos_x; // in uint32_t window_pos_y; // in #endif uint32_t window_width; // in uint32_t window_height; // in uint32_t pic_width; // in uint32_t pic_height; // in uint32_t y_size; // in uint32_t c_size; // in // private SDL_Surface *surface; SDL_Overlay *overlay; uint32_t received; } vp_stages_output_sdl_config_t; /////////////////////////////////////////////// // FUNCTIONS /** * @fn vp_stages_buffer_to_overlay * @param SDL_Overlay *overlay * @param output_sdl_config_t *cfg * @param vp_api_io_data_t *data * @todo A COMMENTER * @return VOID */ /* void vp_stages_buffer_to_overlay(SDL_Overlay *overlay, vp_stages_output_sdl_config_t *cfg, vp_api_io_data_t *data); */ /** * @fn vp_stages_display_frame * @param output_sdl_config_t *cfg * @param vp_api_io_data_t *dat * @todo A COMMENTER * @return 0 */ /* int vp_stages_display_frame(vp_stages_output_sdl_config_t *cfg, vp_api_io_data_t *data); */ #ifdef __cplusplus extern "C" { #endif #if defined(_CK4215_) && defined(WIN32) void vp_stages_init_display(void * handle); void * vp_stages_get_child_window( void ); #endif /** * @fn Open the output sdl stage * @param vp_stages_output_sdl_config_t *cfg * @todo A COMMENTER * @return VP_SUCCESS or VP_FAILURE */ C_RESULT vp_stages_output_sdl_stage_open(vp_stages_output_sdl_config_t *cfg); /** * @fn Open the output sdl stage * @param vp_stages_output_sdl_config_t *cfg * @param vp_api_io_data_t *in * @param vp_api_io_data_t *out * @todo A COMMENTER * @return VP_SUCCESS or VP_FAILURE */ C_RESULT vp_stages_output_sdl_stage_transform(vp_stages_output_sdl_config_t *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out); /** * @fn Open the output sdl stage * @param vp_stages_output_sdl_config_t *cfg * @todo A COMMENTER * @return VP_SUCCESS or VP_FAILURE */ C_RESULT vp_stages_output_sdl_stage_close(vp_stages_output_sdl_config_t *cfg); #endif // ! __NDS__ // vp_stages_o_sdl /** @} */ // VP_Stages /** @} */ // VP_SDK /** @} */ #ifdef __cplusplus } #endif #endif // _VP_STAGES_O_SDL_H_
#ifndef _CLIENT_EVENT_HANDLERS_H_ #define _CLIENT_EVENT_HANDLERS_H_ #include <event2/event.h> #include <event2/buffer.h> #include <event2/bufferevent.h> #include <cassert> static inline void client_read_handler(struct bufferevent *bev, void *arg) { const int MAX_LINE_SIZE = 256; struct event_base *base = (event_base*)arg; struct evbuffer* input = bufferevent_get_input(bev); size_t origLen = evbuffer_get_length(input); char* line = evbuffer_readln(input, NULL, EVBUFFER_EOL_LF); if (line != NULL) { puts(line); event_base_loopexit(base, NULL); } else if (origLen >= MAX_LINE_SIZE) { fprintf(stderr, "response line exceeded max length " "(%d bytes)\n", MAX_LINE_SIZE); bufferevent_free(bev); } free(line); } static inline void integer_read_handler(struct bufferevent *bev, void *arg) { const int MAX_LINE_SIZE = 256; assert(bev != NULL); assert(arg != NULL); int& returnVal = *(int*)arg; struct event_base *base = bufferevent_get_base(bev); struct evbuffer* input = bufferevent_get_input(bev); size_t origLen = evbuffer_get_length(input); char* line = evbuffer_readln(input, NULL, EVBUFFER_EOL_LF); if (line != NULL) { int pos; int n = sscanf(line, "%d%n", &returnVal, &pos); if (n == EOF || *(line+pos) != '\0') { fprintf(stderr, "error: expected integer response " "but received line: '%s'\n", line); exit(EXIT_FAILURE); } event_base_loopexit(base, NULL); } else if (origLen >= MAX_LINE_SIZE) { fprintf(stderr, "response line exceeded max length " "(%d bytes)\n", MAX_LINE_SIZE); bufferevent_free(bev); } free(line); } static inline void client_event_handler(struct bufferevent *bev, short error, void *arg) { // we should never see this assert(!(error & BEV_EVENT_TIMEOUT)); if (error & BEV_EVENT_EOF) { // connection closed } else if (error & BEV_EVENT_ERROR) { perror("libevent"); } bufferevent_free(bev); } #endif
// // ViewController.h // ScanCode // // Created by hardac on 15/11/28. // Copyright © 2015年 renren. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
// // UCDMasterTableViewHeader.h // CUUCD2012 // // Created by Eric Horacek on 12/9/12. // Copyright (c) 2012 Team 11. All rights reserved. // #import "MSTableViewHeaderFooterView.h" @class CAGradientLayer; @interface MSPlainTableViewHeaderView : MSTableViewHeaderFooterView @property (strong, nonatomic) UIColor *backgroundColor UI_APPEARANCE_SELECTOR; @property (strong, nonatomic) UIColor *topEtchHighlightColor UI_APPEARANCE_SELECTOR; @property (strong, nonatomic) UIColor *topEtchShadowColor UI_APPEARANCE_SELECTOR; @property (strong, nonatomic) UIColor *bottomEtchShadowColor UI_APPEARANCE_SELECTOR; @property (strong, nonatomic) CAGradientLayer *backgroundGradient UI_APPEARANCE_SELECTOR; @end
#pragma once #include "DataFrame.h" #include "DBModel.h" #include <functional> #include <string> #include <vector> /* 实现下面的各种SQL Operation */ /* SQLOperation实现了Select、Insert、Delete这些Entry级的操作 以及Create、Drop、Alert、Join这些表级的操作 */ enum JoinMode { LeftJoin, RightJoin, InnerJoin, OutterJoin }; class SQLOperation { public: //Entry 级操作 //选出筛选函数选中的行并组成一个新的DataFrame,默认筛选所有列(列名列表为空) DataFrame* Select(DataFrame&, std::function<bool(DataRow&)>, std::vector<std::string> cols = std::vector<std::string>()); //插入newData到origin中组成一个新的DataFrame DataFrame& Insert(DataFrame& origin, DataFrame& newData); DataFrame& Insert(DataFrame&, DataRow&); //从DataFrame中去除被筛选函数选中的行组成一个新的DataFrame DataFrame& Delete(DataFrame&, std::function<bool(DataRow&)>); //Table 级操作 //从一个DataFrame创建一个新表 Table* Create(DataFrame&); //从一个DBIndex创建一个新的空表 Table* Create(DBIndex&); //丢弃目标表,返回值为是否成功 bool Drop(Table&); //以DBIndex的信息为准对Table进行修改 Table& Alert(Table&, DBIndex&); //以onCondition为关键字对两个表进行join操作,默认为innerjoin DataFrame* Join(Table&, Table&, std::vector<std::string> onCondition, JoinMode mode=InnerJoin); };
#ifndef PIN_DEVICE_INTERFACE_H #define PIN_DEVICE_INTERFACE_H #include "../../device/deviceInterface.h" #include "../../device/deviceConstants.h" /** Command to read the value of a Pin. */ #define COMMAND_GET_PIN_VALUE 'v' /** Command to set the value of a pin. */ #define COMMAND_SET_PIN_VALUE 'V' /** * Get the pin device interface. * @return the pointer on device Interface. */ DeviceInterface* getPinDeviceInterface(); #endif
#ifndef FUNKCJE_H #define FUNKCJE_H #include <iostream> #include <cstdio> #define GRACZ "X" // znaczek gracza #define SI "O" // znaczek komputera // naglowki poszczegolnych rozmiarow planszy, wyswietlane po dokonaniu wyboru, przed rozpoczeciem gry #define NAGLOWEK3 "\nkolko i krzyzyk 3x3\n1 | 2 | 3\n---+---+---\n4 | 5 | 6\n---+---+---\n7 | 8 | 9\n=======================\n" #define NAGLOWEK4 "\nkolko i krzyzyk 4x4\n1 | 2 | 3 | 4\n---+----+----+----\n5 | 6 | 7 | 8\n---+----+----+----\n9 | 10 | 11 | 12\n---+----+----+----\n13 | 14 | 15 | 16\n=======================\n" #define NAGLOWEK5 "\nkolko i krzyzyk 5x5\n1 | 2 | 3 | 4 | 5\n---+----+----+----+----\n6 | 7 | 8 | 9 | 10\n---+----+----+----+----\n11 | 12 | 13 | 14 | 15\n---+----+----+----+----\n16 | 17 | 18 | 19 | 20\n---+----+----+----+----\n21 | 22 | 23 | 24 | 25\n=======================\n" #define NAGLOWEK6 "\nkolko i krzyzyk 6x6\n1 | 2 | 3 | 4 | 5 | 6\n---+----+----+----+----+----\n7 | 8 | 9 | 10 | 11 | 12\n---+----+----+----+----+----\n13 | 14 | 15 | 16 | 17 | 18\n---+----+----+----+----+----\n19 | 20 | 21 | 22 | 23 | 24\n---+----+----+----+----+----\n25 | 26 | 27 | 28 | 29 | 30\n---+----+----+----+----+----\n31 | 32 | 33 | 34 | 35 | 36\n================================\n" #define NAGLOWEK7 "\nkolko i krzyzyk 7x7\n1 | 2 | 3 | 4 | 5 | 6 | 7\n---+----+----+----+----+----+----\n8 | 9 | 10 | 11 | 12 | 13 | 14\n---+----+----+----+----+----+----\n15 | 16 | 17 | 18 | 19 | 20 | 21\n---+----+----+----+----+----+----\n22 | 23 | 24 | 25 | 26 | 27 | 28\n---+----+----+----+----+----+----\n29 | 30 | 31 | 32 | 33 | 34 | 35\n---+----+----+----+----+----+----\n36 | 37 | 38 | 39 | 40 | 41 | 42\n---+----+----+----+----+----+----\n43 | 44 | 45 | 46 | 47 | 48 | 49\n========================================\n" ; using namespace std; /* funkcja wyswietlajaca menu i zwracajaca pare ustalonych przez uzytkownika parametrow - pierwszy to rozmiar planszy, a drugi to wymagana ilosc znakow w rzedzie do wygrania gry */ pair<int,int> menu(); #endif
//----------------------------------------------------------------------------// //| //| MachOKit - A Lightweight Mach-O Parsing Library //! @file MKBindDoBindAddAddressULEB.h //! //! @author D.V. //! @copyright Copyright (c) 2014-2015 D.V. All rights reserved. //| //| Permission is hereby granted, free of charge, to any person obtaining a //| copy of this software and associated documentation files (the "Software"), //| to deal in the Software without restriction, including without limitation //| the rights to use, copy, modify, merge, publish, distribute, sublicense, //| and/or sell copies of the Software, and to permit persons to whom the //| Software is furnished to do so, subject to the following conditions: //| //| The above copyright notice and this permission notice shall be included //| in all copies or substantial portions of the Software. //| //| 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. //| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY //| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, //| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE //| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //----------------------------------------------------------------------------// #include <MachOKit/macho.h> #import <Foundation/Foundation.h> #import <MachOKit/MKBindCommand.h> #import <MachOKit/MKBindCommandOffsetAdjusting.h> NS_ASSUME_NONNULL_BEGIN //----------------------------------------------------------------------------// @interface MKBindDoBindAddAddressULEB : MKBindCommand <MKBindCommandOffsetAdjusting> { @package uint64_t _offset; size_t _offsetULEBSize; } //! The offset applied to the segment base address after binding. @property (nonatomic, readonly) uint64_t offset; @end NS_ASSUME_NONNULL_END
#ifndef __SINGLETON_H__ #define __SINGLETON_H__ template <typename T> class Singleton { public: typedef T object_type; static T& Instance() { static T obj; return obj; } private: struct object_creator { object_creator() { Singleton<T>::Instance(); } }; static object_creator create_object; }; template <typename T> typename Singleton<T>::object_creator Singleton<T>::create_object; #endif //__SINGLETON_H__
#ifndef app_gap_h #define app_gap_h #include <ble.h> void init_app_gap(void); void app_gap_on_ble_event(ble_evt_t * p_ble_evt); // GAPのデバイス名を設定します。p_device_nameは0終端指定なくともよいUTF-8の文字列。lengthは文字列の長さ。 void app_gap_set_device_name(uint8_t *p_device_name, uint16_t length); // GAPのデバイス名を取得します。 uint16_t app_gap_get_device_name(uint8_t *p_device_name, uint16_t length); #endif /* app_gap_h */
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct csr_t { int n; /* Dimension of matrix (assume square) */ double* pr; /* Array of matrix nonzeros (row major order) */ int* col; /* Column indices of nonzeros */ int* ptr; /* Offsets of the start of each row in pr (ptr[n] = number of nonzeros) */ } csr_t; void sparse_multiply(csr_t* A, double* x, double* result) { memset(result, 0, A->n * sizeof(double)); for (i=0, i < n, ++i) { result[i] = 0; for (j=ptr[i], j < ptr[i+1], ++j) { result[i] += pr[j]*x[col[j]]; } } } int main() { int n = 4; double pr[7] = { 1.,-1., 1.,-1., 1.,-1., 1. }; int col[7] = { 0, 1, 1, 2, 2, 3, 3 }; int ptr[5] = { 0, 2, 4, 6, 7 }; csr_t A = { n, pr, col, ptr }; double x[4] = {1., 3., 8., 12.}; double result[4]; sparse_multiply(&A, x, result); /* * Should compute * [-1, 1, 0, 0 ] [ 1 ] * [ 0, -1, 1, 0 ] * [ 3 ] * [ 0, 0, -1, 1 ] [ 8 ] * [ 0, 0, 0, 1 ] [ 12 ] */ for (int i = 0; i < n; ++i) printf(" %g\n", result[i]); }
// // ITransProvider.h // SVGRendererTouch // // Created by Aaron Boxer on 11-04-21. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @protocol ITransProvider <NSObject> -(CGPoint) getTranslation; -(CGPoint) getScale; @end
// ========================================================================== // create_stellarmatches_from_file // ========================================================================== // Copyright (c) 2011, Kathrin Trappe, FU Berlin // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of Knut Reinert or the FU Berlin nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. // // ========================================================================== // Author: Kathrin Trappe <kathrin.trappe@fu-berlin.de> // ========================================================================== #ifndef SANDBOX_KTRAPPE_APPS_MSPLAZER_MSPLAZER_OUT_H_ #define SANDBOX_KTRAPPE_APPS_MSPLAZER_MSPLAZER_OUT_H_ #include <iostream> #include <fstream> #include <seqan/file.h> // For printing SeqAn Strings. #include "../../../../core/apps/stellar/stellar.h" #include "msplazer.h" using namespace seqan; //DotWriting call for read graphs template < typename TSequence, typename TId, typename TMSplazerChain > void _writeDotfiles(StringSet <QueryMatches< StellarMatch <TSequence, TId > > > & stellarMatches, StringSet<TSequence> const & queries, String< TMSplazerChain > & queryChains, MSplazerOptions const & msplazerOptions){ for(unsigned i = 0; i < length(queryChains); ++i){ if(!queryChains[i].isEmpty){ //if(length(stellarMatches[i].matches) > 45){ //String< char > fn = toString(msplazerOptions.outDir) + "read" + toString(i+1) + '_' + toString(msplazerOptions.queryFile) + '_' + toString(msplazerOptions.databaseFile) + ".dot"; String< char > fn = toString(msplazerOptions.outDir) + "read" + toString(i+1) + '_' + toString(msplazerOptions.jobName) + ".dot"; //std::cerr << fn << std::endl; FILE* strmWrite = fopen(toCString(fn), "w"); //write(strmWrite, queryChains[i].graph, DotDrawing()); write(strmWrite, queryChains[i], stellarMatches[i].matches, length(queries[i]), DotDrawingMSplazer()); fclose(strmWrite); //std::cerr << " completed dot write in: " << i << std::endl; } } } //Breakpoint writing call template < typename TBreakpoint > void _writeGlobalBreakpoints(String<TBreakpoint> const & globalBreakpoints, MSplazerOptions const & msplazerOptions, unsigned const & support, String<char> const & fileName){ String< char > fn = toString(msplazerOptions.outDir) + toString(msplazerOptions.jobName) + toString(fileName); //std::cerr << fn << std::endl; FILE* strmWrite = fopen(toCString(fn), "w"); _streamWrite(strmWrite, "Global breakpoints found on best MSplazerChains sorted according to genome Ids\n"); _streamWrite(strmWrite, "Database file: "); _streamWrite(strmWrite, msplazerOptions.databaseFile); _streamPut(strmWrite, '\n'); _streamPut(strmWrite, BreakpointFileHeader()); //print bps for(unsigned i = 0; i < length(globalBreakpoints); ++i){ //if(globalBreakpoints[i].svtype != "none" && globalBreakpoints[i].support >= msplazerOptions.support) if(globalBreakpoints[i].svtype != "none" && globalBreakpoints[i].support >= support) _streamWrite(strmWrite, globalBreakpoints[i], i); //_streamPut(strmWrite, '\n'); } fclose(strmWrite); std::cout << " completed writing " << fileName << std::endl; } /////////////////////////////////////////////////////////////////////////////// // Writes parameters from options object to std::cout template<typename TOptions> void _writeParams(TOptions & options) { //IOREV _notio_ // Output user specified parameters if(options.outDir != "") std::cout << "Output directory : " << options.outDir << std::endl; if(options.jobName != "") std::cout << "Job name : " << options.jobName << std::endl; std::cout << "Thresholds:" << std::endl; std::cout << " overlap threshold (oth) : " << options.simThresh << std::endl; std::cout << " gap threshold (gth) : " << options.gapThresh << std::endl; std::cout << " inital gap threshold (ith) : " << options.initGapThresh << std::endl; std::cout << "Penalties:" << std::endl; std::cout << " translocation penalty (tp) : " << options.diffDBPen << std::endl; std::cout << " inversion penalty (ip) : " << options.diffStrandPen << std::endl; std::cout << " order penalty (op) : " << options.diffOrderPen << std::endl; std::cout << " required read support (st) : " << options.support << std::endl; } #endif // #ifndef SANDBOX_MY_SANDBOX_APPS_MSPLAZER_MSPLAZER_OUT_H_
/*$Id$*/ #include <stdio.h> #if defined(CRAY) && !defined(__crayx1) #include <fortran.h> #define FATR #endif #if defined(WIN32) && !defined(__MINGW32__) #include "typesf2c.h" extern int FATR gethostname(char *, int); #elif defined(__MINGW32__) #include <winsock.h> #else extern int gethostname(char *, int); #endif #if defined(USE_FCD) extern int string_to_fortchar(_fcd, int, const char *); void FATR UTIL_HOSTNAME(name) _fcd name; { int namelen = _fcdlen(name); #else extern int string_to_fortchar(char *, int, const char *); void util_hostname_(char *name, int namelen) { #endif /* Utility routine to return hostname to FORTRAN character*(*) name call util_hostname(name) */ char buf[256]; #ifdef DELTA (void) string_to_fortchar(name, namelen, "delta"); #else if (gethostname(buf, (int) sizeof(buf)) != 0) buf[0] = 0; (void) string_to_fortchar( name, namelen, buf); #endif }
#ifndef SAMKO_JSONREADER_H #define SAMKO_JSONREADER_H #include "reader.h" #include "json_common.h" namespace samko { class JsonReader : public Reader { public: /// standard constructor JsonReader(); /// parse JSON data virtual void parse(const std::string& data); protected: virtual std::string _readString(const std::string& name); virtual int _readInt(const std::string& name); virtual double _readDouble(const std::string& name); virtual std::vector<std::string> _readStringArray(const std::string& name); virtual std::vector<int> _readIntArray(const std::string& name); virtual std::vector<double> _readDoubleArray(const std::string& name); private: JsonPtr _root; const json_t* getCurrentObject() const; void throwBadType(const std::string& key, const std::string& expectedType) const; template<typename T> std::vector<T> readArray(const std::string& name, std::function<T(json_t*)> convFunc){ std::vector<T> ret; auto val = json_object_get(getCurrentObject(), name.c_str()); if (!json_is_array(val)) throwBadType(name, "array"); size_t index; json_t *value; json_array_foreach(val, index, value) ret.push_back(convFunc(value)); return ret; } }; } //namespace samko #endif // SAMKO_JSONREADER_H
// // RootViewController.h // FirstGame // // Created by Anthony Feick on 2/18/11. // Copyright W3i 2011. All rights reserved. // #import <UIKit/UIKit.h> @interface RootViewController : UIViewController { } @end