text stringlengths 4 6.14k |
|---|
#include "WebCore/loader/FrameLoaderClient.h"
|
/*
* QEMU Epson S1D13744/S1D13745 templates
*
* Copyright (C) 2008 Nokia Corporation
* Written by Andrzej Zaborowski <andrew@openedhand.com>
*
* 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 or
* (at your option) version 3 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, see <http://www.gnu.org/licenses/>.
*/
#define SKIP_PIXEL(to) to += deststep
#if DEPTH == 8
# define PIXEL_TYPE uint8_t
# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
# define COPY_PIXEL1(to, from) *to ++ = from
#elif DEPTH == 15 || DEPTH == 16
# define PIXEL_TYPE uint16_t
# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
# define COPY_PIXEL1(to, from) *to ++ = from
#elif DEPTH == 24
# define PIXEL_TYPE uint8_t
# define COPY_PIXEL(to, from) \
to[0] = from; to[1] = (from) >> 8; to[2] = (from) >> 16; SKIP_PIXEL(to)
# define COPY_PIXEL1(to, from) \
*to ++ = from; *to ++ = (from) >> 8; *to ++ = (from) >> 16
#elif DEPTH == 32
# define PIXEL_TYPE uint32_t
# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to)
# define COPY_PIXEL1(to, from) *to ++ = from
#else
# error unknown bit depth
#endif
#ifdef HOST_WORDS_BIGENDIAN
# define SWAP_WORDS 1
#endif
static void glue(blizzard_draw_line16_, DEPTH)(PIXEL_TYPE *dest,
const uint16_t *src, unsigned int width)
{
#if !defined(SWAP_WORDS) && DEPTH == 16
memcpy(dest, src, width);
#else
uint16_t data;
unsigned int r, g, b;
const uint16_t *end = (const void *) src + width;
while (src < end) {
data = lduw_raw(src ++);
b = (data & 0x1f) << 3;
data >>= 5;
g = (data & 0x3f) << 2;
data >>= 6;
r = (data & 0x1f) << 3;
data >>= 5;
COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
}
#endif
}
static void glue(blizzard_draw_line24mode1_, DEPTH)(PIXEL_TYPE *dest,
const uint8_t *src, unsigned int width)
{
/* TODO: check if SDL 24-bit planes are not in the same format and
* if so, use memcpy */
unsigned int r[2], g[2], b[2];
const uint8_t *end = src + width;
while (src < end) {
g[0] = *src ++;
r[0] = *src ++;
r[1] = *src ++;
b[0] = *src ++;
COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r[0], g[0], b[0]));
b[1] = *src ++;
g[1] = *src ++;
COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r[1], g[1], b[1]));
}
}
static void glue(blizzard_draw_line24mode2_, DEPTH)(PIXEL_TYPE *dest,
const uint8_t *src, unsigned int width)
{
unsigned int r, g, b;
const uint8_t *end = src + width;
while (src < end) {
r = *src ++;
src ++;
b = *src ++;
g = *src ++;
COPY_PIXEL1(dest, glue(rgb_to_pixel, DEPTH)(r, g, b));
}
}
/* No rotation */
static blizzard_fn_t glue(blizzard_draw_fn_, DEPTH)[0x10] = {
NULL,
/* RGB 5:6:5*/
(blizzard_fn_t) glue(blizzard_draw_line16_, DEPTH),
/* RGB 6:6:6 mode 1 */
(blizzard_fn_t) glue(blizzard_draw_line24mode1_, DEPTH),
/* RGB 8:8:8 mode 1 */
(blizzard_fn_t) glue(blizzard_draw_line24mode1_, DEPTH),
NULL, NULL,
/* RGB 6:6:6 mode 2 */
(blizzard_fn_t) glue(blizzard_draw_line24mode2_, DEPTH),
/* RGB 8:8:8 mode 2 */
(blizzard_fn_t) glue(blizzard_draw_line24mode2_, DEPTH),
/* YUV 4:2:2 */
NULL,
/* YUV 4:2:0 */
NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
};
/* 90deg, 180deg and 270deg rotation */
static blizzard_fn_t glue(blizzard_draw_fn_r_, DEPTH)[0x10] = {
/* TODO */
[0 ... 0xf] = NULL,
};
#undef DEPTH
#undef SKIP_PIXEL
#undef COPY_PIXEL
#undef COPY_PIXEL1
#undef PIXEL_TYPE
#undef SWAP_WORDS
|
/* Copyright 2020 MaiKong<704340378@qq.com>
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define LAYOUT_75_ansi( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k4E, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E,\
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E,\
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3E, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D, \
k50, k51, k52, k55, k59, k5A, k5B, k5C, k5D, k5E \
) \
{ \
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E}, \
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E}, \
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E}, \
{k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, KC_NO, k3E}, \
{k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D, k4E}, \
{k50, k51, k52, KC_NO,KC_NO, k55, KC_NO,KC_NO,KC_NO, k59, k5A, k5B, k5C, k5D, k5E} \
}
|
/* GStreamer buffer-frames conversion plugin
* Copyright (C) 2004 Andy Wingo <wingo at pobox.com>
*
* plugin.h: the stubs for the buffer-frames-convert plugin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_PLUGIN_AUDIO_CONVERT_H__
#define __GST_PLUGIN_AUDIO_CONVERT_H__
#include <gst/gst.h>
G_BEGIN_DECLS
GType gst_audio_convert_get_type (void);
G_END_DECLS
#endif /* __GST_PLUGIN_AUDIO_CONVERT_H__ */
|
/*
* Copyright (c) 2018, Linaro Limited. and Contributors. All rights reserved.
* 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 Linaro 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 HOLDER 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.
*/
/*
* @file generic/log.h
* @brief Generic libmetal log handler definition.
*/
#ifndef __METAL_METAL_LOG__H__
#error "Include metal/log.h instead of metal/generic/log.h"
#endif
#ifndef __METAL_GENERIC_LOG__H__
#define __METAL_GENERIC_LOG__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __METAL_GENERIC_LOG__H__ */
|
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#pragma once
#include <stdint.h>
#include <limits>
#include <string>
#include <vector>
#include "rocksdb/types.h"
namespace rocksdb {
struct ColumnFamilyMetaData;
struct LevelMetaData;
struct SstFileMetaData;
// The metadata that describes a column family.
struct ColumnFamilyMetaData {
ColumnFamilyMetaData() : size(0), name("") {}
ColumnFamilyMetaData(const std::string& _name, uint64_t _size,
const std::vector<LevelMetaData>&& _levels) :
size(_size), name(_name), levels(_levels) {}
// The size of this column family in bytes, which is equal to the sum of
// the file size of its "levels".
uint64_t size;
// The number of files in this column family.
size_t file_count;
// The name of the column family.
std::string name;
// The metadata of all levels in this column family.
std::vector<LevelMetaData> levels;
};
// The metadata that describes a level.
struct LevelMetaData {
LevelMetaData(int _level, uint64_t _size,
const std::vector<SstFileMetaData>&& _files) :
level(_level), size(_size),
files(_files) {}
// The level which this meta data describes.
const int level;
// The size of this level in bytes, which is equal to the sum of
// the file size of its "files".
const uint64_t size;
// The metadata of all sst files in this level.
const std::vector<SstFileMetaData> files;
};
// The metadata that describes a SST file.
struct SstFileMetaData {
SstFileMetaData() {}
SstFileMetaData(const std::string& _file_name,
const std::string& _path, uint64_t _size,
SequenceNumber _smallest_seqno,
SequenceNumber _largest_seqno,
const std::string& _smallestkey,
const std::string& _largestkey,
bool _being_compacted) :
size(_size), name(_file_name),
db_path(_path), smallest_seqno(_smallest_seqno), largest_seqno(_largest_seqno),
smallestkey(_smallestkey), largestkey(_largestkey),
being_compacted(_being_compacted) {}
// File size in bytes.
uint64_t size;
// The name of the file.
std::string name;
// The full path where the file locates.
std::string db_path;
SequenceNumber smallest_seqno; // Smallest sequence number in file.
SequenceNumber largest_seqno; // Largest sequence number in file.
std::string smallestkey; // Smallest user defined key in the file.
std::string largestkey; // Largest user defined key in the file.
bool being_compacted; // true if the file is currently being compacted.
};
// The full set of metadata associated with each SST file.
struct LiveFileMetaData : SstFileMetaData {
std::string column_family_name; // Name of the column family
int level; // Level at which this file resides.
};
} // namespace rocksdb
|
/* Copyright 2019 Ryota Goto
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_tkl_ansi( /* Base */
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
),
};
|
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Internal header file for the PSP Allegro library port.
*
* By diedel.
*
* See readme.txt for copyright information.
*/
#ifndef AINTPSP_H
#define AINTPSP_H
/* For accelerated blitting support .*/
AL_FUNC(BITMAP *, psp_create_bitmap, (int color_depth, int width, int height));
AL_FUNC(int, psp_destroy_bitmap, (BITMAP *bitmap));
/* Extra bitmap info. */
#define BMP_EXTRA(bmp) ((BMP_EXTRA_INFO *)((bmp)->extra))
typedef struct BMP_EXTRA_INFO
{
int pitch;
/* For video bitmaps. */
int size;
uintptr_t hw_addr;
} BMP_EXTRA_INFO;
#define ALIGN_TO(v,n) ((v + n-1) & ~(n-1))
/* For 8 bpp support. */
AL_VAR(GFX_VTABLE, psp_vtable8);
AL_FUNC(void, psp_do_stretch_blit8, (BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int dest_width, int dest_height, int masked));
/* The video bitmap actually displayed on the PSP. */
BITMAP *displayed_video_bitmap;
AL_FUNC(void, psp_draw_to_screen, (void));
/* Video memory manager stuff. */
#define VMM_NO_MEM ((uintptr_t)0)
typedef struct VRAM_HOLE
{
uintptr_t h_base;
unsigned int h_len;
struct VRAM_HOLE *h_next;
} VRAM_HOLE;
AL_FUNC(void, vmm_init, (uintptr_t base, unsigned int available_vram));
AL_FUNC(uintptr_t, vmm_alloc_mem, (unsigned int size));
AL_FUNC(void, vmm_free_mem, (uintptr_t base, unsigned int size));
/* PSP controller stuff. */
#define SAMPLING_CYCLE 0
#define SAMPLING_MODE PSP_CTRL_MODE_DIGITAL
AL_FUNC(void, _psp_init_controller, (int cycle, int mode));
#endif
|
//
// LIFO.h
// A LIFO Stack Library ver 1.00
//
// Provides a universal LIFO stack class for storage of generic objects.
//
// Created by benjk on 7/15/05.
//
// This software is released as open source under the terms of the new BSD
// License obtained from http://www.opensource.org/licenses/bsd-license.php
// on Tuesday, July 19, 2005. The full license text follows below.
//
// Copyright 2005 Sunrise Telephone Systems Ltd. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modi-
// fication, 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 Sunrise
// Telephone Systems Ltd. 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.
//
#import <Foundation/Foundation.h>
// ---------------------------------------------------------------------------
// Class definition: LIFO
// ---------------------------------------------------------------------------
@interface LIFO : NSObject {
// instance variable declaration
@private
NSMutableArray *_stack; // the stack
} // end var
// ---------------------------------------------------------------------------
// Class Method: stackWithCapacity:
// ---------------------------------------------------------------------------
//
// Creates a new instance of LIFO with capacity depth.
+ (LIFO *)stackWithCapacity:(unsigned)depth;
//
// ---------------------------------------------------------------------------
// Instance Method: count
// ---------------------------------------------------------------------------
//
// Returns the number of objects on the receiver's stack.
- (unsigned)count;
// ---------------------------------------------------------------------------
// Instance Method: pushObject:
// ---------------------------------------------------------------------------
//
// Places an object on top of the receiver's stack. If anObject is nil, an
// NSInvalidArgumentException is raised.
- (void)pushObject:(id)anObject;
// ---------------------------------------------------------------------------
// Instance Method: popObject:
// ---------------------------------------------------------------------------
//
// Removes the top most object from the receiver's stack and returns it.
// Returns nil if the receiver's stack is empty.
- (id)popObject;
@end // LIFO
|
/*
* Copyright (c) 2018 Mellanox Technologies. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* 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.
*
*/
#ifndef __MLX5_ACCEL_TLS_H__
#define __MLX5_ACCEL_TLS_H__
#include <linux/mlx5/driver.h>
#include <linux/tls.h>
#ifdef CONFIG_MLX5_TLS
int mlx5_ktls_create_key(struct mlx5_core_dev *mdev,
struct tls_crypto_info *crypto_info,
u32 *p_key_id);
void mlx5_ktls_destroy_key(struct mlx5_core_dev *mdev, u32 key_id);
static inline bool mlx5_accel_is_ktls_device(struct mlx5_core_dev *mdev)
{
if (!MLX5_CAP_GEN(mdev, tls_tx))
return false;
if (!MLX5_CAP_GEN(mdev, log_max_dek))
return false;
return MLX5_CAP_TLS(mdev, tls_1_2_aes_gcm_128);
}
static inline bool mlx5e_ktls_type_check(struct mlx5_core_dev *mdev,
struct tls_crypto_info *crypto_info)
{
switch (crypto_info->cipher_type) {
case TLS_CIPHER_AES_GCM_128:
if (crypto_info->version == TLS_1_2_VERSION)
return MLX5_CAP_TLS(mdev, tls_1_2_aes_gcm_128);
break;
}
return false;
}
#else
static inline int
mlx5_ktls_create_key(struct mlx5_core_dev *mdev,
struct tls_crypto_info *crypto_info,
u32 *p_key_id) { return -ENOTSUPP; }
static inline void
mlx5_ktls_destroy_key(struct mlx5_core_dev *mdev, u32 key_id) {}
static inline bool
mlx5_accel_is_ktls_device(struct mlx5_core_dev *mdev) { return false; }
static inline bool
mlx5e_ktls_type_check(struct mlx5_core_dev *mdev,
struct tls_crypto_info *crypto_info) { return false; }
#endif
enum {
MLX5_ACCEL_TLS_TX = BIT(0),
MLX5_ACCEL_TLS_RX = BIT(1),
MLX5_ACCEL_TLS_V12 = BIT(2),
MLX5_ACCEL_TLS_V13 = BIT(3),
MLX5_ACCEL_TLS_LRO = BIT(4),
MLX5_ACCEL_TLS_IPV6 = BIT(5),
MLX5_ACCEL_TLS_AES_GCM128 = BIT(30),
MLX5_ACCEL_TLS_AES_GCM256 = BIT(31),
};
struct mlx5_ifc_tls_flow_bits {
u8 src_port[0x10];
u8 dst_port[0x10];
union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits src_ipv4_src_ipv6;
union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits dst_ipv4_dst_ipv6;
u8 ipv6[0x1];
u8 direction_sx[0x1];
u8 reserved_at_2[0x1e];
};
#ifdef CONFIG_MLX5_FPGA_TLS
int mlx5_accel_tls_add_flow(struct mlx5_core_dev *mdev, void *flow,
struct tls_crypto_info *crypto_info,
u32 start_offload_tcp_sn, u32 *p_swid,
bool direction_sx);
void mlx5_accel_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid,
bool direction_sx);
int mlx5_accel_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq,
u64 rcd_sn);
bool mlx5_accel_is_tls_device(struct mlx5_core_dev *mdev);
u32 mlx5_accel_tls_device_caps(struct mlx5_core_dev *mdev);
int mlx5_accel_tls_init(struct mlx5_core_dev *mdev);
void mlx5_accel_tls_cleanup(struct mlx5_core_dev *mdev);
#else
static inline int
mlx5_accel_tls_add_flow(struct mlx5_core_dev *mdev, void *flow,
struct tls_crypto_info *crypto_info,
u32 start_offload_tcp_sn, u32 *p_swid,
bool direction_sx) { return -ENOTSUPP; }
static inline void mlx5_accel_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid,
bool direction_sx) { }
static inline int mlx5_accel_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle,
u32 seq, u64 rcd_sn) { return 0; }
static inline bool mlx5_accel_is_tls_device(struct mlx5_core_dev *mdev)
{
return mlx5_accel_is_ktls_device(mdev);
}
static inline u32 mlx5_accel_tls_device_caps(struct mlx5_core_dev *mdev) { return 0; }
static inline int mlx5_accel_tls_init(struct mlx5_core_dev *mdev) { return 0; }
static inline void mlx5_accel_tls_cleanup(struct mlx5_core_dev *mdev) { }
#endif
#endif /* __MLX5_ACCEL_TLS_H__ */
|
/**************************************************************************
*
* Copyright (C) 2010 VMware, Inc., Palo Alto, CA., USA
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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 "vmwgfx_drv.h"
struct vmw_fence {
struct list_head head;
uint32_t sequence;
struct timespec submitted;
};
void vmw_fence_queue_init(struct vmw_fence_queue *queue)
{
INIT_LIST_HEAD(&queue->head);
queue->lag = ns_to_timespec(0);
getrawmonotonic(&queue->lag_time);
spin_lock_init(&queue->lock);
}
void vmw_fence_queue_takedown(struct vmw_fence_queue *queue)
{
struct vmw_fence *fence, *next;
spin_lock(&queue->lock);
list_for_each_entry_safe(fence, next, &queue->head, head) {
kfree(fence);
}
spin_unlock(&queue->lock);
}
int vmw_fence_push(struct vmw_fence_queue *queue,
uint32_t sequence)
{
struct vmw_fence *fence = kmalloc(sizeof(*fence), GFP_KERNEL);
if (unlikely(!fence))
return -ENOMEM;
fence->sequence = sequence;
getrawmonotonic(&fence->submitted);
spin_lock(&queue->lock);
list_add_tail(&fence->head, &queue->head);
spin_unlock(&queue->lock);
return 0;
}
int vmw_fence_pull(struct vmw_fence_queue *queue,
uint32_t signaled_sequence)
{
struct vmw_fence *fence, *next;
struct timespec now;
bool updated = false;
spin_lock(&queue->lock);
getrawmonotonic(&now);
if (list_empty(&queue->head)) {
queue->lag = ns_to_timespec(0);
queue->lag_time = now;
updated = true;
goto out_unlock;
}
list_for_each_entry_safe(fence, next, &queue->head, head) {
if (signaled_sequence - fence->sequence > (1 << 30))
continue;
queue->lag = timespec_sub(now, fence->submitted);
queue->lag_time = now;
updated = true;
list_del(&fence->head);
kfree(fence);
}
out_unlock:
spin_unlock(&queue->lock);
return (updated) ? 0 : -EBUSY;
}
static struct timespec vmw_timespec_add(struct timespec t1,
struct timespec t2)
{
t1.tv_sec += t2.tv_sec;
t1.tv_nsec += t2.tv_nsec;
if (t1.tv_nsec >= 1000000000L) {
t1.tv_sec += 1;
t1.tv_nsec -= 1000000000L;
}
return t1;
}
static struct timespec vmw_fifo_lag(struct vmw_fence_queue *queue)
{
struct timespec now;
spin_lock(&queue->lock);
getrawmonotonic(&now);
queue->lag = vmw_timespec_add(queue->lag,
timespec_sub(now, queue->lag_time));
queue->lag_time = now;
spin_unlock(&queue->lock);
return queue->lag;
}
static bool vmw_lag_lt(struct vmw_fence_queue *queue,
uint32_t us)
{
struct timespec lag, cond;
cond = ns_to_timespec((s64) us * 1000);
lag = vmw_fifo_lag(queue);
return (timespec_compare(&lag, &cond) < 1);
}
int vmw_wait_lag(struct vmw_private *dev_priv,
struct vmw_fence_queue *queue, uint32_t us)
{
struct vmw_fence *fence;
uint32_t sequence;
int ret;
while (!vmw_lag_lt(queue, us)) {
spin_lock(&queue->lock);
if (list_empty(&queue->head))
sequence = atomic_read(&dev_priv->fence_seq);
else {
fence = list_first_entry(&queue->head,
struct vmw_fence, head);
sequence = fence->sequence;
}
spin_unlock(&queue->lock);
ret = vmw_wait_fence(dev_priv, false, sequence, true,
3*HZ);
if (unlikely(ret != 0))
return ret;
(void) vmw_fence_pull(queue, sequence);
}
return 0;
}
|
// Copyright 2014 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_UI_COCOA_APPS_QUIT_WITH_APPS_CONTROLLER_MAC_H_
#define CHROME_BROWSER_UI_COCOA_APPS_QUIT_WITH_APPS_CONTROLLER_MAC_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/notifications/notification.h"
class PrefRegistrySimple;
class Profile;
// QuitWithAppsController checks whether any apps are running and shows a
// notification to quit all of them.
class QuitWithAppsController : public NotificationDelegate {
public:
static const char kQuitWithAppsNotificationID[];
QuitWithAppsController();
// NotificationDelegate interface.
void Display() override;
void Close(bool by_user) override;
void Click() override;
void ButtonClick(int button_index) override;
std::string id() const override;
// Attempt to quit Chrome. This will display a notification and return false
// if there are apps running.
bool ShouldQuit();
// Register prefs used by QuitWithAppsController.
static void RegisterPrefs(PrefRegistrySimple* registry);
private:
~QuitWithAppsController() override;
scoped_ptr<Notification> notification_;
// The Profile instance associated with the notification_. We need to cache
// the instance here because when we want to cancel the notification we need
// to provide the profile which was used to add the notification previously.
// Not owned by this class.
Profile* notification_profile_;
// Whether to suppress showing the notification for the rest of the session.
bool suppress_for_session_;
// Display a notification when quitting Chrome with hosted apps running?
bool hosted_app_quit_notification_;
DISALLOW_COPY_AND_ASSIGN(QuitWithAppsController);
};
#endif // CHROME_BROWSER_UI_COCOA_APPS_QUIT_WITH_APPS_CONTROLLER_MAC_H_
|
// Copyright 2014 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 DEVICE_HID_INPUT_SERVICE_LINUX_H_
#define DEVICE_HID_INPUT_SERVICE_LINUX_H_
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "device/hid/device_monitor_linux.h"
namespace device {
// This class provides information and notifications about
// connected/disconnected input/HID devices. This class is *NOT*
// thread-safe and all methods must be called from the FILE thread.
class InputServiceLinux : public base::MessageLoop::DestructionObserver {
public:
struct InputDeviceInfo {
enum Subsystem { SUBSYSTEM_HID, SUBSYSTEM_INPUT, SUBSYSTEM_UNKNOWN };
enum Type { TYPE_BLUETOOTH, TYPE_USB, TYPE_SERIO, TYPE_UNKNOWN };
InputDeviceInfo();
std::string id;
std::string name;
Subsystem subsystem;
Type type;
bool is_accelerometer : 1;
bool is_joystick : 1;
bool is_key : 1;
bool is_keyboard : 1;
bool is_mouse : 1;
bool is_tablet : 1;
bool is_touchpad : 1;
bool is_touchscreen : 1;
};
class Observer {
public:
virtual ~Observer() {}
virtual void OnInputDeviceAdded(const InputDeviceInfo& info) = 0;
virtual void OnInputDeviceRemoved(const std::string& id) = 0;
};
InputServiceLinux();
static InputServiceLinux* GetInstance();
static bool HasInstance();
static void SetForTesting(InputServiceLinux* service);
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
// Returns list of all currently connected input/hid devices.
void GetDevices(std::vector<InputDeviceInfo>* devices);
// Returns an info about input device identified by |id|. When there're
// no input or hid device with such id, returns false and doesn't
// modify |info|.
bool GetDeviceInfo(const std::string& id, InputDeviceInfo* info) const;
// Implements base::MessageLoop::DestructionObserver
virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
protected:
virtual ~InputServiceLinux();
void AddDevice(const InputDeviceInfo& info);
void RemoveDevice(const std::string& id);
bool CalledOnValidThread() const;
private:
friend struct base::DefaultDeleter<InputServiceLinux>;
typedef base::hash_map<std::string, InputDeviceInfo> DeviceMap;
DeviceMap devices_;
ObserverList<Observer> observers_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(InputServiceLinux);
};
} // namespace device
#endif // DEVICE_HID_INPUT_SERVICE_LINUX_H_
|
/* { dg-do compile } */
#define OUTER 32
#define INNER 40
static unsigned int
bar (const unsigned int x[INNER][2], unsigned int sum)
{
int i;
for (i = 0; i < INNER; i++)
sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
return sum;
}
unsigned int foo (const unsigned int x[OUTER][INNER][2])
{
int i;
unsigned int sum;
sum = 0.0f;
for (i = 0; i < OUTER; i++)
sum = bar (x[i], sum);
return sum;
}
/* { dg-final { scan-tree-dump-times "Detected interleaving of size 2" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
|
/**************************************************************************
*
* Copyright © 2012 VMware, Inc., Palo Alto, CA., USA
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#ifndef _VMWGFX_RESOURCE_PRIV_H_
#define _VMWGFX_RESOURCE_PRIV_H_
#include "vmwgfx_drv.h"
/**
* struct vmw_user_resource_conv - Identify a derived user-exported resource
* type and provide a function to convert its ttm_base_object pointer to
* a struct vmw_resource
*/
struct vmw_user_resource_conv {
enum ttm_object_type object_type;
struct vmw_resource *(*base_obj_to_res)(struct ttm_base_object *base);
void (*res_free) (struct vmw_resource *res);
};
/**
* struct vmw_res_func - members and functions common for a resource type
*
* @res_type: Enum that identifies the lru list to use for eviction.
* @needs_backup: Whether the resource is guest-backed and needs
* persistent buffer storage.
* @type_name: String that identifies the resource type.
* @backup_placement: TTM placement for backup buffers.
* @may_evict Whether the resource may be evicted.
* @create: Create a hardware resource.
* @destroy: Destroy a hardware resource.
* @bind: Bind a hardware resource to persistent buffer storage.
* @unbind: Unbind a hardware resource from persistent
* buffer storage.
*/
struct vmw_res_func {
enum vmw_res_type res_type;
bool needs_backup;
const char *type_name;
struct ttm_placement *backup_placement;
bool may_evict;
int (*create) (struct vmw_resource *res);
int (*destroy) (struct vmw_resource *res);
int (*bind) (struct vmw_resource *res,
struct ttm_validate_buffer *val_buf);
int (*unbind) (struct vmw_resource *res,
bool readback,
struct ttm_validate_buffer *val_buf);
};
int vmw_resource_alloc_id(struct vmw_resource *res);
void vmw_resource_release_id(struct vmw_resource *res);
int vmw_resource_init(struct vmw_private *dev_priv, struct vmw_resource *res,
bool delay_id,
void (*res_free) (struct vmw_resource *res),
const struct vmw_res_func *func);
void vmw_resource_activate(struct vmw_resource *res,
void (*hw_destroy) (struct vmw_resource *));
#endif
|
/*
* Copyright (c) 2010 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.
*/
#include "vp9/encoder/vp9_treewriter.h"
static void tree2tok(struct vp9_token *tokens, const vp9_tree_index *tree,
int i, int v, int l) {
v += v;
++l;
do {
const vp9_tree_index j = tree[i++];
if (j <= 0) {
tokens[-j].value = v;
tokens[-j].len = l;
} else {
tree2tok(tokens, tree, j, v, l);
}
} while (++v & 1);
}
void vp9_tokens_from_tree(struct vp9_token *tokens,
const vp9_tree_index *tree) {
tree2tok(tokens, tree, 0, 0, 0);
}
static unsigned int convert_distribution(unsigned int i, vp9_tree tree,
unsigned int branch_ct[][2],
const unsigned int num_events[]) {
unsigned int left, right;
if (tree[i] <= 0)
left = num_events[-tree[i]];
else
left = convert_distribution(tree[i], tree, branch_ct, num_events);
if (tree[i + 1] <= 0)
right = num_events[-tree[i + 1]];
else
right = convert_distribution(tree[i + 1], tree, branch_ct, num_events);
branch_ct[i >> 1][0] = left;
branch_ct[i >> 1][1] = right;
return left + right;
}
void vp9_tree_probs_from_distribution(vp9_tree tree,
unsigned int branch_ct[/* n-1 */][2],
const unsigned int num_events[/* n */]) {
convert_distribution(0, tree, branch_ct, num_events);
}
|
/*
* Copyright (c) 2007-2013 Nicira, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*/
#ifndef FLOW_H
#define FLOW_H 1
#include <linux/cache.h>
#include <linux/kernel.h>
#include <linux/netlink.h>
#include <linux/openvswitch.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/rcupdate.h>
#include <linux/if_ether.h>
#include <linux/in6.h>
#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/flex_array.h>
#include <net/inet_ecn.h>
struct sk_buff;
/* Used to memset ovs_key_ipv4_tunnel padding. */
#define OVS_TUNNEL_KEY_SIZE \
(offsetof(struct ovs_key_ipv4_tunnel, ipv4_ttl) + \
FIELD_SIZEOF(struct ovs_key_ipv4_tunnel, ipv4_ttl))
struct ovs_key_ipv4_tunnel {
__be64 tun_id;
__be32 ipv4_src;
__be32 ipv4_dst;
__be16 tun_flags;
u8 ipv4_tos;
u8 ipv4_ttl;
};
static inline void ovs_flow_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
const struct iphdr *iph, __be64 tun_id,
__be16 tun_flags)
{
tun_key->tun_id = tun_id;
tun_key->ipv4_src = iph->saddr;
tun_key->ipv4_dst = iph->daddr;
tun_key->ipv4_tos = iph->tos;
tun_key->ipv4_ttl = iph->ttl;
tun_key->tun_flags = tun_flags;
/* clear struct padding. */
memset((unsigned char *) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
}
struct sw_flow_key {
struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */
struct {
u32 priority; /* Packet QoS priority. */
u32 skb_mark; /* SKB mark. */
u16 in_port; /* Input switch port (or DP_MAX_PORTS). */
} phy;
struct {
u8 src[ETH_ALEN]; /* Ethernet source address. */
u8 dst[ETH_ALEN]; /* Ethernet destination address. */
__be16 tci; /* 0 if no VLAN, VLAN_TAG_PRESENT set otherwise. */
__be16 type; /* Ethernet frame type. */
} eth;
struct {
u8 proto; /* IP protocol or lower 8 bits of ARP opcode. */
u8 tos; /* IP ToS. */
u8 ttl; /* IP TTL/hop limit. */
u8 frag; /* One of OVS_FRAG_TYPE_*. */
} ip;
union {
struct {
struct {
__be32 src; /* IP source address. */
__be32 dst; /* IP destination address. */
} addr;
union {
struct {
__be16 src; /* TCP/UDP/SCTP source port. */
__be16 dst; /* TCP/UDP/SCTP destination port. */
__be16 flags; /* TCP flags. */
} tp;
struct {
u8 sha[ETH_ALEN]; /* ARP source hardware address. */
u8 tha[ETH_ALEN]; /* ARP target hardware address. */
} arp;
};
} ipv4;
struct {
struct {
struct in6_addr src; /* IPv6 source address. */
struct in6_addr dst; /* IPv6 destination address. */
} addr;
__be32 label; /* IPv6 flow label. */
struct {
__be16 src; /* TCP/UDP/SCTP source port. */
__be16 dst; /* TCP/UDP/SCTP destination port. */
__be16 flags; /* TCP flags. */
} tp;
struct {
struct in6_addr target; /* ND target address. */
u8 sll[ETH_ALEN]; /* ND source link layer address. */
u8 tll[ETH_ALEN]; /* ND target link layer address. */
} nd;
} ipv6;
};
} __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
struct sw_flow_key_range {
unsigned short int start;
unsigned short int end;
};
struct sw_flow_mask {
int ref_count;
struct rcu_head rcu;
struct list_head list;
struct sw_flow_key_range range;
struct sw_flow_key key;
};
struct sw_flow_match {
struct sw_flow_key *key;
struct sw_flow_key_range range;
struct sw_flow_mask *mask;
};
struct sw_flow_actions {
struct rcu_head rcu;
u32 actions_len;
struct nlattr actions[];
};
struct flow_stats {
u64 packet_count; /* Number of packets matched. */
u64 byte_count; /* Number of bytes matched. */
unsigned long used; /* Last used time (in jiffies). */
spinlock_t lock; /* Lock for atomic stats update. */
__be16 tcp_flags; /* Union of seen TCP flags. */
};
struct sw_flow_stats {
bool is_percpu;
union {
struct flow_stats *stat;
struct flow_stats __percpu *cpu_stats;
};
};
struct sw_flow {
struct rcu_head rcu;
struct hlist_node hash_node[2];
u32 hash;
struct sw_flow_key key;
struct sw_flow_key unmasked_key;
struct sw_flow_mask *mask;
struct sw_flow_actions __rcu *sf_acts;
struct sw_flow_stats stats;
};
struct arp_eth_header {
__be16 ar_hrd; /* format of hardware address */
__be16 ar_pro; /* format of protocol address */
unsigned char ar_hln; /* length of hardware address */
unsigned char ar_pln; /* length of protocol address */
__be16 ar_op; /* ARP opcode (command) */
/* Ethernet+IPv4 specific members. */
unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
unsigned char ar_sip[4]; /* sender IP address */
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
unsigned char ar_tip[4]; /* target IP address */
} __packed;
void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb);
void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *stats,
unsigned long *used, __be16 *tcp_flags);
void ovs_flow_stats_clear(struct sw_flow *flow);
u64 ovs_flow_used_time(unsigned long flow_jiffies);
int ovs_flow_extract(struct sk_buff *, u16 in_port, struct sw_flow_key *);
#endif /* flow.h */
|
/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* This header provides no interface for a user to the internals of
the gconv implementation in the libc. Therefore there is no use
for these definitions beside for writing additional gconv modules. */
#ifndef _GCONV_H
#define _GCONV_H 1
#include <features.h>
#define __need_mbstate_t
#define __need_wint_t
#include <wchar.h>
#define __need_size_t
#define __need_wchar_t
#include <stddef.h>
/* ISO 10646 value used to signal invalid value. */
#define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
/* Error codes for gconv functions. */
enum
{
__GCONV_OK = 0,
__GCONV_NOCONV,
__GCONV_NODB,
__GCONV_NOMEM,
__GCONV_EMPTY_INPUT,
__GCONV_FULL_OUTPUT,
__GCONV_ILLEGAL_INPUT,
__GCONV_INCOMPLETE_INPUT,
__GCONV_ILLEGAL_DESCRIPTOR,
__GCONV_INTERNAL_ERROR
};
/* Flags the `__gconv_open' function can set. */
enum
{
__GCONV_IS_LAST = 0x0001,
__GCONV_IGNORE_ERRORS = 0x0002,
__GCONV_SWAP = 0x0004
};
/* Forward declarations. */
struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;
/* Type of a conversion function. */
typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
const unsigned char **, const unsigned char *,
unsigned char **, size_t *, int, int);
/* Type of a specialized conversion function for a single byte to INTERNAL. */
typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);
/* Constructor and destructor for local data for conversion step. */
typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);
/* Type of a transliteration/transscription function. */
typedef int (*__gconv_trans_fct) (struct __gconv_step *,
struct __gconv_step_data *, void *,
const unsigned char *,
const unsigned char **,
const unsigned char *, unsigned char **,
size_t *);
/* Function to call to provide transliteration module with context. */
typedef int (*__gconv_trans_context_fct) (void *, const unsigned char *,
const unsigned char *,
unsigned char *, unsigned char *);
/* Function to query module about supported encoded character sets. */
typedef int (*__gconv_trans_query_fct) (const char *, const char ***,
size_t *);
/* Constructor and destructor for local data for transliteration. */
typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);
struct __gconv_trans_data
{
/* Transliteration/Transscription function. */
__gconv_trans_fct __trans_fct;
__gconv_trans_context_fct __trans_context_fct;
__gconv_trans_end_fct __trans_end_fct;
void *__data;
struct __gconv_trans_data *__next;
};
/* Description of a conversion step. */
struct __gconv_step
{
struct __gconv_loaded_object *__shlib_handle;
const char *__modname;
int __counter;
char *__from_name;
char *__to_name;
__gconv_fct __fct;
__gconv_btowc_fct __btowc_fct;
__gconv_init_fct __init_fct;
__gconv_end_fct __end_fct;
/* Information about the number of bytes needed or produced in this
step. This helps optimizing the buffer sizes. */
int __min_needed_from;
int __max_needed_from;
int __min_needed_to;
int __max_needed_to;
/* Flag whether this is a stateful encoding or not. */
int __stateful;
void *__data; /* Pointer to step-local data. */
};
/* Additional data for steps in use of conversion descriptor. This is
allocated by the `init' function. */
struct __gconv_step_data
{
unsigned char *__outbuf; /* Output buffer for this step. */
unsigned char *__outbufend; /* Address of first byte after the output
buffer. */
/* Is this the last module in the chain. */
int __flags;
/* Counter for number of invocations of the module function for this
descriptor. */
int __invocation_counter;
/* Flag whether this is an internal use of the module (in the mb*towc*
and wc*tomb* functions) or regular with iconv(3). */
int __internal_use;
__mbstate_t *__statep;
__mbstate_t __state; /* This element must not be used directly by
any module; always use STATEP! */
/* Transliteration information. */
struct __gconv_trans_data *__trans;
};
/* Combine conversion step description with data. */
typedef struct __gconv_info
{
size_t __nsteps;
struct __gconv_step *__steps;
__extension__ struct __gconv_step_data __data __flexarr;
} *__gconv_t;
#endif /* gconv.h */
|
/* contrib/arm-neon/android-ndk.c
*
* Copyright (c) 2014 Glenn Randers-Pehrson
* Written by John Bowler, 2014.
* Last changed in libpng 1.6.10 [March 6, 2014]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* SEE contrib/arm-neon/README before reporting bugs
*
* STATUS: COMPILED, UNTESTED
* BUG REPORTS: png-mng-implement@sourceforge.net
*
* png_have_neon implemented for the Android NDK, see:
*
* Documentation:
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
* https://code.google.com/p/android/issues/detail?id=49065
*
* NOTE: this requires that libpng is built against the Android NDK and linked
* with an implementation of the Android ARM 'cpu-features' library. The code
* has been compiled only, not linked: no version of the library has been found,
* only the header files exist in the NDK.
*/
#include <cpu-features.h>
static int
png_have_neon(png_structp png_ptr)
{
/* This is a whole lot easier than the linux code, however it is probably
* implemented as below, therefore it is better to cache the result (these
* function calls may be slow!)
*/
PNG_UNUSED(png_ptr)
return android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
}
|
/*
* STMicroelectronics st_lsm6dsx i2c driver
*
* Copyright 2016 STMicroelectronics Inc.
*
* Lorenzo Bianconi <lorenzo.bianconi@st.com>
* Denis Ciocca <denis.ciocca@st.com>
*
* Licensed under the GPL-2.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include "st_lsm6dsx.h"
static const struct regmap_config st_lsm6dsx_i2c_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int st_lsm6dsx_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
int hw_id = id->driver_data;
struct regmap *regmap;
regmap = devm_regmap_init_i2c(client, &st_lsm6dsx_i2c_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&client->dev, "Failed to register i2c regmap %d\n",
(int)PTR_ERR(regmap));
return PTR_ERR(regmap);
}
return st_lsm6dsx_probe(&client->dev, client->irq,
hw_id, id->name, regmap);
}
static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
{
.compatible = "st,lsm6ds3",
.data = (void *)ST_LSM6DS3_ID,
},
{
.compatible = "st,lsm6ds3h",
.data = (void *)ST_LSM6DS3H_ID,
},
{
.compatible = "st,lsm6dsl",
.data = (void *)ST_LSM6DSL_ID,
},
{
.compatible = "st,lsm6dsm",
.data = (void *)ST_LSM6DSM_ID,
},
{
.compatible = "st,ism330dlc",
.data = (void *)ST_ISM330DLC_ID,
},
{},
};
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
{ ST_LSM6DS3_DEV_NAME, ST_LSM6DS3_ID },
{ ST_LSM6DS3H_DEV_NAME, ST_LSM6DS3H_ID },
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
{},
};
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
static struct i2c_driver st_lsm6dsx_driver = {
.driver = {
.name = "st_lsm6dsx_i2c",
.pm = &st_lsm6dsx_pm_ops,
.of_match_table = of_match_ptr(st_lsm6dsx_i2c_of_match),
},
.probe = st_lsm6dsx_i2c_probe,
.id_table = st_lsm6dsx_i2c_id_table,
};
module_i2c_driver(st_lsm6dsx_driver);
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
MODULE_DESCRIPTION("STMicroelectronics st_lsm6dsx i2c driver");
MODULE_LICENSE("GPL v2");
|
/* Copyright (c) 2013, 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.
*
*/
#include "msm_sensor.h"
#define OV9724_SENSOR_NAME "ov9724"
DEFINE_MSM_MUTEX(ov9724_mut);
static struct msm_sensor_ctrl_t ov9724_s_ctrl;
static struct msm_sensor_power_setting ov9724_power_setting[] = {
{
.seq_type = SENSOR_VREG,
.seq_val = CAM_VANA,
.config_val = 0,
.delay = 0,
},
{
.seq_type = SENSOR_VREG,
.seq_val = CAM_VIO,
.config_val = 0,
.delay = 0,
},
{
.seq_type = SENSOR_VREG,
.seq_val = CAM_VDIG,
.config_val = 0,
.delay = 0,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_RESET,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_RESET,
.config_val = GPIO_OUT_HIGH,
.delay = 30,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_STANDBY,
.config_val = GPIO_OUT_LOW,
.delay = 5,
},
{
.seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_STANDBY,
.config_val = GPIO_OUT_HIGH,
.delay = 30,
},
{
.seq_type = SENSOR_CLK,
.seq_val = SENSOR_CAM_MCLK,
.config_val = 24000000,
.delay = 5,
},
{
.seq_type = SENSOR_I2C_MUX,
.seq_val = 0,
.config_val = 0,
.delay = 0,
},
};
static struct v4l2_subdev_info ov9724_subdev_info[] = {
{
.code = V4L2_MBUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_JPEG,
.fmt = 1,
.order = 0,
},
};
static const struct i2c_device_id ov9724_i2c_id[] = {
{OV9724_SENSOR_NAME, (kernel_ulong_t)&ov9724_s_ctrl},
{ }
};
static struct i2c_driver ov9724_i2c_driver = {
.id_table = ov9724_i2c_id,
.probe = msm_sensor_i2c_probe,
.driver = {
.name = OV9724_SENSOR_NAME,
},
};
static struct msm_camera_i2c_client ov9724_sensor_i2c_client = {
.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
};
static struct msm_sensor_ctrl_t ov9724_s_ctrl = {
.sensor_i2c_client = &ov9724_sensor_i2c_client,
.power_setting_array.power_setting = ov9724_power_setting,
.power_setting_array.size = ARRAY_SIZE(ov9724_power_setting),
.msm_sensor_mutex = &ov9724_mut,
.sensor_v4l2_subdev_info = ov9724_subdev_info,
.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov9724_subdev_info),
};
static const struct of_device_id ov9724_dt_match[] = {
{.compatible = "qcom,ov9724", .data = &ov9724_s_ctrl},
{}
};
MODULE_DEVICE_TABLE(of, ov9724_dt_match);
static struct platform_driver ov9724_platform_driver = {
.driver = {
.name = "qcom,ov9724",
.owner = THIS_MODULE,
.of_match_table = ov9724_dt_match,
},
};
static int32_t ov9724_platform_probe(struct platform_device *pdev)
{
int32_t rc = 0;
const struct of_device_id *match;
match = of_match_device(ov9724_dt_match, &pdev->dev);
rc = msm_sensor_platform_probe(pdev, match->data);
return rc;
}
static int __init ov9724_init_module(void)
{
int32_t rc = 0;
rc = platform_driver_probe(&ov9724_platform_driver,
ov9724_platform_probe);
if (!rc)
return rc;
return i2c_add_driver(&ov9724_i2c_driver);
}
static void __exit ov9724_exit_module(void)
{
if (ov9724_s_ctrl.pdev) {
msm_sensor_free_sensor_data(&ov9724_s_ctrl);
platform_driver_unregister(&ov9724_platform_driver);
} else
i2c_del_driver(&ov9724_i2c_driver);
return;
}
module_init(ov9724_init_module);
module_exit(ov9724_exit_module);
MODULE_DESCRIPTION("ov9724");
MODULE_LICENSE("GPL v2");
|
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2015, Intel 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.
*/
#ifndef __IA_CSS_MACC1_5_TYPES_H
#define __IA_CSS_MACC1_5_TYPES_H
/* @file
* CSS-API header file for Multi-Axis Color Conversion algorithm parameters.
*/
/* Multi-Axis Color Conversion configuration
*
* ISP2.6.1: MACC1_5 is used.
*/
/* Number of axes in the MACC table. */
#define IA_CSS_MACC_NUM_AXES 16
/* Number of coefficients per MACC axes. */
#define IA_CSS_MACC_NUM_COEFS 4
/* Multi-Axes Color Correction (MACC) table.
*
* ISP block: MACC (MACC by only matrix)
* MACC1_5 (MACC by matrix and exponent(ia_css_macc_config))
* ISP1: MACC is used.
* ISP2: MACC1_5 is used.
*
* [MACC]
* OutU = (data00 * InU + data01 * InV) >> 13
* OutV = (data10 * InU + data11 * InV) >> 13
*
* default/ineffective:
* OutU = (8192 * InU + 0 * InV) >> 13
* OutV = ( 0 * InU + 8192 * InV) >> 13
*
* [MACC1_5]
* OutU = (data00 * InU + data01 * InV) >> (13 - exp)
* OutV = (data10 * InU + data11 * InV) >> (13 - exp)
*
* default/ineffective: (exp=1)
* OutU = (4096 * InU + 0 * InV) >> (13 - 1)
* OutV = ( 0 * InU + 4096 * InV) >> (13 - 1)
*/
struct ia_css_macc1_5_table {
int16_t data[IA_CSS_MACC_NUM_COEFS * IA_CSS_MACC_NUM_AXES];
/** 16 of 2x2 matix
MACC1_5: s[macc_config.exp].[13-macc_config.exp], [-8192,8191]
default/ineffective: (s1.12)
16 of "identity 2x2 matix" {4096,0,0,4096} */
};
/* Multi-Axes Color Correction (MACC) configuration.
*
* ISP block: MACC1_5 (MACC by matrix and exponent(ia_css_macc_config))
* ISP2: MACC1_5 is used.
*/
struct ia_css_macc1_5_config {
uint8_t exp; /** Common exponent of ia_css_macc_table.
u8.0, [0,13], default 1, ineffective 1 */
};
#endif /* __IA_CSS_MACC1_5_TYPES_H */
|
/*
io_efa2.h by CyteX
Based on io_mpfc.h by chishm (Michael Chisholm)
Hardware Routines for reading the NAND flash located on
EFA2 flash carts
This software is completely free. No warranty is provided.
If you use it, please give me credit and email me about your
project at cytex <at> gmx <dot> de and do not forget to also
drop chishm <at> hotmail <dot> com a line
See gba_nds_fat.txt for help and license details.
*/
#ifndef IO_EFA2_H
#define IO_EFA2_H
// 'EFA2'
#define DEVICE_TYPE_EFA2 0x32414645
#include "disc_io.h"
// export interface
extern LPIO_INTERFACE EFA2_GetInterface(void);
#endif // define IO_EFA2_H
|
//-----------------------------------------------------------------------------
//
// DoorLock.h
//
// Implementation of the Z-Wave COMMAND_CLASS_DOOR_LOCK
//
// Copyright (c) 2014 Justin Hammond <justin@dynam.ac>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _DoorLock_H
#define _DoorLock_H
#include "CommandClass.h"
namespace OpenZWave
{
class ValueBool;
/** \brief Implements COMMAND_CLASS_DOOR_LOCK (0x62), a Z-Wave device command class.
*/
class DoorLock: public CommandClass
{
public:
static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new DoorLock( _homeId, _nodeId ); }
virtual ~DoorLock(){}
static uint8 const StaticGetCommandClassId(){ return 0x62; }
static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_DOOR_LOCK"; }
// From CommandClass
virtual void ReadXML( TiXmlElement const* _ccElement );
virtual void WriteXML( TiXmlElement* _ccElement );
virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue );
virtual bool RequestValue( uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue );
virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
virtual bool SetValue( Value const& _value );
virtual void SetValueBasic( uint8 const _instance, uint8 const _value );
protected:
virtual void CreateVars( uint8 const _instance );
private:
DoorLock( uint32 const _homeId, uint8 const _nodeId );
uint8 m_timeoutsupported;
uint8 m_insidehandlemode;
uint8 m_outsidehandlemode;
uint8 m_timeoutmins;
uint8 m_timeoutsecs;
};
} // namespace OpenZWave
#endif
|
/*
* AC-3 parser prototypes
* Copyright (c) 2003 Fabrice Bellard
* Copyright (c) 2003 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_AC3_PARSER_H
#define AVCODEC_AC3_PARSER_H
#include "ac3.h"
#include "get_bits.h"
/**
* Parse AC-3 frame header.
* Parse the header up to the lfeon element, which is the first 52 or 54 bits
* depending on the audio coding mode.
* @param[in] gbc BitContext containing the first 54 bits of the frame.
* @param[out] hdr Pointer to struct where header info is written.
* @return Returns 0 on success, -1 if there is a sync word mismatch,
* -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
* element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
*/
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
#endif /* AVCODEC_AC3_PARSER_H */
|
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import <Foundation/Foundation.h>
#import "SDWebImageDownloader.h"
#import "SDWebImageOperation.h"
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStartNotification;
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadReceiveResponseNotification;
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadStopNotification;
FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageDownloadFinishNotification;
/**
Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol
*/
@protocol SDWebImageDownloaderOperationInterface<NSObject>
- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
inSession:(nullable NSURLSession *)session
options:(SDWebImageDownloaderOptions)options;
- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
- (BOOL)shouldDecompressImages;
- (void)setShouldDecompressImages:(BOOL)value;
- (nullable NSURLCredential *)credential;
- (void)setCredential:(nullable NSURLCredential *)value;
@end
@interface SDWebImageDownloaderOperation : NSOperation <SDWebImageDownloaderOperationInterface, SDWebImageOperation, NSURLSessionTaskDelegate, NSURLSessionDataDelegate>
/**
* The request used by the operation's task.
*/
@property (strong, nonatomic, readonly, nullable) NSURLRequest *request;
/**
* The operation's task
*/
@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;
@property (assign, nonatomic) BOOL shouldDecompressImages;
/**
* Was used to determine whether the URL connection should consult the credential storage for authenticating the connection.
* @deprecated Not used for a couple of versions
*/
@property (nonatomic, assign) BOOL shouldUseCredentialStorage __deprecated_msg("Property deprecated. Does nothing. Kept only for backwards compatibility");
/**
* The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
*
* This will be overridden by any shared credentials that exist for the username or password of the request URL, if present.
*/
@property (nonatomic, strong, nullable) NSURLCredential *credential;
/**
* The SDWebImageDownloaderOptions for the receiver.
*/
@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options;
/**
* The expected size of data.
*/
@property (assign, nonatomic) NSInteger expectedSize;
/**
* The response returned by the operation's connection.
*/
@property (strong, nonatomic, nullable) NSURLResponse *response;
/**
* Initializes a `SDWebImageDownloaderOperation` object
*
* @see SDWebImageDownloaderOperation
*
* @param request the URL request
* @param session the URL session in which this operation will run
* @param options downloader options
*
* @return the initialized instance
*/
- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request
inSession:(nullable NSURLSession *)session
options:(SDWebImageDownloaderOptions)options NS_DESIGNATED_INITIALIZER;
/**
* Adds handlers for progress and completion. Returns a tokent that can be passed to -cancel: to cancel this set of
* callbacks.
*
* @param progressBlock the block executed when a new chunk of data arrives.
* @note the progress block is executed on a background queue
* @param completedBlock the block executed when the download is done.
* @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue
*
* @return the token to use to cancel this set of handlers
*/
- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
/**
* Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled.
*
* @param token the token representing a set of callbacks to cancel
*
* @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise.
*/
- (BOOL)cancel:(nullable id)token;
@end
|
/*
* Copyright (C) 2018 Intel Corp.
*
* 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:
* Rob Clark <robdclark@gmail.com>
* Daniel Vetter <daniel.vetter@ffwll.ch>
*/
#include <linux/types.h>
struct drm_crtc;
struct drm_crtc_state;
struct drm_plane;
struct drm_plane_state;
struct drm_connector;
struct drm_connector_state;
struct drm_private_obj;
struct drm_private_state;
struct drm_modeset_acquire_ctx;
struct drm_device;
void __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
struct drm_crtc_state *state);
void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
struct drm_crtc_state *state);
struct drm_crtc_state *
drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc);
void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state);
void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
struct drm_crtc_state *state);
void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
struct drm_plane_state *state);
void drm_atomic_helper_plane_reset(struct drm_plane *plane);
void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
struct drm_plane_state *state);
struct drm_plane_state *
drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane);
void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state);
void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
struct drm_plane_state *state);
void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
struct drm_connector_state *conn_state);
void drm_atomic_helper_connector_reset(struct drm_connector *connector);
void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector);
void
__drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
struct drm_connector_state *state);
struct drm_connector_state *
drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
void
__drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state);
void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
struct drm_connector_state *state);
void __drm_atomic_helper_private_obj_duplicate_state(struct drm_private_obj *obj,
struct drm_private_state *state);
|
/****************************************************************************
Copyright (c) 2009 On-Core
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (C) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.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.
****************************************************************************/
#ifndef __EFFECTS_CCGRABBER_H__
#define __EFFECTS_CCGRABBER_H__
#include "base/CCRef.h"
#include "platform/CCGL.h"
NS_CC_BEGIN
class Texture2D;
/**
* @addtogroup effects
* @{
*/
/** FBO class that grabs the the contents of the screen */
class Grabber : public Ref
{
public:
/**
* @js ctor
*/
Grabber(void);
/**
* @js NA
* @lua NA
*/
~Grabber(void);
void grab(Texture2D *texture);
void beforeRender(Texture2D *texture);
void afterRender(Texture2D *texture);
protected:
GLuint _FBO;
GLint _oldFBO;
GLfloat _oldClearColor[4];
};
// end of effects group
/// @}
NS_CC_END
#endif // __EFFECTS_CCGRABBER_H__
|
/* include/linux/if_pppopns.h
*
* Header for PPP on PPTP Network Server / PPPoPNS Socket (RFC 2637)
*
* Copyright (C) 2009 Google, Inc.
* Author: Chia-chi Yeh <chiachi@android.com>
*
* 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 __LINUX_IF_PPPOPNS_H
#define __LINUX_IF_PPPOPNS_H
#include <linux/socket.h>
#include <linux/types.h>
#define PX_PROTO_OPNS 4
struct sockaddr_pppopns {
sa_family_t sa_family; /* AF_PPPOX */
unsigned int sa_protocol; /* PX_PROTO_OPNS */
int tcp_socket;
__u16 local;
__u16 remote;
} __attribute__((packed));
#endif /* __LINUX_IF_PPPOPNS_H */
|
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* 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 Intel Corporation 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <errno.h>
#include <getopt.h>
#include <unistd.h>
#include <rte_common.h>
#include <rte_byteorder.h>
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_random.h>
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_ring.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
#include <rte_tcp.h>
#include <rte_lpm.h>
#include "main.h"
int
main(int argc, char **argv)
{
uint32_t lcore;
int ret;
/* Init EAL */
ret = rte_eal_init(argc, argv);
if (ret < 0)
return -1;
argc -= ret;
argv += ret;
/* Parse application arguments (after the EAL ones) */
ret = app_parse_args(argc, argv);
if (ret < 0) {
app_print_usage();
return -1;
}
/* Init */
app_init();
app_print_params();
/* Launch per-lcore init on every lcore */
rte_eal_mp_remote_launch(app_lcore_main_loop, NULL, CALL_MASTER);
RTE_LCORE_FOREACH_SLAVE(lcore) {
if (rte_eal_wait_lcore(lcore) < 0) {
return -1;
}
}
return 0;
}
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
/* WAVE files are little-endian */
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001
#define MS_ADPCM_CODE 0x0002
#define IEEE_FLOAT_CODE 0x0003
#define IMA_ADPCM_CODE 0x0011
#define MP3_CODE 0x0055
#define WAVE_MONO 1
#define WAVE_STEREO 2
/* Normally, these three chunks come consecutively in a WAVE file */
typedef struct WaveFMT
{
/* Not saved in the chunk we read:
Uint32 FMTchunk;
Uint32 fmtlen;
*/
Uint16 encoding;
Uint16 channels; /* 1 = mono, 2 = stereo */
Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
Uint32 byterate; /* Average bytes per second */
Uint16 blockalign; /* Bytes per sample block */
Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
} WaveFMT;
/* The general chunk found in the WAVE file */
typedef struct Chunk
{
Uint32 magic;
Uint32 length;
Uint8 *data;
} Chunk;
/* vi: set ts=4 sw=4 expandtab: */
|
/*
* Copyright (C) 2013 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <poll.h>
/* Function to be called when there are event for some descriptor */
typedef void (*poll_handler)(struct pollfd *pollfd);
int poll_register_fd(int fd, short events, poll_handler ph);
int poll_unregister_fd(int fd, poll_handler ph);
void poll_dispatch_loop(void);
|
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
#pragma once
using namespace System;
using namespace NUnit::Framework;
namespace NUnitSamples
{
[TestFixture]
public ref class SimpleCPPSample
{
int fValue1;
int fValue2;
public:
[SetUp] void Init();
[Test] void Add();
[Test] void DivideByZero();
[Test] void Equals();
[Test] [Ignore("ignored test")] void IgnoredTest();
[Test] [ExpectedException(InvalidOperationException::typeid)] void ExpectAnException();
};
}
|
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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 3, or (at your option) any later
version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This administrivia gets added to the beginning of limits.h
if the system has its own version of limits.h. */
/* We use _GCC_LIMITS_H_ because we want this not to match
any macros that the system's limits.h uses for its own purposes. */
#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
#define _GCC_LIMITS_H_
#ifndef _LIBC_LIMITS_H_
/* Use "..." so that we find syslimits.h only in this same directory. */
#include "syslimits.h"
#endif
/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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 3, or (at your option) any later
version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _LIMITS_H___
#define _LIMITS_H___
/* Number of bits in a `char'. */
#undef CHAR_BIT
#define CHAR_BIT __CHAR_BIT__
/* Maximum length of a multibyte character. */
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
/* Minimum and maximum values a `signed char' can hold. */
#undef SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX - 1)
#undef SCHAR_MAX
#define SCHAR_MAX __SCHAR_MAX__
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
#undef UCHAR_MAX
#if __SCHAR_MAX__ == __INT_MAX__
# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
#else
# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#endif
/* Minimum and maximum values a `char' can hold. */
#ifdef __CHAR_UNSIGNED__
# undef CHAR_MIN
# if __SCHAR_MAX__ == __INT_MAX__
# define CHAR_MIN 0U
# else
# define CHAR_MIN 0
# endif
# undef CHAR_MAX
# define CHAR_MAX UCHAR_MAX
#else
# undef CHAR_MIN
# define CHAR_MIN SCHAR_MIN
# undef CHAR_MAX
# define CHAR_MAX SCHAR_MAX
#endif
/* Minimum and maximum values a `signed short int' can hold. */
#undef SHRT_MIN
#define SHRT_MIN (-SHRT_MAX - 1)
#undef SHRT_MAX
#define SHRT_MAX __SHRT_MAX__
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
#undef USHRT_MAX
#if __SHRT_MAX__ == __INT_MAX__
# define USHRT_MAX (SHRT_MAX * 2U + 1U)
#else
# define USHRT_MAX (SHRT_MAX * 2 + 1)
#endif
/* Minimum and maximum values a `signed int' can hold. */
#undef INT_MIN
#define INT_MIN (-INT_MAX - 1)
#undef INT_MAX
#define INT_MAX __INT_MAX__
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
#undef UINT_MAX
#define UINT_MAX (INT_MAX * 2U + 1U)
/* Minimum and maximum values a `signed long int' can hold.
(Same as `int'). */
#undef LONG_MIN
#define LONG_MIN (-LONG_MAX - 1L)
#undef LONG_MAX
#define LONG_MAX __LONG_MAX__
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
#undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LLONG_MIN
# define LLONG_MIN (-LLONG_MAX - 1LL)
# undef LLONG_MAX
# define LLONG_MAX __LONG_LONG_MAX__
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULLONG_MAX
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LONG_LONG_MIN
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
# undef LONG_LONG_MAX
# define LONG_LONG_MAX __LONG_LONG_MAX__
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULONG_LONG_MAX
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
#endif
#endif /* _LIMITS_H___ */
/* This administrivia gets added to the end of limits.h
if the system has its own version of limits.h. */
#else /* not _GCC_LIMITS_H_ */
#ifdef _GCC_NEXT_LIMITS_H
#include_next <limits.h> /* recurse down to the real one */
#endif
#endif /* not _GCC_LIMITS_H_ */
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* lib/lshrdi3.c
*/
#include <linux/module.h>
#include <linux/libgcc.h>
long long notrace __lshrdi3(long long u, word_type b)
{
DWunion uu, w;
word_type bm;
if (b == 0)
return u;
uu.ll = u;
bm = 32 - b;
if (bm <= 0) {
w.s.high = 0;
w.s.low = (unsigned int) uu.s.high >> -bm;
} else {
const unsigned int carries = (unsigned int) uu.s.high << bm;
w.s.high = (unsigned int) uu.s.high >> b;
w.s.low = ((unsigned int) uu.s.low >> b) | carries;
}
return w.ll;
}
EXPORT_SYMBOL(__lshrdi3);
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/*============================================================
**
** Source: test.c
**
** Purpose: IsBadReadPtr() function
**
**
**=========================================================*/
#include <palsuite.h>
#define MEMORY_AMOUNT 16
int __cdecl main(int argc, char *argv[])
{
LPVOID TestingPointer = NULL;
BOOL ResultValue = 0;
/*
* Initialize the PAL and return FAILURE if this fails
*/
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
TestingPointer = malloc(MEMORY_AMOUNT);
if ( TestingPointer == NULL )
{
Fail("ERROR: Failed to allocate memory for TestingPointer pointer. "
"Can't properly exec test case without this.\n");
}
/* This should be readable, and return 0 */
ResultValue = IsBadReadPtr(TestingPointer,MEMORY_AMOUNT);
if(ResultValue != 0)
{
free(TestingPointer);
Fail("ERROR: The function returned %d instead of 0, when pointing "
"at readable memory.\n",ResultValue);
}
/* If we pass 0, the result should be 0 as well */
ResultValue = IsBadReadPtr(TestingPointer,0);
if(ResultValue != 0)
{
free(TestingPointer);
Fail("ERROR: The function returned %d instead of 0, when the "
"function was passed a range of 0 bytes.\n",ResultValue);
}
free(TestingPointer); /* we are done with this */
/* create a READABLE address */
TestingPointer = VirtualAlloc(
NULL, /* system selects address */
80, /* size of allocation*/
MEM_COMMIT, /* commit */
PAGE_READONLY); /* protection = read only */
if (TestingPointer == NULL )
{
Fail("ERROR: call to VirtualAlloc failed\n");
}
ResultValue = IsBadReadPtr(TestingPointer,16);
if(ResultValue != 0) /* if no access */
{
if(!VirtualFree(TestingPointer, 0, MEM_RELEASE))
{
Trace("ERROR: Call to VirtualFree failed with error"
" code[ %u ]\n",GetLastError());
}
Fail("ERROR: The function returned %d instead of 1 when checking "
"on unreadable memory.\n",ResultValue);
}
if(!VirtualFree(TestingPointer,0, MEM_RELEASE))
{
Fail("ERROR: Call to VirtualFree failed with error"
" code[ %u ]\n",GetLastError());
}
/* create an unreadable address */
TestingPointer = VirtualAlloc(
NULL, /* system selects address */
80, /* size of allocation */
MEM_COMMIT, /* commit */
PAGE_NOACCESS); /* protection = no access */
if (TestingPointer == NULL )
{
Fail("ERROR: call to VirtualAlloc failed\n");
}
ResultValue = IsBadReadPtr(TestingPointer,16);
if(ResultValue == 0) /* if access */
{
if(!VirtualFree(TestingPointer, 0, MEM_RELEASE))
{
Trace("ERROR: Call to VirtualFree failed with error"
" code[ %u ]\n",GetLastError());
}
Fail("ERROR: The function returned %d instead of 1 when checking "
"on unreadable memory.\n",ResultValue);
}
if(!VirtualFree(TestingPointer,0, MEM_RELEASE))
{
Fail("ERROR: Call to VirtualFree failed with error"
" code[ %u ]\n",GetLastError());
}
/* This should be unreadable and return 1 */
ResultValue = IsBadReadPtr(NULL,16);
if(ResultValue != 1)
{
Fail("ERROR: The function returned %d instead of 1 when checking "
"to see if NULL was readable.\n",ResultValue);
}
PAL_Terminate();
return PASS;
}
|
// SPDX-License-Identifier: GPL-2.0-or-later
/* early printk support
*
* Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
* Copyright (c) 2009 Lemote Inc.
* Author: Wu Zhangjin, wuzhangjin@gmail.com
*/
#include <linux/serial_reg.h>
#include <asm/setup.h>
#include <loongson.h>
#define PORT(base, offset) (u8 *)(base + offset)
static inline unsigned int serial_in(unsigned char *base, int offset)
{
return readb(PORT(base, offset));
}
static inline void serial_out(unsigned char *base, int offset, int value)
{
writeb(value, PORT(base, offset));
}
void prom_putchar(char c)
{
int timeout;
unsigned char *uart_base;
uart_base = (unsigned char *)_loongson_uart_base[0];
timeout = 1024;
while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
(timeout-- > 0))
;
serial_out(uart_base, UART_TX, c);
}
|
/* -*- c++ -*- */
/*
* Copyright 2006,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio 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 3, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H
#define INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H
#include <gnuradio/digital/diff_phasor_cc.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace digital {
class diff_phasor_cc_impl : public diff_phasor_cc
{
public:
diff_phasor_cc_impl();
~diff_phasor_cc_impl();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} /* namespace digital */
} /* namespace gr */
#endif /* INCLUDED_GR_DIFF_PHASOR_CC_IMPL_H */
|
#include <string.h>
extern int __strncasecmp_l_nonascii (const char *__s1, const char *__s2,
size_t __n, __locale_t __loc);
#define __strncasecmp_l __strncasecmp_l_nonascii
#define USE_IN_EXTENDED_LOCALE_MODEL 1
#include <string/strncase.c>
|
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
* Copyright (c) 2010-2011, Willow Garage, 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.
* * 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 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.
*
* $Id$
*
*/
#ifndef PCL_IO_LZF_H
#define PCL_IO_LZF_H
#include <pcl/pcl_macros.h>
namespace pcl
{
/** \brief Compress in_len bytes stored at the memory block starting at
* \a in_data and write the result to \a out_data, up to a maximum length
* of \a out_len bytes using Marc Lehmann's LZF algorithm.
*
* If the output buffer is not large enough or any error occurs return 0,
* otherwise return the number of bytes used, which might be considerably
* more than in_len (but less than 104% of the original size), so it
* makes sense to always use out_len == in_len - 1), to ensure _some_
* compression, and store the data uncompressed otherwise (with a flag, of
* course.
*
* \note The buffers must not be overlapping.
*
* \param[in] in_data the input uncompressed buffer
* \param[in] in_len the length of the input buffer
* \param[out] out_data the output buffer where the compressed result will be stored
* \param[out] out_len the length of the output buffer
*
*/
PCL_EXPORTS unsigned int
lzfCompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
/** \brief Decompress data compressed with the \a lzfCompress function and
* stored at location \a in_data and length \a in_len. The result will be
* stored at \a out_data up to a maximum of \a out_len characters.
*
* If the output buffer is not large enough to hold the decompressed
* data, a 0 is returned and errno is set to E2BIG. Otherwise the number
* of decompressed bytes (i.e. the original length of the data) is
* returned.
*
* If an error in the compressed data is detected, a zero is returned and
* errno is set to EINVAL.
*
* This function is very fast, about as fast as a copying loop.
* \param[in] in_data the input compressed buffer
* \param[in] in_len the length of the input buffer
* \param[out] out_data the output buffer (must be resized to \a out_len)
* \param[out] out_len the length of the output buffer
*/
PCL_EXPORTS unsigned int
lzfDecompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
}
#endif /* PCL_IO_LZF */
|
/***************************************************************************/
/* */
/* sfntpic.c */
/* */
/* The FreeType position independent code services for sfnt module. */
/* */
/* Copyright 2009, 2010 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_OBJECTS_H
#include "sfntpic.h"
#include "sferrors.h"
#ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from sfdriver.c */
FT_Error
FT_Create_Class_sfnt_services( FT_Library library,
FT_ServiceDescRec** ouput_class );
void
FT_Destroy_Class_sfnt_services( FT_Library library,
FT_ServiceDescRec* clazz );
void
FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz );
void
FT_Init_Class_sfnt_interface( FT_Library library,
SFNT_Interface* clazz );
void
FT_Init_Class_sfnt_service_glyph_dict(
FT_Library library,
FT_Service_GlyphDictRec* clazz );
void
FT_Init_Class_sfnt_service_ps_name(
FT_Library library,
FT_Service_PsFontNameRec* clazz );
void
FT_Init_Class_tt_service_get_cmap_info(
FT_Library library,
FT_Service_TTCMapsRec* clazz );
void
FT_Init_Class_sfnt_service_sfnt_table(
FT_Service_SFNT_TableRec* clazz );
/* forward declaration of PIC init functions from ttcmap.c */
FT_Error
FT_Create_Class_tt_cmap_classes( FT_Library library,
TT_CMap_Class** output_class );
void
FT_Destroy_Class_tt_cmap_classes( FT_Library library,
TT_CMap_Class* clazz );
void
sfnt_module_class_pic_free( FT_Library library )
{
FT_PIC_Container* pic_container = &library->pic_container;
FT_Memory memory = library->memory;
if ( pic_container->sfnt )
{
sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt;
if ( container->sfnt_services )
FT_Destroy_Class_sfnt_services( library,
container->sfnt_services );
container->sfnt_services = NULL;
if ( container->tt_cmap_classes )
FT_Destroy_Class_tt_cmap_classes( library,
container->tt_cmap_classes );
container->tt_cmap_classes = NULL;
FT_FREE( container );
pic_container->sfnt = NULL;
}
}
FT_Error
sfnt_module_class_pic_init( FT_Library library )
{
FT_PIC_Container* pic_container = &library->pic_container;
FT_Error error = SFNT_Err_Ok;
sfntModulePIC* container;
FT_Memory memory = library->memory;
/* allocate pointer, clear and set global container pointer */
if ( FT_ALLOC ( container, sizeof ( *container ) ) )
return error;
FT_MEM_SET( container, 0, sizeof ( *container ) );
pic_container->sfnt = container;
/* initialize pointer table - this is how the module usually expects this data */
error = FT_Create_Class_sfnt_services( library,
&container->sfnt_services );
if ( error )
goto Exit;
error = FT_Create_Class_tt_cmap_classes( library,
&container->tt_cmap_classes );
if ( error )
goto Exit;
FT_Init_Class_sfnt_service_glyph_dict(
library, &container->sfnt_service_glyph_dict );
FT_Init_Class_sfnt_service_ps_name(
library, &container->sfnt_service_ps_name );
FT_Init_Class_tt_service_get_cmap_info(
library, &container->tt_service_get_cmap_info );
FT_Init_Class_sfnt_service_sfnt_table(
&container->sfnt_service_sfnt_table );
#ifdef TT_CONFIG_OPTION_BDF
FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf );
#endif
FT_Init_Class_sfnt_interface( library, &container->sfnt_interface );
Exit:
if ( error )
sfnt_module_class_pic_free( library );
return error;
}
#endif /* FT_CONFIG_OPTION_PIC */
/* END */
|
/* Copyright 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. */
#include "nacl_io/kernel_intercept.h"
#include "nacl_io/kernel_wrap.h"
#if defined(PROVIDES_SOCKET_API) && !defined(__GLIBC__)
int socket(int domain, int type, int protocol) {
return ki_socket(domain, type, protocol);
}
#endif /* defined(PROVIDES_SOCKET_API) && !defined(__GLIBC__) */
|
/* PR tree-optimization/64715 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
void bar (char *, int);
void
foo (int x)
{
char p[16], *q;
q = p;
if (x)
q = p + 3;
__builtin___strcpy_chk (q, "abcdefghijkl", __builtin_object_size (q, 1));
bar (p, x);
}
/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, \"abcdefghijkl\", 13\\\);" "optimized" } } */
|
// Copyright (c) 2008 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.
// Written in NSPR style to also be suitable for adding to the NSS demo suite
#ifndef __MEMIO_H
#define __MEMIO_H
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "prio.h"
/* Opaque structure. Really just a more typesafe alias for PRFilePrivate. */
struct memio_Private;
typedef struct memio_Private memio_Private;
/*----------------------------------------------------------------------
NSPR I/O layer that terminates in a pair of circular buffers
rather than talking to the real network.
To use this with NSS:
1) call memio_CreateIOLayer to create a fake NSPR socket
2) call SSL_ImportFD to ssl-ify the socket
3) Do your own networking calls to set up a TCP connection
4) call memio_SetPeerName to tell NSS about the other end of the connection
5) While at the same time doing plaintext nonblocking NSPR I/O as
usual to the nspr file descriptor returned by SSL_ImportFD,
your app must shuttle encrypted data between
the real network and memio's network buffers.
memio_GetReadParams/memio_PutReadResult
are the hooks you need to pump data into memio's input buffer,
and memio_GetWriteParams/memio_PutWriteResult
are the hooks you need to pump data out of memio's output buffer.
----------------------------------------------------------------------*/
/* Create the I/O layer and its two circular buffers. */
PRFileDesc *memio_CreateIOLayer(int bufsize);
/* Must call before trying to make an ssl connection */
void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername);
/* Return a private pointer needed by the following
* four functions. (We could have passed a PRFileDesc to
* them, but that would be slower. Better for the caller
* to grab the pointer once and cache it.
* This may be a premature optimization.)
*/
memio_Private *memio_GetSecret(PRFileDesc *fd);
/* Ask memio where to put bytes from the network, and how many it can handle.
* Returns bytes available to write, or 0 if none available.
* Puts current buffer position into *buf.
*/
int memio_GetReadParams(memio_Private *secret, char **buf);
/* Tell memio how many bytes were read from the network.
* If bytes_read is 0, causes EOF to be reported to
* NSS after it reads the last byte from the circular buffer.
* If bytes_read is < 0, it is treated as an NSPR error code.
* See nspr/pr/src/md/unix/unix_errors.c for how to
* map from Unix errors to NSPR error codes.
* On EWOULDBLOCK or the equivalent, don't call this function.
*/
void memio_PutReadResult(memio_Private *secret, int bytes_read);
/* Ask memio what data it has to send to the network.
* Returns up to two buffers of data by writing the positions and lengths into
* |buf1|, |len1| and |buf2|, |len2|.
*/
void memio_GetWriteParams(memio_Private *secret,
const char **buf1, unsigned int *len1,
const char **buf2, unsigned int *len2);
/* Tell memio how many bytes were sent to the network.
* If bytes_written is < 0, it is treated as an NSPR error code.
* See nspr/pr/src/md/unix/unix_errors.c for how to
* map from Unix errors to NSPR error codes.
* On EWOULDBLOCK or the equivalent, don't call this function.
*/
void memio_PutWriteResult(memio_Private *secret, int bytes_written);
#ifdef __cplusplus
}
#endif
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _XFRM_HASH_H
#define _XFRM_HASH_H
#include <linux/xfrm.h>
#include <linux/socket.h>
#include <linux/jhash.h>
static inline unsigned int __xfrm4_addr_hash(const xfrm_address_t *addr)
{
return ntohl(addr->a4);
}
static inline unsigned int __xfrm6_addr_hash(const xfrm_address_t *addr)
{
return jhash2((__force u32 *)addr->a6, 4, 0);
}
static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr)
{
u32 sum = (__force u32)daddr->a4 + (__force u32)saddr->a4;
return ntohl((__force __be32)sum);
}
static inline unsigned int __xfrm6_daddr_saddr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr)
{
return __xfrm6_addr_hash(daddr) ^ __xfrm6_addr_hash(saddr);
}
static inline u32 __bits2mask32(__u8 bits)
{
u32 mask32 = 0xffffffff;
if (bits == 0)
mask32 = 0;
else if (bits < 32)
mask32 <<= (32 - bits);
return mask32;
}
static inline unsigned int __xfrm4_dpref_spref_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
__u8 dbits,
__u8 sbits)
{
return jhash_2words(ntohl(daddr->a4) & __bits2mask32(dbits),
ntohl(saddr->a4) & __bits2mask32(sbits),
0);
}
static inline unsigned int __xfrm6_pref_hash(const xfrm_address_t *addr,
__u8 prefixlen)
{
unsigned int pdw;
unsigned int pbi;
u32 initval = 0;
pdw = prefixlen >> 5; /* num of whole u32 in prefix */
pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
if (pbi) {
__be32 mask;
mask = htonl((0xffffffff) << (32 - pbi));
initval = (__force u32)(addr->a6[pdw] & mask);
}
return jhash2((__force u32 *)addr->a6, pdw, initval);
}
static inline unsigned int __xfrm6_dpref_spref_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
__u8 dbits,
__u8 sbits)
{
return __xfrm6_pref_hash(daddr, dbits) ^
__xfrm6_pref_hash(saddr, sbits);
}
static inline unsigned int __xfrm_dst_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
u32 reqid, unsigned short family,
unsigned int hmask)
{
unsigned int h = family ^ reqid;
switch (family) {
case AF_INET:
h ^= __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
h ^= __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
return (h ^ (h >> 16)) & hmask;
}
static inline unsigned int __xfrm_src_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family,
unsigned int hmask)
{
unsigned int h = family;
switch (family) {
case AF_INET:
h ^= __xfrm4_daddr_saddr_hash(daddr, saddr);
break;
case AF_INET6:
h ^= __xfrm6_daddr_saddr_hash(daddr, saddr);
break;
}
return (h ^ (h >> 16)) & hmask;
}
static inline unsigned int
__xfrm_spi_hash(const xfrm_address_t *daddr, __be32 spi, u8 proto,
unsigned short family, unsigned int hmask)
{
unsigned int h = (__force u32)spi ^ proto;
switch (family) {
case AF_INET:
h ^= __xfrm4_addr_hash(daddr);
break;
case AF_INET6:
h ^= __xfrm6_addr_hash(daddr);
break;
}
return (h ^ (h >> 10) ^ (h >> 20)) & hmask;
}
static inline unsigned int __idx_hash(u32 index, unsigned int hmask)
{
return (index ^ (index >> 8)) & hmask;
}
static inline unsigned int __sel_hash(const struct xfrm_selector *sel,
unsigned short family, unsigned int hmask,
u8 dbits, u8 sbits)
{
const xfrm_address_t *daddr = &sel->daddr;
const xfrm_address_t *saddr = &sel->saddr;
unsigned int h = 0;
switch (family) {
case AF_INET:
if (sel->prefixlen_d < dbits ||
sel->prefixlen_s < sbits)
return hmask + 1;
h = __xfrm4_dpref_spref_hash(daddr, saddr, dbits, sbits);
break;
case AF_INET6:
if (sel->prefixlen_d < dbits ||
sel->prefixlen_s < sbits)
return hmask + 1;
h = __xfrm6_dpref_spref_hash(daddr, saddr, dbits, sbits);
break;
}
h ^= (h >> 16);
return h & hmask;
}
static inline unsigned int __addr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr,
unsigned short family,
unsigned int hmask,
u8 dbits, u8 sbits)
{
unsigned int h = 0;
switch (family) {
case AF_INET:
h = __xfrm4_dpref_spref_hash(daddr, saddr, dbits, sbits);
break;
case AF_INET6:
h = __xfrm6_dpref_spref_hash(daddr, saddr, dbits, sbits);
break;
}
h ^= (h >> 16);
return h & hmask;
}
struct hlist_head *xfrm_hash_alloc(unsigned int sz);
void xfrm_hash_free(struct hlist_head *n, unsigned int sz);
#endif /* _XFRM_HASH_H */
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdlib.h>
#include <string.h>
char *bus_label_escape(const char *s);
char *bus_label_unescape_n(const char *f, size_t l);
static inline char *bus_label_unescape(const char *f) {
return bus_label_unescape_n(f, f ? strlen(f) : 0);
}
|
/* elfcomm.h -- include file of common code for ELF format file.
Copyright 2010
Free Software Foundation, Inc.
Originally developed by Eric Youngdale <eric@andante.jic.com>
Modifications by Nick Clifton <nickc@redhat.com>
This file is part of GNU Binutils.
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 3 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 Street - Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef _ELFCOMM_H
#define _ELFCOMM_H
#include "aout/ar.h"
void error (const char *, ...) ATTRIBUTE_PRINTF_1;
void warn (const char *, ...) ATTRIBUTE_PRINTF_1;
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
/* We can't use any bfd types here since readelf may define BFD64 and
objdump may not. */
#define HOST_WIDEST_INT long long
#else
#define HOST_WIDEST_INT long
#endif
typedef unsigned HOST_WIDEST_INT elf_vma;
extern void (*byte_put) (unsigned char *, elf_vma, int);
extern void byte_put_little_endian (unsigned char *, elf_vma, int);
extern void byte_put_big_endian (unsigned char *, elf_vma, int);
extern elf_vma (*byte_get) (unsigned char *, int);
extern elf_vma byte_get_signed (unsigned char *, int);
extern elf_vma byte_get_little_endian (unsigned char *, int);
extern elf_vma byte_get_big_endian (unsigned char *, int);
extern void byte_get_64 (unsigned char *, elf_vma *, elf_vma *);
#define BYTE_PUT(field, val) byte_put (field, val, sizeof (field))
#define BYTE_GET(field) byte_get (field, sizeof (field))
#define BYTE_GET_SIGNED(field) byte_get_signed (field, sizeof (field))
/* This is just a bit of syntatic sugar. */
#define streq(a,b) (strcmp ((a), (b)) == 0)
#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
#define const_strneq(a,b) (strncmp ((a), (b), sizeof (b) - 1) == 0)
/* Structure to hold information about an archive file. */
struct archive_info
{
char * file_name; /* Archive file name. */
FILE * file; /* Open file descriptor. */
elf_vma index_num; /* Number of symbols in table. */
elf_vma * index_array; /* The array of member offsets. */
char * sym_table; /* The symbol table. */
unsigned long sym_size; /* Size of the symbol table. */
char * longnames; /* The long file names table. */
unsigned long longnames_size; /* Size of the long file names table. */
unsigned long nested_member_origin; /* Origin in the nested archive of the current member. */
unsigned long next_arhdr_offset; /* Offset of the next archive header. */
bfd_boolean is_thin_archive; /* TRUE if this is a thin archive. */
bfd_boolean uses_64bit_indicies; /* TRUE if the index table uses 64bit entries. */
struct ar_hdr arhdr; /* Current archive header. */
};
/* Return the path name for a proxy entry in a thin archive. */
extern char *adjust_relative_path (const char *, const char *, int);
/* Read the symbol table and long-name table from an archive. */
extern int setup_archive (struct archive_info *, const char *, FILE *,
bfd_boolean, bfd_boolean);
/* Open and setup a nested archive, if not already open. */
extern int setup_nested_archive (struct archive_info *, const char *);
/* Release the memory used for the archive information. */
extern void release_archive (struct archive_info *);
/* Get the name of an archive member from the current archive header. */
extern char *get_archive_member_name (struct archive_info *,
struct archive_info *);
/* Get the name of an archive member at a given offset within an
archive. */
extern char *get_archive_member_name_at (struct archive_info *,
unsigned long,
struct archive_info *);
/* Construct a string showing the name of the archive member, qualified
with the name of the containing archive file. */
extern char *make_qualified_name (struct archive_info *,
struct archive_info *,
const char *);
#endif /* _ELFCOMM_H */
|
#include "clar_libgit2.h"
static git_remote *_remote;
static git_repository *_repo;
static git_config *_config;
static char url[] = "http://github.com/libgit2/libgit2.git";
void test_network_remote_createthenload__initialize(void)
{
cl_fixture_sandbox("testrepo.git");
cl_git_pass(git_repository_open(&_repo, "testrepo.git"));
cl_git_pass(git_repository_config(&_config, _repo));
cl_git_pass(git_config_set_string(_config, "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"));
cl_git_pass(git_config_set_string(_config, "remote.origin.url", url));
git_config_free(_config);
cl_git_pass(git_remote_lookup(&_remote, _repo, "origin"));
}
void test_network_remote_createthenload__cleanup(void)
{
git_remote_free(_remote);
_remote = NULL;
git_repository_free(_repo);
_repo = NULL;
cl_fixture_cleanup("testrepo.git");
}
void test_network_remote_createthenload__parsing(void)
{
cl_assert_equal_s(git_remote_name(_remote), "origin");
cl_assert_equal_s(git_remote_url(_remote), url);
}
|
#ifndef __UAPI_CORESIGHT_STM_H_
#define __UAPI_CORESIGHT_STM_H_
enum {
OST_ENTITY_NONE = 0x00,
OST_ENTITY_FTRACE_EVENTS = 0x01,
OST_ENTITY_TRACE_PRINTK = 0x02,
OST_ENTITY_TRACE_MARKER = 0x04,
OST_ENTITY_DEV_NODE = 0x08,
OST_ENTITY_DIAG = 0xEE,
OST_ENTITY_QVIEW = 0xFE,
OST_ENTITY_MAX = 0xFF,
};
enum {
STM_OPTION_NONE = 0x0,
STM_OPTION_TIMESTAMPED = 0x08,
STM_OPTION_GUARANTEED = 0x80,
};
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NET_NS_HASH_H__
#define __NET_NS_HASH_H__
#include <net/net_namespace.h>
static inline u32 net_hash_mix(const struct net *net)
{
return net->hash_mix;
}
#endif
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#ifndef __AP_HAL_PX4_ANALOGIN_H__
#define __AP_HAL_PX4_ANALOGIN_H__
#include "AP_HAL_PX4.h"
#include <pthread.h>
#include <uORB/uORB.h>
#define PX4_ANALOG_MAX_CHANNELS 16
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
// these are virtual pins that read from the ORB
#define PX4_ANALOG_ORB_BATTERY_VOLTAGE_PIN 100
#define PX4_ANALOG_ORB_BATTERY_CURRENT_PIN 101
#elif defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
#define PX4_ANALOG_VCC_5V_PIN 4
#define PX4_ANALOG_ORB_SERVO_VOLTAGE_PIN 102
#define PX4_ANALOG_ORB_SERVO_VRSSI_PIN 103
#endif
class PX4::PX4AnalogSource : public AP_HAL::AnalogSource {
public:
friend class PX4::PX4AnalogIn;
PX4AnalogSource(int16_t pin, float initial_value);
float read_average();
float read_latest();
void set_pin(uint8_t p);
float voltage_average();
float voltage_latest();
float voltage_average_ratiometric();
// implement stop pins
void set_stop_pin(uint8_t p);
void set_settle_time(uint16_t settle_time_ms) { _settle_time_ms = settle_time_ms; }
private:
// what pin it is attached to
int16_t _pin;
int16_t _stop_pin;
uint16_t _settle_time_ms;
// what value it has
float _value;
float _value_ratiometric;
float _latest_value;
uint8_t _sum_count;
float _sum_value;
float _sum_ratiometric;
void _add_value(float v, float vcc5V);
float _pin_scaler();
};
class PX4::PX4AnalogIn : public AP_HAL::AnalogIn {
public:
PX4AnalogIn();
void init(void* implspecific);
AP_HAL::AnalogSource* channel(int16_t pin);
void _timer_tick(void);
float board_voltage(void) { return _board_voltage; }
float servorail_voltage(void) { return _servorail_voltage; }
uint16_t power_status_flags(void) { return _power_flags; }
private:
int _adc_fd;
int _battery_handle;
int _servorail_handle;
int _system_power_handle;
uint64_t _battery_timestamp;
uint64_t _servorail_timestamp;
PX4::PX4AnalogSource* _channels[PX4_ANALOG_MAX_CHANNELS];
// what pin is currently held low to stop a sonar from reading
uint8_t _current_stop_pin_i;
uint32_t _stop_pin_change_time;
uint32_t _last_run;
float _board_voltage;
float _servorail_voltage;
uint16_t _power_flags;
void next_stop_pin(void);
};
#endif // __AP_HAL_PX4_ANALOGIN_H__
|
/*
* QEMU live migration via Unix Domain Sockets
*
* Copyright Red Hat, Inc. 2009
*
* Authors:
* Chris Lalancette <clalance@redhat.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
* Contributions after 2012-01-13 are licensed under the terms of the
* GNU GPL, version 2 or (at your option) any later version.
*/
#include "qemu-common.h"
#include "qemu_socket.h"
#include "migration.h"
#include "qemu-char.h"
#include "buffered_file.h"
#include "block.h"
//#define DEBUG_MIGRATION_UNIX
#ifdef DEBUG_MIGRATION_UNIX
#define DPRINTF(fmt, ...) \
do { printf("migration-unix: " fmt, ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) \
do { } while (0)
#endif
static int unix_errno(MigrationState *s)
{
return errno;
}
static int unix_write(MigrationState *s, const void * buf, size_t size)
{
return write(s->fd, buf, size);
}
static int unix_close(MigrationState *s)
{
int r = 0;
DPRINTF("unix_close\n");
if (s->fd != -1) {
if (close(s->fd) < 0) {
r = -errno;
}
s->fd = -1;
}
return r;
}
static void unix_wait_for_connect(void *opaque)
{
MigrationState *s = opaque;
int val, ret;
socklen_t valsize = sizeof(val);
DPRINTF("connect completed\n");
do {
ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize);
} while (ret == -1 && errno == EINTR);
if (ret < 0) {
migrate_fd_error(s);
return;
}
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
if (val == 0)
migrate_fd_connect(s);
else {
DPRINTF("error connecting %d\n", val);
migrate_fd_error(s);
}
}
int unix_start_outgoing_migration(MigrationState *s, const char *path)
{
struct sockaddr_un addr;
int ret;
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
s->get_error = unix_errno;
s->write = unix_write;
s->close = unix_close;
s->fd = qemu_socket(PF_UNIX, SOCK_STREAM, 0);
if (s->fd == -1) {
DPRINTF("Unable to open socket");
return -errno;
}
socket_set_nonblock(s->fd);
do {
ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr));
if (ret == -1) {
ret = -errno;
}
if (ret == -EINPROGRESS || ret == -EWOULDBLOCK) {
qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s);
return 0;
}
} while (ret == -EINTR);
if (ret < 0) {
DPRINTF("connect failed\n");
migrate_fd_error(s);
return ret;
}
migrate_fd_connect(s);
return 0;
}
static void unix_accept_incoming_migration(void *opaque)
{
struct sockaddr_un addr;
socklen_t addrlen = sizeof(addr);
int s = (intptr_t)opaque;
QEMUFile *f;
int c;
do {
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
} while (c == -1 && errno == EINTR);
DPRINTF("accepted migration\n");
if (c == -1) {
fprintf(stderr, "could not accept migration connection\n");
goto out2;
}
f = qemu_fopen_socket(c);
if (f == NULL) {
fprintf(stderr, "could not qemu_fopen socket\n");
goto out;
}
process_incoming_migration(f);
qemu_fclose(f);
out:
close(c);
out2:
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
close(s);
}
int unix_start_incoming_migration(const char *path)
{
struct sockaddr_un addr;
int s;
int ret;
DPRINTF("Attempting to start an incoming migration\n");
s = qemu_socket(PF_UNIX, SOCK_STREAM, 0);
if (s == -1) {
fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno));
return -errno;
}
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
unlink(addr.sun_path);
if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
ret = -errno;
fprintf(stderr, "bind(unix:%s): %s\n", addr.sun_path, strerror(errno));
goto err;
}
if (listen(s, 1) == -1) {
fprintf(stderr, "listen(unix:%s): %s\n", addr.sun_path,
strerror(errno));
ret = -errno;
goto err;
}
qemu_set_fd_handler2(s, NULL, unix_accept_incoming_migration, NULL,
(void *)(intptr_t)s);
return 0;
err:
close(s);
return ret;
}
|
//------------------------------------------------------------------------------
// <copyright file="p2p_api.h" company="Atheros">
// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
//
//
// 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.
//
//
//------------------------------------------------------------------------------
//==============================================================================
// This file contains definitions exported by the P2P host module.
//
// Author(s): ="Atheros"
//==============================================================================
#ifndef _HOST_P2P_API_H_
#define _HOST_P2P_API_H_
#include "utils_api.h"
#include "wmi.h"
#ifdef __cplusplus
extern "C" {
#endif
#define P2P_OUI 0x99a6f50
static int __inline
isp2poui(const A_UINT8 *frm)
{
return frm[1] > 3 && LE_READ_4(frm+2) == (P2P_OUI);
}
/* API function declarations */
void *p2p_init(void *dev);
struct host_p2p_dev *p2p_get_device(void *p2p_dev_ctx, const A_UINT8 *addr);
void *p2p_bssinfo_rx(void *p2p_dev_ctx, WMI_BI_FTYPE fType, A_UINT8 *addr, A_UINT16 channel, const A_UINT8 *data, A_UINT32 len);
void p2p_go_neg_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len);
void p2p_invite_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len);
void p2p_prov_disc_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len);
void p2p_prov_disc_resp_rx(void *p2p_dev_ctx,
const A_UINT8 *datap, A_UINT8 len);
void p2p_device_free(void *peer_dev);
A_STATUS p2p_auth_go_neg(void *ctx,
WMI_P2P_GO_NEG_START_CMD *auth_go_neg_param);
A_STATUS p2p_auth_invite(void *ctx, A_UINT8 *auth_peer);
A_STATUS p2p_peer_reject(void *ctx, A_UINT8 *peer_addr);
A_STATUS p2p_go_neg_start(void *ctx, WMI_P2P_GO_NEG_START_CMD *go_neg_param);
A_STATUS p2p_invite_cmd(void *ctx, WMI_P2P_INVITE_CMD *invite_param);
A_STATUS p2p_prov_disc_req(void *ctx, WMI_P2P_PROV_DISC_REQ_CMD *prov_disc_req);
A_STATUS p2p_peer(void *ctx, A_UINT8 *peer, A_UINT8 next);
A_STATUS wmi_p2p_get_go_params(void *ctx, A_UINT8 *go_dev_addr,
A_UINT16 *oper_freq, A_UINT8 *ssid, A_UINT8 *ssid_len);
A_STATUS p2p_get_devaddr (void *ctx, A_UINT8 *intf_addr);
A_STATUS p2p_get_ifaddr (void *ctx, A_UINT8 *dev_addr);
struct host_p2p_dev *p2p_get_device_intf_addrs(void *ctx, const A_UINT8 *intfaddr);
void p2p_increment_dev_ref_count(struct host_p2p_dev *dev);
#ifdef __cplusplus
}
#endif
#endif /* _HOST_P2P_API_H_ */
|
/*
* lv8093_regs.h
*
* Copyright (C) 2008-2009 Texas Instruments.
* Copyright (C) 2009 Hewlett-Packard.
*
* This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Register defines for Lens piezo-actuator device
*
*/
#ifndef LV8093_REGS_H
#define LV8093_REGS_H
#include <media/v4l2-int-device.h>
#define LV8093_I2C_RETRY_COUNT 5
#define CAMAF_LV8093_DISABLE 0x1
#define CAMAF_LV8093_ENABLE 0x0
#define CAMAF_LV8093_DRVPLS_REG 0x0
#define CAMAF_LV8093_CTL_REG 0x1
#define CAMAF_LV8093_RST_REG 0x2
#define CAMAF_LV8093_GTAS_REG 0x3
#define CAMAF_LV8093_GTBR_REG 0x4
#define CAMAF_LV8093_GTBS_REG 0x5
#define CAMAF_LV8093_STP_REG 0x6
#define CAMAF_LV8093_MOV_REG 0x7
#define CAMAF_LV8093_MAC_DIR 0x80
#define CAMAF_LV8093_INF_DIR 0x00
#define CAMAF_LV8093_GATE0 0x00
#define CAMAF_LV8093_GATE1 0x80
#define CAMAF_LV8093_ENIN 0x20
#define CAMAF_LV8093_CKSEL_ONE 0x18
#define CAMAF_LV8093_CKSEL_HALF 0x08
#define CAMAF_LV8093_CKSEL_QTR 0x00
#define CAMAF_LV8093_RET2 0x00
#define CAMAF_LV8093_RET1 0x02
#define CAMAF_LV8093_RET3 0x04
#define CAMAF_LV8093_RET4 0x06
#define CAMAF_LV8093_INIT_OFF 0x01
#define CAMAF_LV8093_INIT_ON 0x00
#define CAMAF_LV8093_BUSY 0x80
#define CAMAF_LV8093_REGDATA(REG, DATA) (((REG) << 8) | (DATA))
#define CAMAF_LV8093_POWERDN(ARG) (((ARG) & 0x1) << 15)
#define CAMAF_LV8093_POWERDN_R(ARG) (((ARG) >> 15) & 0x1)
#define CAMAF_LV8093_DATA(ARG) (((ARG) & 0xFF) << 6)
#define CAMAF_LV8093_DATA_R(ARG) (((ARG) >> 6) & 0xFF)
#define CAMAF_FREQUENCY_EQ1(mclk) ((u16)(mclk/16000))
/* State of lens */
#define LENS_DETECTED 1
#define LENS_NOT_DETECTED 0
/* Focus control values */
#define LV8093_MAX_RELATIVE_STEP 127
/* Initialization Mode Settings */
#define LV8093_TIME_GATEA 23 /* First pulse width. */
#define LV8093_TIME_OFF 2 /* Off time between pulses. */
#define LV8093_TIME_GATEB 29 /* Second pulse width. */
#define LV8093_STP 24 /* Pulse repetitions. */
/* Numbers of clock periods per cycle: */
/* 18MHz clock, period = 55.6 nsec */
#define LV8093_CLK_PER_PERIOD 104
#endif /* End of of LV8093_REGS_H */
|
/*
* linux/arch/arm/mach-s5pc100/setup-fb-24bpp.c
*
* Copyright 2009 Samsung Electronics
*
* Base S5PC100 setup information for 24bpp LCD framebuffer
*
* 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/types.h>
#include <linux/fb.h>
#include <linux/gpio.h>
#include <mach/regs-fb.h>
#include <mach/map.h>
#include <plat/fb.h>
#include <plat/gpio-cfg.h>
#define DISR_OFFSET 0x7008
void s5pc100_fb_gpio_setup_24bpp(void)
{
unsigned int gpio = 0;
for (gpio = S5PC100_GPF0(0); gpio <= S5PC100_GPF0(7); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
for (gpio = S5PC100_GPF1(0); gpio <= S5PC100_GPF1(7); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
for (gpio = S5PC100_GPF2(0); gpio <= S5PC100_GPF2(7); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
for (gpio = S5PC100_GPF3(0); gpio <= S5PC100_GPF3(3); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
}
|
/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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 3, or (at your option)
any later version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* ISO C1X: 7.23 _Noreturn <stdnoreturn.h>. */
#ifndef _STDNORETURN_H
#define _STDNORETURN_H
#ifndef __cplusplus
#define noreturn _Noreturn
#endif
#endif /* stdnoreturn.h */
|
// Copyright (c) 2011-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_UTILITYDIALOG_H
#define BITCOIN_QT_UTILITYDIALOG_H
#include <QDialog>
#include <QObject>
class BitcoinGUI;
class ClientModel;
namespace Ui {
class HelpMessageDialog;
}
/** "Help message" dialog box */
class HelpMessageDialog : public QDialog
{
Q_OBJECT
public:
explicit HelpMessageDialog(QWidget *parent, bool about);
~HelpMessageDialog();
void printToConsole();
void showOrPrint();
private:
Ui::HelpMessageDialog *ui;
QString text;
private Q_SLOTS:
void on_okButton_accepted();
};
/** "Shutdown" window */
class ShutdownWindow : public QWidget
{
Q_OBJECT
public:
ShutdownWindow(QWidget *parent=0, Qt::WindowFlags f=0);
static void showShutdownWindow(BitcoinGUI *window);
protected:
void closeEvent(QCloseEvent *event);
};
#endif // BITCOIN_QT_UTILITYDIALOG_H
|
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.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.
****************************************************************************/
#ifndef __CCCAMERA_ACTION_H__
#define __CCCAMERA_ACTION_H__
#include "2d/CCActionInterval.h"
#include "math/CCMath.h"
NS_CC_BEGIN
class Camera;
/**
* @addtogroup actions
* @{
*/
/**
@brief Base class for Camera actions
@ingroup Actions
*/
class CC_DLL ActionCamera : public ActionInterval //<NSCopying>
{
public:
/**
* @js ctor
*/
ActionCamera();
/**
* @js NA
* @lua NA
*/
virtual ~ActionCamera(){};
// Overrides
virtual void startWithTarget(Node *target) override;
virtual ActionCamera * reverse() const override;
virtual ActionCamera *clone() const override;
/* sets the Eye value of the Camera */
void setEye(const Vec3 &eye);
void setEye(float x, float y, float z);
/* returns the Eye value of the Camera */
const Vec3& getEye() const { return _eye; }
/* sets the Center value of the Camera */
void setCenter(const Vec3 ¢er);
/* returns the Center value of the Camera */
const Vec3& getCenter() const { return _center; }
/* sets the Up value of the Camera */
void setUp(const Vec3 &up);
/* Returns the Up value of the Camera */
const Vec3& getUp() const { return _up; }
protected:
void restore();
void updateTransform();
Vec3 _center;
Vec3 _eye;
Vec3 _up;
};
/**
@brief OrbitCamera action
Orbits the camera around the center of the screen using spherical coordinates
@ingroup Actions
*/
class CC_DLL OrbitCamera : public ActionCamera //<NSCopying>
{
public:
/** creates a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
static OrbitCamera* create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
/** positions the camera according to spherical coordinates */
void sphericalRadius(float *r, float *zenith, float *azimuth);
// Overrides
OrbitCamera *clone() const override;
virtual void startWithTarget(Node *target) override;
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
OrbitCamera();
/**
* @js NA
* @lua NA
*/
virtual ~OrbitCamera();
/** initializes a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
bool initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
protected:
float _radius;
float _deltaRadius;
float _angleZ;
float _deltaAngleZ;
float _angleX;
float _deltaAngleX;
float _radZ;
float _radDeltaZ;
float _radX;
float _radDeltaX;
};
// end of actions group
/// @}
NS_CC_END
#endif //__CCCAMERA_ACTION_H__
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_TOOLCHAIN_H
#define MBED_TOOLCHAIN_H
#if defined(TOOLCHAIN_ARM)
#include <rt_sys.h>
#endif
#ifndef FILEHANDLE
typedef int FILEHANDLE;
#endif
#if defined (__ICCARM__)
# define WEAK __weak
# define PACKED __packed
#else
# define WEAK __attribute__((weak))
# define PACKED __attribute__((packed))
#endif
#endif
|
/*
* Support for o32 Linux/MIPS ELF binaries.
* Author: Ralf Baechle (ralf@linux-mips.org)
*
* Copyright (C) 1999, 2001 Ralf Baechle
* Copyright (C) 1999, 2001 Silicon Graphics, Inc.
*
* Heavily inspired by the 32-bit Sparc compat code which is
* Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
* Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
*/
#define ELF_ARCH EM_MIPS
#define ELF_CLASS ELFCLASS32
#ifdef __MIPSEB__
#define ELF_DATA ELFDATA2MSB;
#else /* __MIPSEL__ */
#define ELF_DATA ELFDATA2LSB;
#endif
/* ELF register definitions */
#define ELF_NGREG 45
#define ELF_NFPREG 33
typedef unsigned int elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch elfo32_check_arch
#ifdef CONFIG_KVM_GUEST
#define TASK32_SIZE 0x3fff8000UL
#else
#define TASK32_SIZE 0x7fff8000UL
#endif
#undef ELF_ET_DYN_BASE
#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2)
#include <asm/processor.h>
#include <linux/elfcore.h>
#include <linux/compat.h>
#include <linux/math64.h>
#define elf_prstatus elf_prstatus32
struct elf_prstatus32
{
struct elf_siginfo pr_info; /* Info associated with signal */
short pr_cursig; /* Current signal */
unsigned int pr_sigpend; /* Set of pending signals */
unsigned int pr_sighold; /* Set of held signals */
pid_t pr_pid;
pid_t pr_ppid;
pid_t pr_pgrp;
pid_t pr_sid;
struct compat_timeval pr_utime; /* User time */
struct compat_timeval pr_stime; /* System time */
struct compat_timeval pr_cutime;/* Cumulative user time */
struct compat_timeval pr_cstime;/* Cumulative system time */
elf_gregset_t pr_reg; /* GP registers */
int pr_fpvalid; /* True if math co-processor being used. */
};
#define elf_prpsinfo elf_prpsinfo32
struct elf_prpsinfo32
{
char pr_state; /* numeric process state */
char pr_sname; /* char for pr_state */
char pr_zomb; /* zombie */
char pr_nice; /* nice val */
unsigned int pr_flag; /* flags */
__kernel_uid_t pr_uid;
__kernel_gid_t pr_gid;
pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
/* Lots missing */
char pr_fname[16]; /* filename of executable */
char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
};
#define elf_caddr_t u32
#define init_elf_binfmt init_elf32_binfmt
#define jiffies_to_timeval jiffies_to_compat_timeval
static inline void
jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
{
/*
* Convert jiffies to nanoseconds and separate with
* one divide.
*/
u64 nsec = (u64)jiffies * TICK_NSEC;
u32 rem;
value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
value->tv_usec = rem / NSEC_PER_USEC;
}
#undef TASK_SIZE
#define TASK_SIZE TASK_SIZE32
#undef cputime_to_timeval
#define cputime_to_timeval cputime_to_compat_timeval
static __inline__ void
cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
{
unsigned long jiffies = cputime_to_jiffies(cputime);
value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ;
}
#include "../../../fs/binfmt_elf.c"
|
// Copyright 2015 The Go 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 SENSORS_ANDROID_H
#define SENSORS_ANDROID_H
typedef struct android_SensorManager {
ASensorEventQueue* queue;
ALooper* looper;
int looperId;
} android_SensorManager;
void android_createManager(int looperId, android_SensorManager* dst);
void android_destroyManager(android_SensorManager* m);
int android_enableSensor(ASensorEventQueue*, int, int32_t);
void android_disableSensor(ASensorEventQueue*, int);
int android_readQueue(int looperId, ASensorEventQueue* q, int n, int32_t* types, int64_t* timestamps, float* vectors);
#endif
|
//------------------------------------------------------------------------
// Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
//
// This file is part of the ZBar Bar Code Reader.
//
// The ZBar Bar Code Reader is free software; you can redistribute it
// and/or modify it under the terms of the GNU Lesser Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.
//
// The ZBar Bar Code Reader 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 Lesser Public License for more details.
//
// You should have received a copy of the GNU Lesser Public License
// along with the ZBar Bar Code Reader; if not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301 USA
//
// http://sourceforge.net/projects/zbar
//------------------------------------------------------------------------
#import <UIKit/UIKit.h>
#import "ZBarReaderController.h"
// orientation set support
#define ZBarOrientationMask(orient) (1 << orient)
#define ZBarOrientationMaskAll \
(ZBarOrientationMask(UIInterfaceOrientationPortrait) | \
ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \
ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \
ZBarOrientationMask(UIInterfaceOrientationLandscapeRight))
@class ZBarReaderView, ZBarCameraSimulator;
// drop in video scanning replacement for ZBarReaderController.
// this is a thin controller around a ZBarReaderView that adds the UI
// controls and select functionality offered by ZBarReaderController.
// Automatically falls back to a ZBarReaderController if video APIs
// are unavailable (eg for OS < 4.0)
@interface ZBarReaderViewController
: UIViewController
{
ZBarImageScanner *scanner;
id <ZBarReaderDelegate> readerDelegate;
ZBarReaderView *readerView;
UIView *cameraOverlayView;
CGAffineTransform cameraViewTransform;
CGRect scanCrop;
NSUInteger supportedOrientationsMask;
UIImagePickerControllerCameraDevice cameraDevice;
UIImagePickerControllerCameraFlashMode cameraFlashMode;
UIImagePickerControllerQualityType videoQuality;
BOOL showsZBarControls, tracksSymbols, enableCache;
ZBarHelpController *helpController;
UIView *controls;
BOOL didHideStatusBar, rotating;
ZBarCameraSimulator *cameraSim;
}
// access to configure image scanner
@property (nonatomic, readonly) ZBarImageScanner *scanner;
// barcode result recipient
@property (nonatomic, assign) id <ZBarReaderDelegate> readerDelegate;
// whether to use alternate control set
@property (nonatomic) BOOL showsZBarControls;
// whether to show the green tracking box. note that, even when
// enabled, the box will only be visible when scanning EAN and I2/5.
@property (nonatomic) BOOL tracksSymbols;
// interface orientation support. bit-mask of accepted orientations.
// see eg ZBarOrientationMask() and ZBarOrientationMaskAll
@property (nonatomic) NSUInteger supportedOrientationsMask;
// crop images for scanning. the image will be cropped to this
// rectangle before scanning. the rectangle is normalized to the
// image size and aspect ratio; useful values will place the rectangle
// between 0 and 1 on each axis, where the x-axis corresponds to the
// image major axis. defaults to the full image (0, 0, 1, 1).
@property (nonatomic) CGRect scanCrop;
// provide a custom overlay. note that this can be used with
// showsZBarControls enabled (but not if you want backward compatibility)
@property (nonatomic, retain) UIView *cameraOverlayView;
// transform applied to the preview image.
@property (nonatomic) CGAffineTransform cameraViewTransform;
// display the built-in help browser. the argument will be passed to
// the onZBarHelp() javascript function.
- (void) showHelpWithReason: (NSString*) reason;
// capture the next frame and send it over the usual delegate path.
- (void) takePicture;
// these attempt to emulate UIImagePickerController
+ (BOOL) isCameraDeviceAvailable: (UIImagePickerControllerCameraDevice) cameraDevice;
+ (BOOL) isFlashAvailableForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice;
+ (NSArray*) availableCaptureModesForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice;
@property(nonatomic) UIImagePickerControllerCameraDevice cameraDevice;
@property(nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode;
@property(nonatomic) UIImagePickerControllerCameraCaptureMode cameraCaptureMode;
@property(nonatomic) UIImagePickerControllerQualityType videoQuality;
// direct access to the ZBarReaderView
@property (nonatomic, readonly) ZBarReaderView *readerView;
// this flag still works, but its use is deprecated
@property (nonatomic) BOOL enableCache;
// these are present only for backward compatibility.
// they will error if inappropriate/unsupported values are set
@property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera
@property (nonatomic) BOOL allowsEditing; // NO
@property (nonatomic) BOOL allowsImageEditing; // NO
@property (nonatomic) BOOL showsCameraControls; // NO
@property (nonatomic) BOOL showsHelpOnFail; // ignored
@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling
@property (nonatomic) BOOL takesPicture; // NO
@property (nonatomic) NSInteger maxScanDimension; // ignored
+ (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType;
@end
|
/*
* linux/drivers/media/video/s5p-mfc/s5p_mfc_shm.h
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* 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.
*/
#ifndef S5P_MFC_SHM_H_
#define S5P_MFC_SHM_H_
enum MFC_SHM_OFS {
EXTENEDED_DECODE_STATUS = 0x00, /* D */
SET_FRAME_TAG = 0x04, /* D */
GET_FRAME_TAG_TOP = 0x08, /* D */
GET_FRAME_TAG_BOT = 0x0C, /* D */
PIC_TIME_TOP = 0x10, /* D */
PIC_TIME_BOT = 0x14, /* D */
START_BYTE_NUM = 0x18, /* D */
CROP_INFO_H = 0x20, /* D */
CROP_INFO_V = 0x24, /* D */
EXT_ENC_CONTROL = 0x28, /* E */
ENC_PARAM_CHANGE = 0x2C, /* E */
RC_VOP_TIMING = 0x30, /* E, MPEG4 */
HEC_PERIOD = 0x34, /* E, MPEG4 */
METADATA_ENABLE = 0x38, /* C */
METADATA_STATUS = 0x3C, /* C */
METADATA_DISPLAY_INDEX = 0x40, /* C */
EXT_METADATA_START_ADDR = 0x44, /* C */
PUT_EXTRADATA = 0x48, /* C */
EXTRADATA_ADDR = 0x4C, /* C */
ALLOC_LUMA_DPB_SIZE = 0x64, /* D */
ALLOC_CHROMA_DPB_SIZE = 0x68, /* D */
ALLOC_MV_SIZE = 0x6C, /* D */
P_B_FRAME_QP = 0x70, /* E */
SAMPLE_ASPECT_RATIO_IDC = 0x74, /* E, H.264, depend on
ASPECT_RATIO_VUI_ENABLE in EXT_ENC_CONTROL */
EXTENDED_SAR = 0x78, /* E, H.264, depned on
ASPECT_RATIO_VUI_ENABLE in EXT_ENC_CONTROL */
DISP_PIC_PROFILE = 0x7C, /* D */
FLUSH_CMD_TYPE = 0x80, /* C */
FLUSH_CMD_INBUF1 = 0x84, /* C */
FLUSH_CMD_INBUF2 = 0x88, /* C */
FLUSH_CMD_OUTBUF = 0x8C, /* E */
NEW_RC_BIT_RATE = 0x90, /* E, format as RC_BIT_RATE(0xC5A8)
depend on RC_BIT_RATE_CHANGE in ENC_PARAM_CHANGE */
NEW_RC_FRAME_RATE = 0x94, /* E, format as RC_FRAME_RATE(0xD0D0)
depend on RC_FRAME_RATE_CHANGE in ENC_PARAM_CHANGE */
NEW_I_PERIOD = 0x98, /* E, format as I_FRM_CTRL(0xC504)
depend on I_PERIOD_CHANGE in ENC_PARAM_CHANGE */
H264_I_PERIOD = 0x9C, /* E, H.264, open GOP */
RC_CONTROL_CONFIG = 0xA0, /* E */
BATCH_INPUT_ADDR = 0xA4, /* E */
BATCH_OUTPUT_ADDR = 0xA8, /* E */
BATCH_OUTPUT_SIZE = 0xAC, /* E */
MIN_LUMA_DPB_SIZE = 0xB0, /* D */
DEVICE_FORMAT_ID = 0xB4, /* C */
H264_POC_TYPE = 0xB8, /* D */
MIN_CHROMA_DPB_SIZE = 0xBC, /* D */
DISP_PIC_FRAME_TYPE = 0xC0, /* D */
FREE_LUMA_DPB = 0xC4, /* D, VC1 MPEG4 */
ASPECT_RATIO_INFO = 0xC8, /* D, MPEG4 */
EXTENDED_PAR = 0xCC, /* D, MPEG4 */
DBG_HISTORY_INPUT0 = 0xD0, /* C */
DBG_HISTORY_INPUT1 = 0xD4, /* C */
DBG_HISTORY_OUTPUT = 0xD8, /* C */
HIERARCHICAL_P_QP = 0xE0, /* E, H.264 */
};
int s5p_mfc_init_shm(struct s5p_mfc_ctx *ctx);
#define s5p_mfc_write_shm(ctx, x, ofs) \
do { \
writel(x, (ctx->shm + ofs)); \
wmb(); \
} while (0)
static inline u32 s5p_mfc_read_shm(struct s5p_mfc_ctx *ctx, unsigned int ofs)
{
rmb();
return readl(ctx->shm + ofs);
}
#endif /* S5P_MFC_SHM_H_ */
|
/*
* Copyright 2018 Advanced Micro Devices, 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: AMD
*
*/
#include "dce_i2c.h"
#include "reg_helper.h"
bool dce_i2c_submit_command(
struct resource_pool *pool,
struct ddc *ddc,
struct i2c_command *cmd)
{
struct dce_i2c_hw *dce_i2c_hw;
struct dce_i2c_sw *dce_i2c_sw;
if (!ddc) {
BREAK_TO_DEBUGGER();
return false;
}
if (!cmd) {
BREAK_TO_DEBUGGER();
return false;
}
/* The software engine is only available on dce8 */
dce_i2c_sw = dce_i2c_acquire_i2c_sw_engine(pool, ddc);
if (!dce_i2c_sw) {
dce_i2c_hw = acquire_i2c_hw_engine(pool, ddc);
if (!dce_i2c_hw)
return false;
return dce_i2c_submit_command_hw(pool, ddc, cmd, dce_i2c_hw);
}
return dce_i2c_submit_command_sw(pool, ddc, cmd, dce_i2c_sw);
}
|
#ifndef _FIB_LOOKUP_H
#define _FIB_LOOKUP_H
#include <linux/types.h>
#include <linux/list.h>
#include <net/ip_fib.h>
struct fib_alias {
struct list_head fa_list;
struct fib_info *fa_info;
u8 fa_tos;
u8 fa_type;
u8 fa_state;
struct rcu_head rcu;
};
#define FA_S_ACCESSED 0x01
/* Dont write on fa_state unless needed, to keep it shared on all cpus */
static inline void fib_alias_accessed(struct fib_alias *fa)
{
if (!(fa->fa_state & FA_S_ACCESSED))
fa->fa_state |= FA_S_ACCESSED;
}
/* Exported by fib_semantics.c */
void fib_release_info(struct fib_info *);
struct fib_info *fib_create_info(struct fib_config *cfg);
int fib_nh_match(struct fib_config *cfg, struct fib_info *fi);
int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, u32 tb_id,
u8 type, __be32 dst, int dst_len, u8 tos, struct fib_info *fi,
unsigned int);
void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len,
u32 tb_id, const struct nl_info *info, unsigned int nlm_flags);
static inline void fib_result_assign(struct fib_result *res,
struct fib_info *fi)
{
/* we used to play games with refcounts, but we now use RCU */
res->fi = fi;
}
struct fib_prop {
int error;
u8 scope;
};
extern const struct fib_prop fib_props[RTN_MAX + 1];
#endif /* _FIB_LOOKUP_H */
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __java_nio_ShortViewBufferImpl__
#define __java_nio_ShortViewBufferImpl__
#pragma interface
#include <java/nio/ShortBuffer.h>
extern "Java"
{
namespace java
{
namespace nio
{
class ByteBuffer;
class ByteOrder;
class ShortBuffer;
class ShortViewBufferImpl;
}
}
}
class java::nio::ShortViewBufferImpl : public ::java::nio::ShortBuffer
{
public: // actually package-private
ShortViewBufferImpl(::java::nio::ByteBuffer *, jint);
public:
ShortViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *);
jshort get();
jshort get(jint);
::java::nio::ShortBuffer * put(jshort);
::java::nio::ShortBuffer * put(jint, jshort);
::java::nio::ShortBuffer * compact();
::java::nio::ShortBuffer * slice();
public: // actually package-private
::java::nio::ShortBuffer * duplicate(jboolean);
public:
::java::nio::ShortBuffer * duplicate();
::java::nio::ShortBuffer * asReadOnlyBuffer();
jboolean isReadOnly();
jboolean isDirect();
::java::nio::ByteOrder * order();
private:
jint __attribute__((aligned(__alignof__( ::java::nio::ShortBuffer)))) offset;
::java::nio::ByteBuffer * bb;
jboolean readOnly;
::java::nio::ByteOrder * endian;
public:
static ::java::lang::Class class$;
};
#endif // __java_nio_ShortViewBufferImpl__
|
/*
* Copyright 2018 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.
*/
#include "curs.h"
int
curs907a_new(struct nouveau_drm *drm, int head, s32 oclass,
struct nv50_wndw **pwndw)
{
return curs507a_new_(&curs507a, drm, head, oclass,
0x00000001 << (head * 4), pwndw);
}
|
/*
* linux/compr_mm.h
*
* Memory management for pre-boot and ramdisk uncompressors
*
* Authors: Alain Knaff <alain@knaff.lu>
*
*/
#ifndef DECOMPR_MM_H
#define DECOMPR_MM_H
#ifdef STATIC
/* Code active when included from pre-boot environment: */
/*
* Some architectures want to ensure there is no local data in their
* pre-boot environment, so that data can arbitrarily relocated (via
* GOT references). This is achieved by defining STATIC_RW_DATA to
* be null.
*/
#ifndef STATIC_RW_DATA
#define STATIC_RW_DATA static
#endif
/* A trivial malloc implementation, adapted from
* malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
*/
STATIC_RW_DATA unsigned long malloc_ptr;
STATIC_RW_DATA int malloc_count;
static void *malloc(int size)
{
void *p;
if (size < 0)
return NULL;
if (!malloc_ptr)
malloc_ptr = free_mem_ptr;
malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */
p = (void *)malloc_ptr;
malloc_ptr += size;
if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
return NULL;
malloc_count++;
return p;
}
static void free(void *where)
{
malloc_count--;
if (!malloc_count)
malloc_ptr = free_mem_ptr;
}
#define large_malloc(a) malloc(a)
#define large_free(a) free(a)
#define INIT
#else /* STATIC */
/* Code active when compiled standalone for use when loading ramdisk: */
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
/* Use defines rather than static inline in order to avoid spurious
* warnings when not needed (indeed large_malloc / large_free are not
* needed by inflate */
#define malloc(a) kmalloc(a, GFP_KERNEL)
#define free(a) kfree(a)
#define large_malloc(a) vmalloc(a)
#define large_free(a) vfree(a)
#define INIT __init
#define STATIC
#include <linux/init.h>
#endif /* STATIC */
#endif /* DECOMPR_MM_H */
|
/*******************************************************************************
*
* Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
* Copyright(c) 2013 - 2014 Intel 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, see <http://www.gnu.org/licenses/>.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information:
* e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
******************************************************************************/
#ifndef _I40E_ADMINQ_H_
#define _I40E_ADMINQ_H_
#include "i40e_osdep.h"
#include "i40e_adminq_cmd.h"
#define I40E_ADMINQ_DESC(R, i) \
(&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
#define I40E_ADMINQ_DESC_ALIGNMENT 4096
struct i40e_adminq_ring {
struct i40e_virt_mem dma_head; /* space for dma structures */
struct i40e_dma_mem desc_buf; /* descriptor ring memory */
struct i40e_virt_mem cmd_buf; /* command buffer memory */
union {
struct i40e_dma_mem *asq_bi;
struct i40e_dma_mem *arq_bi;
} r;
u16 count; /* Number of descriptors */
u16 rx_buf_len; /* Admin Receive Queue buffer length */
/* used for interrupt processing */
u16 next_to_use;
u16 next_to_clean;
/* used for queue tracking */
u32 head;
u32 tail;
u32 len;
u32 bah;
u32 bal;
};
/* ASQ transaction details */
struct i40e_asq_cmd_details {
void *callback; /* cast from type I40E_ADMINQ_CALLBACK */
u64 cookie;
u16 flags_ena;
u16 flags_dis;
bool async;
bool postpone;
};
#define I40E_ADMINQ_DETAILS(R, i) \
(&(((struct i40e_asq_cmd_details *)((R).cmd_buf.va))[i]))
/* ARQ event information */
struct i40e_arq_event_info {
struct i40e_aq_desc desc;
u16 msg_size;
u8 *msg_buf;
};
/* Admin Queue information */
struct i40e_adminq_info {
struct i40e_adminq_ring arq; /* receive queue */
struct i40e_adminq_ring asq; /* send queue */
u32 asq_cmd_timeout; /* send queue cmd write back timeout*/
u16 num_arq_entries; /* receive queue depth */
u16 num_asq_entries; /* send queue depth */
u16 arq_buf_size; /* receive queue buffer size */
u16 asq_buf_size; /* send queue buffer size */
u16 fw_maj_ver; /* firmware major version */
u16 fw_min_ver; /* firmware minor version */
u16 api_maj_ver; /* api major version */
u16 api_min_ver; /* api minor version */
bool nvm_busy;
bool nvm_release_on_done;
struct mutex asq_mutex; /* Send queue lock */
struct mutex arq_mutex; /* Receive queue lock */
/* last status values on send and receive queues */
enum i40e_admin_queue_err asq_last_status;
enum i40e_admin_queue_err arq_last_status;
};
/**
* i40e_aq_rc_to_posix - convert errors to user-land codes
* aq_rc: AdminQ error code to convert
**/
static inline int i40e_aq_rc_to_posix(u16 aq_rc)
{
int aq_to_posix[] = {
0, /* I40E_AQ_RC_OK */
-EPERM, /* I40E_AQ_RC_EPERM */
-ENOENT, /* I40E_AQ_RC_ENOENT */
-ESRCH, /* I40E_AQ_RC_ESRCH */
-EINTR, /* I40E_AQ_RC_EINTR */
-EIO, /* I40E_AQ_RC_EIO */
-ENXIO, /* I40E_AQ_RC_ENXIO */
-E2BIG, /* I40E_AQ_RC_E2BIG */
-EAGAIN, /* I40E_AQ_RC_EAGAIN */
-ENOMEM, /* I40E_AQ_RC_ENOMEM */
-EACCES, /* I40E_AQ_RC_EACCES */
-EFAULT, /* I40E_AQ_RC_EFAULT */
-EBUSY, /* I40E_AQ_RC_EBUSY */
-EEXIST, /* I40E_AQ_RC_EEXIST */
-EINVAL, /* I40E_AQ_RC_EINVAL */
-ENOTTY, /* I40E_AQ_RC_ENOTTY */
-ENOSPC, /* I40E_AQ_RC_ENOSPC */
-ENOSYS, /* I40E_AQ_RC_ENOSYS */
-ERANGE, /* I40E_AQ_RC_ERANGE */
-EPIPE, /* I40E_AQ_RC_EFLUSHED */
-ESPIPE, /* I40E_AQ_RC_BAD_ADDR */
-EROFS, /* I40E_AQ_RC_EMODE */
-EFBIG, /* I40E_AQ_RC_EFBIG */
};
return aq_to_posix[aq_rc];
}
/* general information */
#define I40E_AQ_LARGE_BUF 512
#define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */
void i40evf_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
u16 opcode);
#endif /* _I40E_ADMINQ_H_ */
|
/*
* Error Corrected Code Controller (ECC) - System peripherals regsters.
* Based on AT91SAM9260 datasheet revision B.
*
* 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.
*/
#ifndef ATMEL_NAND_ECC_H
#define ATMEL_NAND_ECC_H
#define ATMEL_ECC_CR 0x00 /* Control register */
#define ATMEL_ECC_RST (1 << 0) /* Reset parity */
#define ATMEL_ECC_MR 0x04 /* Mode register */
#define ATMEL_ECC_PAGESIZE (3 << 0) /* Page Size */
#define ATMEL_ECC_PAGESIZE_528 (0)
#define ATMEL_ECC_PAGESIZE_1056 (1)
#define ATMEL_ECC_PAGESIZE_2112 (2)
#define ATMEL_ECC_PAGESIZE_4224 (3)
#define ATMEL_ECC_SR 0x08 /* Status register */
#define ATMEL_ECC_RECERR (1 << 0) /* Recoverable Error */
#define ATMEL_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
#define ATMEL_ECC_MULERR (1 << 2) /* Multiple Errors */
#define ATMEL_ECC_PR 0x0c /* Parity register */
#define ATMEL_ECC_BITADDR (0xf << 0) /* Bit Error Address */
#define ATMEL_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
#define ATMEL_ECC_NPR 0x10 /* NParity register */
#define ATMEL_ECC_NPARITY (0xffff << 0) /* NParity */
#endif
|
#ifndef QEMU_TYPES_H
#define QEMU_TYPES_H
#include "cpu.h"
#ifdef TARGET_ABI32
typedef uint32_t abi_ulong;
typedef int32_t abi_long;
#define TARGET_ABI_FMT_lx "%08x"
#define TARGET_ABI_FMT_ld "%d"
#define TARGET_ABI_FMT_lu "%u"
#define TARGET_ABI_BITS 32
static inline abi_ulong tswapal(abi_ulong v)
{
return tswap32(v);
}
#else
typedef target_ulong abi_ulong;
typedef target_long abi_long;
#define TARGET_ABI_FMT_lx TARGET_FMT_lx
#define TARGET_ABI_FMT_ld TARGET_FMT_ld
#define TARGET_ABI_FMT_lu TARGET_FMT_lu
#define TARGET_ABI_BITS TARGET_LONG_BITS
/* for consistency, define ABI32 too */
#if TARGET_ABI_BITS == 32
#define TARGET_ABI32 1
#endif
static inline abi_ulong tswapal(abi_ulong v)
{
return tswapl(v);
}
#endif
#endif
|
#ifndef __SW842_H__
#define __SW842_H__
#define SW842_MEM_COMPRESS (0xf000)
int sw842_compress(const u8 *src, unsigned int srclen,
u8 *dst, unsigned int *destlen, void *wmem);
int sw842_decompress(const u8 *src, unsigned int srclen,
u8 *dst, unsigned int *destlen);
#endif
|
/*
* Vortex Mixer support.
*
* There is much more than just the AC97 mixer...
*
*/
#include <linux/time.h>
#include <linux/init.h>
#include <sound/core.h>
#include "au88x0.h"
static int __devinit snd_vortex_mixer(vortex_t * vortex)
{
struct snd_ac97_bus *pbus;
struct snd_ac97_template ac97;
int err;
static struct snd_ac97_bus_ops ops = {
.write = vortex_codec_write,
.read = vortex_codec_read,
};
if ((err = snd_ac97_bus(vortex->card, 0, &ops, NULL, &pbus)) < 0)
return err;
memset(&ac97, 0, sizeof(ac97));
// Intialize AC97 codec stuff.
ac97.private_data = vortex;
ac97.scaps = AC97_SCAP_NO_SPDIF;
err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
vortex->isquad = ((vortex->codec == NULL) ? 0 : (vortex->codec->ext_id&0x80));
return err;
}
|
/*
* Tiny Code Interpreter for QEMU - disassembler
*
* Copyright (c) 2011 Stefan Weil
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include "disas/bfd.h"
#include "tcg/tcg.h"
/* Disassemble TCI bytecode. */
int print_insn_tci(bfd_vma addr, disassemble_info *info)
{
int length;
uint8_t byte;
int status;
TCGOpcode op;
status = info->read_memory_func(addr, &byte, 1, info);
if (status != 0) {
info->memory_error_func(status, addr, info);
return -1;
}
op = byte;
addr++;
status = info->read_memory_func(addr, &byte, 1, info);
if (status != 0) {
info->memory_error_func(status, addr, info);
return -1;
}
length = byte;
if (op >= tcg_op_defs_max) {
info->fprintf_func(info->stream, "illegal opcode %d", op);
} else {
const TCGOpDef *def = &tcg_op_defs[op];
int nb_oargs = def->nb_oargs;
int nb_iargs = def->nb_iargs;
int nb_cargs = def->nb_cargs;
/* TODO: Improve disassembler output. */
info->fprintf_func(info->stream, "%s\to=%d i=%d c=%d",
def->name, nb_oargs, nb_iargs, nb_cargs);
}
return length;
}
|
#ifndef _system_syslog_h
#define _system_syslog_h
/*
Unix SMB/CIFS implementation.
syslog system include wrappers
Copyright (C) Andrew Tridgell 2004
** NOTE! The following LGPL license applies to the replace
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#else
#ifdef HAVE_SYS_SYSLOG_H
#include <sys/syslog.h>
#endif
#endif
/* For sys_adminlog(). */
#ifndef LOG_EMERG
#define LOG_EMERG 0 /* system is unusable */
#endif
#ifndef LOG_ALERT
#define LOG_ALERT 1 /* action must be taken immediately */
#endif
#ifndef LOG_CRIT
#define LOG_CRIT 2 /* critical conditions */
#endif
#ifndef LOG_ERR
#define LOG_ERR 3 /* error conditions */
#endif
#ifndef LOG_WARNING
#define LOG_WARNING 4 /* warning conditions */
#endif
#ifndef LOG_NOTICE
#define LOG_NOTICE 5 /* normal but significant condition */
#endif
#ifndef LOG_INFO
#define LOG_INFO 6 /* informational */
#endif
#ifndef LOG_DEBUG
#define LOG_DEBUG 7 /* debug-level messages */
#endif
#endif
|
/*
* linux/fs/sysv/ialloc.c
*
* minix/bitmap.c
* Copyright (C) 1991, 1992 Linus Torvalds
*
* ext/freelists.c
* Copyright (C) 1992 Remy Card (card@masi.ibp.fr)
*
* xenix/alloc.c
* Copyright (C) 1992 Doug Evans
*
* coh/alloc.c
* Copyright (C) 1993 Pascal Haible, Bruno Haible
*
* sysv/ialloc.c
* Copyright (C) 1993 Bruno Haible
*
* This file contains code for allocating/freeing inodes.
*/
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/buffer_head.h>
#include <linux/writeback.h>
#include "sysv.h"
/* We don't trust the value of
sb->sv_sbd2->s_tinode = *sb->sv_sb_total_free_inodes
but we nevertheless keep it up to date. */
/* An inode on disk is considered free if both i_mode == 0 and i_nlink == 0. */
/* return &sb->sv_sb_fic_inodes[i] = &sbd->s_inode[i]; */
static inline sysv_ino_t *
sv_sb_fic_inode(struct super_block * sb, unsigned int i)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
if (sbi->s_bh1 == sbi->s_bh2)
return &sbi->s_sb_fic_inodes[i];
else {
/* 512 byte Xenix FS */
unsigned int offset = offsetof(struct xenix_super_block, s_inode[i]);
if (offset < 512)
return (sysv_ino_t*)(sbi->s_sbd1 + offset);
else
return (sysv_ino_t*)(sbi->s_sbd2 + offset);
}
}
struct sysv_inode *
sysv_raw_inode(struct super_block *sb, unsigned ino, struct buffer_head **bh)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
struct sysv_inode *res;
int block = sbi->s_firstinodezone + sbi->s_block_base;
block += (ino-1) >> sbi->s_inodes_per_block_bits;
*bh = sb_bread(sb, block);
if (!*bh)
return NULL;
res = (struct sysv_inode *)(*bh)->b_data;
return res + ((ino-1) & sbi->s_inodes_per_block_1);
}
static int refill_free_cache(struct super_block *sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
struct buffer_head * bh;
struct sysv_inode * raw_inode;
int i = 0, ino;
ino = SYSV_ROOT_INO+1;
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode)
goto out;
while (ino <= sbi->s_ninodes) {
if (raw_inode->i_mode == 0 && raw_inode->i_nlink == 0) {
*sv_sb_fic_inode(sb,i++) = cpu_to_fs16(SYSV_SB(sb), ino);
if (i == sbi->s_fic_size)
break;
}
if ((ino++ & sbi->s_inodes_per_block_1) == 0) {
brelse(bh);
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode)
goto out;
} else
raw_inode++;
}
brelse(bh);
out:
return i;
}
void sysv_free_inode(struct inode * inode)
{
struct super_block *sb = inode->i_sb;
struct sysv_sb_info *sbi = SYSV_SB(sb);
unsigned int ino;
struct buffer_head * bh;
struct sysv_inode * raw_inode;
unsigned count;
sb = inode->i_sb;
ino = inode->i_ino;
if (ino <= SYSV_ROOT_INO || ino > sbi->s_ninodes) {
printk("sysv_free_inode: inode 0,1,2 or nonexistent inode\n");
return;
}
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode) {
printk("sysv_free_inode: unable to read inode block on device "
"%s\n", inode->i_sb->s_id);
return;
}
mutex_lock(&sbi->s_lock);
count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
if (count < sbi->s_fic_size) {
*sv_sb_fic_inode(sb,count++) = cpu_to_fs16(sbi, ino);
*sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
}
fs16_add(sbi, sbi->s_sb_total_free_inodes, 1);
dirty_sb(sb);
memset(raw_inode, 0, sizeof(struct sysv_inode));
mark_buffer_dirty(bh);
mutex_unlock(&sbi->s_lock);
brelse(bh);
}
struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
{
struct super_block *sb = dir->i_sb;
struct sysv_sb_info *sbi = SYSV_SB(sb);
struct inode *inode;
sysv_ino_t ino;
unsigned count;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_NONE
};
inode = new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
mutex_lock(&sbi->s_lock);
count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) {
count = refill_free_cache(sb);
if (count == 0) {
iput(inode);
mutex_unlock(&sbi->s_lock);
return ERR_PTR(-ENOSPC);
}
}
/* Now count > 0. */
ino = *sv_sb_fic_inode(sb,--count);
*sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
fs16_add(sbi, sbi->s_sb_total_free_inodes, -1);
dirty_sb(sb);
inode_init_owner(inode, dir, mode);
inode->i_ino = fs16_to_cpu(sbi, ino);
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
inode->i_blocks = 0;
memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
SYSV_I(inode)->i_dir_start_lookup = 0;
insert_inode_hash(inode);
mark_inode_dirty(inode);
sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
/* That's it. */
mutex_unlock(&sbi->s_lock);
return inode;
}
unsigned long sysv_count_free_inodes(struct super_block * sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
struct buffer_head * bh;
struct sysv_inode * raw_inode;
int ino, count, sb_count;
mutex_lock(&sbi->s_lock);
sb_count = fs16_to_cpu(sbi, *sbi->s_sb_total_free_inodes);
if (0)
goto trust_sb;
/* this causes a lot of disk traffic ... */
count = 0;
ino = SYSV_ROOT_INO+1;
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode)
goto Eio;
while (ino <= sbi->s_ninodes) {
if (raw_inode->i_mode == 0 && raw_inode->i_nlink == 0)
count++;
if ((ino++ & sbi->s_inodes_per_block_1) == 0) {
brelse(bh);
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode)
goto Eio;
} else
raw_inode++;
}
brelse(bh);
if (count != sb_count)
goto Einval;
out:
mutex_unlock(&sbi->s_lock);
return count;
Einval:
printk("sysv_count_free_inodes: "
"free inode count was %d, correcting to %d\n",
sb_count, count);
if (!(sb->s_flags & MS_RDONLY)) {
*sbi->s_sb_total_free_inodes = cpu_to_fs16(SYSV_SB(sb), count);
dirty_sb(sb);
}
goto out;
Eio:
printk("sysv_count_free_inodes: unable to read inode table\n");
trust_sb:
count = sb_count;
goto out;
}
|
/*
* Copyright 2015 Advanced Micro Devices, 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: AMD
*
*/
#include "dm_services.h"
#include "dc.h"
#include "core_types.h"
#include "dce80_hw_sequencer.h"
#include "dce/dce_hwseq.h"
#include "dce110/dce110_hw_sequencer.h"
#include "dce100/dce100_hw_sequencer.h"
/* include DCE8 register header files */
#include "dce/dce_8_0_d.h"
#include "dce/dce_8_0_sh_mask.h"
/*******************************************************************************
* Private definitions
******************************************************************************/
/***************************PIPE_CONTROL***********************************/
void dce80_hw_sequencer_construct(struct dc *dc)
{
dce110_hw_sequencer_construct(dc);
dc->hwseq->funcs.enable_display_power_gating = dce100_enable_display_power_gating;
dc->hwss.pipe_control_lock = dce_pipe_control_lock;
dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth;
}
|
#ifndef __ASM_SH_MIGOR_H
#define __ASM_SH_MIGOR_H
#define PORT_MSELCRA 0xa4050180
#define PORT_MSELCRB 0xa4050182
#define BSC_CS4BCR 0xfec10010
#define BSC_CS6ABCR 0xfec1001c
#define BSC_CS4WCR 0xfec10030
#include <video/sh_mobile_lcdc.h>
int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
#endif /* __ASM_SH_MIGOR_H */
|
/* Area: ffi_call, closure_call
Purpose: Check structure passing with different structure size.
Especially with small structures which may fit in one
register. Depending on the ABI.
Limitations: none.
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_2byte {
unsigned char a;
unsigned char b;
} cls_struct_2byte;
cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1,
struct cls_struct_2byte a2)
{
struct cls_struct_2byte result;
result.a = a1.a + a2.a;
result.b = a1.b + a2.b;
printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);
return result;
}
static void
cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
void* userdata __UNUSED__)
{
struct cls_struct_2byte a1, a2;
a1 = *(struct cls_struct_2byte*)(args[0]);
a2 = *(struct cls_struct_2byte*)(args[1]);
*(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2);
}
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
struct cls_struct_2byte g_dbl = { 12, 127 };
struct cls_struct_2byte f_dbl = { 1, 13 };
struct cls_struct_2byte res_dbl;
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
cls_struct_fields[0] = &ffi_type_uchar;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
dbl_arg_types[0] = &cls_struct_type;
dbl_arg_types[1] = &cls_struct_type;
dbl_arg_types[2] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type,
dbl_arg_types) == FFI_OK);
args_dbl[0] = &g_dbl;
args_dbl[1] = &f_dbl;
args_dbl[2] = NULL;
ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl);
/* { dg-output "12 127 1 13: 13 140" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 140" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 127 1 13: 13 140" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 140" } */
exit(0);
}
|
/*
Power management interface routines.
Written by Mariusz Matuszek.
This code is currently just a placeholder for later work and
does not do anything useful.
This is part of rtl8180 OpenSource driver.
Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
*/
#ifndef R8192_PM_H
#define R8192_PM_H
#include <linux/types.h>
#include <linux/usb.h>
int rtl8192U_save_tate (struct pci_dev *dev, u32 state);
int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state);
int rtl8192U_resume (struct usb_interface *intf);
int rtl8192U_enable_wake (struct pci_dev *dev, u32 state, int enable);
#endif //R8192U_PM_H
|
/*
* Mapping of the rootfs in a physical region of memory
*
* Copyright (C) 2005-2007 PMC-Sierra Inc.
* Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
*
* 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 SOFTWARE IS PROVIDED ``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 AUTHOR 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.
*
* 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.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <asm/io.h>
#include <msp_prom.h>
static struct mtd_info *rr_mtd;
struct map_info rr_map = {
.name = "ramroot",
.bankwidth = 4,
};
static int __init init_rrmap(void)
{
void *ramroot_start;
unsigned long ramroot_size;
/* Check for supported rootfs types */
if (get_ramroot(&ramroot_start, &ramroot_size)) {
rr_map.phys = CPHYSADDR(ramroot_start);
rr_map.size = ramroot_size;
printk(KERN_NOTICE
"PMC embedded root device: 0x%08lx @ 0x%08lx\n",
rr_map.size, (unsigned long)rr_map.phys);
} else {
printk(KERN_ERR
"init_rrmap: no supported embedded rootfs detected!\n");
return -ENXIO;
}
/* Map rootfs to I/O space for block device driver */
rr_map.virt = ioremap(rr_map.phys, rr_map.size);
if (!rr_map.virt) {
printk(KERN_ERR "Failed to ioremap\n");
return -EIO;
}
simple_map_init(&rr_map);
rr_mtd = do_map_probe("map_ram", &rr_map);
if (rr_mtd) {
rr_mtd->owner = THIS_MODULE;
add_mtd_device(rr_mtd);
return 0;
}
iounmap(rr_map.virt);
return -ENXIO;
}
static void __exit cleanup_rrmap(void)
{
del_mtd_device(rr_mtd);
map_destroy(rr_mtd);
iounmap(rr_map.virt);
rr_map.virt = NULL;
}
MODULE_AUTHOR("PMC-Sierra, Inc");
MODULE_DESCRIPTION("MTD map driver for embedded PMC-Sierra MSP filesystem");
MODULE_LICENSE("GPL");
module_init(init_rrmap);
module_exit(cleanup_rrmap);
|
/*
** Compat-5.1
** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat/)
** $Id: compat-5.1.h,v 1.8 2006/02/20 21:12:47 carregal Exp $
*/
#ifndef COMPAT_H
LUALIB_API void luaL_module(lua_State *L, const char *libname,
const luaL_reg *l, int nup);
#define luaL_openlib luaL_module
#endif
|
/*
* testSchemas.c : a small tester program for Schema validation
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@w3.org
*/
#include "libxml.h"
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
/* seems needed for Solaris */
#ifndef MAP_FAILED
#define MAP_FAILED ((void *) -1)
#endif
#endif
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/xmlschemas.h>
#include <libxml/xmlschemastypes.h>
#ifdef LIBXML_DEBUG_ENABLED
static int debug = 0;
#endif
static int noout = 0;
#ifdef HAVE_SYS_MMAN_H
static int memory = 0;
#endif
int main(int argc, char **argv) {
int i;
int files = 0;
xmlSchemaPtr schema = NULL;
for (i = 1; i < argc ; i++) {
#ifdef LIBXML_DEBUG_ENABLED
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
debug++;
else
#endif
#ifdef HAVE_SYS_MMAN_H
if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) {
memory++;
} else
#endif
if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) {
noout++;
}
}
xmlLineNumbersDefault(1);
for (i = 1; i < argc ; i++) {
if (argv[i][0] != '-') {
if (schema == NULL) {
xmlSchemaParserCtxtPtr ctxt;
#ifdef HAVE_SYS_MMAN_H
if (memory) {
int fd;
struct stat info;
const char *base;
if (stat(argv[i], &info) < 0)
break;
if ((fd = open(argv[i], O_RDONLY)) < 0)
break;
base = mmap(NULL, info.st_size, PROT_READ,
MAP_SHARED, fd, 0) ;
if (base == (void *) MAP_FAILED)
break;
ctxt = xmlSchemaNewMemParserCtxt((char *)base,info.st_size);
xmlSchemaSetParserErrors(ctxt,
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
schema = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
munmap((char *) base, info.st_size);
} else
#endif
{
ctxt = xmlSchemaNewParserCtxt(argv[i]);
xmlSchemaSetParserErrors(ctxt,
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
schema = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
}
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef LIBXML_DEBUG_ENABLED
if (debug)
xmlSchemaDump(stdout, schema);
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
if (schema == NULL)
goto failed_schemas;
} else {
xmlDocPtr doc;
doc = xmlReadFile(argv[i],NULL,0);
if (doc == NULL) {
fprintf(stderr, "Could not parse %s\n", argv[i]);
} else {
xmlSchemaValidCtxtPtr ctxt;
int ret;
ctxt = xmlSchemaNewValidCtxt(schema);
xmlSchemaSetValidErrors(ctxt,
(xmlSchemaValidityErrorFunc) fprintf,
(xmlSchemaValidityWarningFunc) fprintf,
stderr);
ret = xmlSchemaValidateDoc(ctxt, doc);
if (ret == 0) {
printf("%s validates\n", argv[i]);
} else if (ret > 0) {
printf("%s fails to validate\n", argv[i]);
} else {
printf("%s validation generated an internal error\n",
argv[i]);
}
xmlSchemaFreeValidCtxt(ctxt);
xmlFreeDoc(doc);
}
}
files ++;
}
}
if (schema != NULL)
xmlSchemaFree(schema);
if (files == 0) {
printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n",
argv[0]);
printf("\tParse the HTML files and output the result of the parsing\n");
#ifdef LIBXML_DEBUG_ENABLED
printf("\t--debug : dump a debug tree of the in-memory document\n");
#endif
printf("\t--noout : do not print the result\n");
#ifdef HAVE_SYS_MMAN_H
printf("\t--memory : test the schemas in memory parsing\n");
#endif
}
failed_schemas:
xmlSchemaCleanupTypes();
xmlCleanupParser();
xmlMemoryDump();
return(0);
}
#else
#include <stdio.h>
int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : Schemas support not compiled in\n", argv[0]);
return(0);
}
#endif /* LIBXML_SCHEMAS_ENABLED */
|
/* Copyright (c) 2008, Avian Contributors
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.
There is NO WARRANTY for this software. See license.txt for
details. */
#ifndef CONSTANTS_H
#define CONSTANTS_H
namespace vm {
enum OpCode {
aaload = 0x32,
aastore = 0x53,
aconst_null = 0x01,
aload = 0x19,
aload_0 = 0x2a,
aload_1 = 0x2b,
aload_2 = 0x2c,
aload_3 = 0x2d,
anewarray = 0xbd,
areturn = 0xb0,
arraylength = 0xbe,
astore = 0x3a,
astore_0 = 0x4b,
astore_1 = 0x4c,
astore_2 = 0x4d,
astore_3 = 0x4e,
athrow = 0xbf,
baload = 0x33,
bastore = 0x54,
bipush = 0x10,
breakpoint = 0xca,
caload = 0x34,
castore = 0x55,
checkcast = 0xc0,
d2f = 0x90,
d2i = 0x8e,
d2l = 0x8f,
dadd = 0x63,
daload = 0x31,
dastore = 0x52,
dcmpg = 0x98,
dcmpl = 0x97,
dconst_0 = 0x0e,
dconst_1 = 0x0f,
ddiv = 0x6f,
dload = 0x18,
dload_0 = 0x26,
dload_1 = 0x27,
dload_2 = 0x28,
dload_3 = 0x29,
dmul = 0x6b,
dneg = 0x77,
drem = 0x73,
dreturn = 0xaf,
dstore = 0x39,
dstore_0 = 0x47,
dstore_1 = 0x48,
dstore_2 = 0x49,
dstore_3 = 0x4a,
dsub = 0x67,
dup = 0x59,
dup_x1 = 0x5a,
dup_x2 = 0x5b,
dup2 = 0x5c,
dup2_x1 = 0x5d,
dup2_x2 = 0x5e,
f2d = 0x8d,
f2i = 0x8b,
f2l = 0x8c,
fadd = 0x62,
faload = 0x30,
fastore = 0x51,
fcmpg = 0x96,
fcmpl = 0x95,
fconst_0 = 0x0b,
fconst_1 = 0x0c,
fconst_2 = 0x0d,
fdiv = 0x6e,
fload = 0x17,
fload_0 = 0x22,
fload_1 = 0x23,
fload_2 = 0x24,
fload_3 = 0x25,
fmul = 0x6a,
fneg = 0x76,
frem = 0x72,
freturn = 0xae,
fstore = 0x38,
fstore_0 = 0x43,
fstore_1 = 0x44,
fstore_2 = 0x45,
fstore_3 = 0x46,
fsub = 0x66,
getfield = 0xb4,
getstatic = 0xb2,
goto_ = 0xa7,
goto_w = 0xc8,
i2b = 0x91,
i2c = 0x92,
i2d = 0x87,
i2f = 0x86,
i2l = 0x85,
i2s = 0x93,
iadd = 0x60,
iaload = 0x2e,
iand = 0x7e,
iastore = 0x4f,
iconst_m1 = 0x02,
iconst_0 = 0x03,
iconst_1 = 0x04,
iconst_2 = 0x05,
iconst_3 = 0x06,
iconst_4 = 0x07,
iconst_5 = 0x08,
idiv = 0x6c,
if_acmpeq = 0xa5,
if_acmpne = 0xa6,
if_icmpeq = 0x9f,
if_icmpne = 0xa0,
if_icmplt = 0xa1,
if_icmpge = 0xa2,
if_icmpgt = 0xa3,
if_icmple = 0xa4,
ifeq = 0x99,
ifge = 0x9c,
ifgt = 0x9d,
ifle = 0x9e,
iflt = 0x9b,
ifne = 0x9a,
ifnonnull = 0xc7,
ifnull = 0xc6,
iinc = 0x84,
iload = 0x15,
iload_0 = 0x1a,
iload_1 = 0x1b,
iload_2 = 0x1c,
iload_3 = 0x1d,
impdep1 = 0xfe,
impdep2 = 0xff,
imul = 0x68,
ineg = 0x74,
instanceof = 0xc1,
invokeinterface = 0xb9,
invokespecial = 0xb7,
invokestatic = 0xb8,
invokevirtual = 0xb6,
ior = 0x80,
irem = 0x70,
ireturn = 0xac,
ishl = 0x78,
ishr = 0x7a,
istore = 0x36,
istore_0 = 0x3b,
istore_1 = 0x3c,
istore_2 = 0x3d,
istore_3 = 0x3e,
isub = 0x64,
iushr = 0x7c,
ixor = 0x82,
jsr = 0xa8,
jsr_w = 0xc9,
l2d = 0x8a,
l2f = 0x89,
l2i = 0x88,
ladd = 0x61,
laload = 0x2f,
land = 0x7f,
lastore = 0x50,
lcmp = 0x94,
lconst_0 = 0x09,
lconst_1 = 0x0a,
ldc = 0x12,
ldc_w = 0x13,
ldc2_w = 0x14,
ldiv_ = 0x6d,
lload = 0x16,
lload_0 = 0x1e,
lload_1 = 0x1f,
lload_2 = 0x20,
lload_3 = 0x21,
lmul = 0x69,
lneg = 0x75,
lookupswitch = 0xab,
lor = 0x81,
lrem = 0x71,
lreturn = 0xad,
lshl = 0x79,
lshr = 0x7b,
lstore = 0x37,
lstore_0 = 0x3f,
lstore_1 = 0x40,
lstore_2 = 0x41,
lstore_3 = 0x42,
lsub = 0x65,
lushr = 0x7d,
lxor = 0x83,
monitorenter = 0xc2,
monitorexit = 0xc3,
multianewarray = 0xc5,
new_ = 0xbb,
newarray = 0xbc,
nop = 0x00,
pop_ = 0x57,
pop2 = 0x58,
putfield = 0xb5,
putstatic = 0xb3,
ret = 0xa9,
return_ = 0xb1,
saload = 0x35,
sastore = 0x56,
sipush = 0x11,
swap = 0x5f,
tableswitch = 0xaa,
wide = 0xc4
};
enum TypeCode {
T_BOOLEAN = 4,
T_CHAR = 5,
T_FLOAT = 6,
T_DOUBLE = 7,
T_BYTE = 8,
T_SHORT = 9,
T_INT = 10,
T_LONG = 11
};
enum Constant {
CONSTANT_Class = 7,
CONSTANT_Fieldref = 9,
CONSTANT_Methodref = 10,
CONSTANT_InterfaceMethodref = 11,
CONSTANT_String = 8,
CONSTANT_Integer = 3,
CONSTANT_Float = 4,
CONSTANT_Long = 5,
CONSTANT_Double = 6,
CONSTANT_NameAndType = 12,
CONSTANT_Utf8 = 1
};
const unsigned ACC_PUBLIC = 1 << 0;
const unsigned ACC_PRIVATE = 1 << 1;
const unsigned ACC_PROTECTED = 1 << 2;
const unsigned ACC_STATIC = 1 << 3;
const unsigned ACC_FINAL = 1 << 4;
const unsigned ACC_SUPER = 1 << 5;
const unsigned ACC_SYNCHRONIZED = ACC_SUPER;
const unsigned ACC_VOLATILE = 1 << 6;
const unsigned ACC_TRANSIENT = 1 << 7;
const unsigned ACC_NATIVE = 1 << 8;
const unsigned ACC_INTERFACE = 1 << 9;
const unsigned ACC_ABSTRACT = 1 << 10;
const unsigned ACC_STRICT = 1 << 11;
const int JNI_COMMIT = 1;
const int JNI_ABORT = 2;
const int JNI_OK = 0;
const int JNI_ERR = -1;
const int JNI_EDETACHED = -2;
const int JNI_EVERSION = -3;
const int JNI_ENOMEM = -4;
const int JNI_EEXIST = -5;
const int JNI_EINVAL = -6;
const int JNI_VERSION_1_1 = 0x00010001;
const int JNI_VERSION_1_2 = 0x00010002;
const int JNI_VERSION_1_4 = 0x00010004;
} // namespace vm
#endif//CONSTANTS_H
|
/* ISC license. */
#include <skalibs/nonposix.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
int open2 (char const *s, unsigned int flags)
{
int r ;
do r = open(s, flags) ;
while ((r == -1) && (errno == EINTR)) ;
return r ;
}
|
/*
This file is part of the Brother MFC/DCP backend for SANE.
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
*/
#ifndef _ADVANCED_INIFILE_
#define _ADVANCED_INIFILE_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#define pintf_error printf
#define NAMELEN 64
typedef struct _sane_model_info {
char model_name[NAMELEN];
char friendly_name[NAMELEN];
int pid;
int vid;
int func_type;
int expanded_func_type; //M-LNX-20
int model_type;
int r_endpoint;
int w_endpoint;
char colmatchDL[NAMELEN];
char colmatchTBL[NAMELEN]; //M-LNX-20
char graylevelTBL[NAMELEN]; //M-LNX-20
struct _sane_model_info *next;
//void *next;
} sane_model_info;
//
//expanded_func_type
//
#define EXP_CAPDUPLEX (1<<0)
#define MODELSECTION "[Support Model]"
sane_model_info get_model_info_from_ini_by_product_id(int id);
sane_model_info *get_p_model_info_from_ini_by_product_id(int id);
int free_inifile_tree();
#define IPDEVICEFORMAT "DEVICE=%s , %s , %s , IP-ADDRESS=%s "
#define NODEDEVICEFORMAT "DEVICE=%s , %s , %s , NODENAME=%s "
#define KEY_DEVICE 0
#define KEY_MODEL 1
#define KEY_IP 2
#define KEY_NODE 3
#define KEY_ID 4
#define KEY_CMDLL 5
//---------------------------------------------
#define NETINI_KEYSIZE 32
#define NETINI_VAL_SIZE 256
typedef struct _netini {
// char key[NETINI_KEYSIZE];
// char value[NETINI_VAL_SIZE];
char friendlyname[NAMELEN];
char model[NAMELEN];
char ip[64];
char node[NAMELEN];
char id[64];
struct _netini *next;
} netini;
#define CONFDIR "/usr/local/Brother/sane/"
char *get_net_ini_value(int index ,int key, char *value, int size);
int free_net_inifile_tree();
char *get_net_ini_value2(char *key, char *value, int size);
int get_net_device_num();
int ReadModelInfo2(char *lpReturnedString,int nSize);
int ReadModelInfoSize2(int *size, int *record);
sane_model_info *get_p_model_info_by_index(int index);
#define FOR_OEM
//files depend on besane revisions
#ifndef BRSANESUFFIX
#include "brother_sanesufix.h"
#endif
#if BRSANESUFFIX == 1
#define MODELINIDIR "/usr/local/Brother/sane/models"
#define CONFFILE "/usr/local/Brother/sane/brsanenetdevice.cfg"
#define MAININIFILE "/usr/local/Brother/sane/Brsane.ini"
#define BRSANETMPFILE "/tmp/brsane_tempfile_XXXXXX"
#define SANESAVEFILE ".brsaneconfig"
#define S_BRSANESUFFIX ""
#elif BRSANESUFFIX == 2
#define MODELINIDIR "/usr/local/Brother/sane/models2"
#define CONFFILE "/usr/local/Brother/sane/brsanenetdevice2.cfg"
#define MAININIFILE "/usr/local/Brother/sane/Brsane2.ini"
#define BRSANETMPFILE "/tmp/brsane_tempfile2_XXXXXX"
#define SANESAVEFILE ".brsaneconfig2"
#define S_BRSANESUFFIX "2"
#elif BRSANESUFFIX == 3
#define MODELINIDIR "/usr/local/Brother/sane/models3"
#define CONFFILE "/usr/local/Brother/sane/brsanenetdevice3.cfg"
#define MAININIFILE "/usr/local/Brother/sane/Brsane3.ini"
#define BRSANETMPFILE "/tmp/brsane_tempfile3_XXXXXX"
#define SANESAVEFILE ".brsaneconfig3"
#define S_BRSANESUFFIX "3"
#endif
// for brsaneconfig
int check_inifile_name(char *file);
int scan_model_directory();
void reform_line(char *line);
int debug_disp_model_info();
char *get_net_ini_value_by_name(char *name ,int key, char *value, int size);
#endif
|
/* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. */
#include "lwt_config.h"
#if defined(LWT_ON_WINDOWS)
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
#include "lwt_unix.h"
struct job_system {
struct lwt_unix_job job;
HANDLE handle;
};
static void worker_system(struct job_system *job)
{
WaitForSingleObject(job->handle, INFINITE);
}
static value result_system(struct job_system *job)
{
HANDLE handle = job->handle;
DWORD code;
DWORD err;
lwt_unix_free_job(&job->job);
if (!GetExitCodeProcess(handle, &code)) {
err = GetLastError();
CloseHandle(handle);
win32_maperr(err);
uerror("GetExitCodeProcess", Nothing);
}
CloseHandle(handle);
return Val_int(code);
}
CAMLprim value lwt_unix_system_job(value cmdline)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
if (!CreateProcess(NULL, String_val(cmdline), NULL, NULL, TRUE, 0, NULL,
NULL, &si, &pi)) {
win32_maperr(GetLastError());
uerror("CreateProcess", Nothing);
} else {
LWT_UNIX_INIT_JOB(job, system, 0);
CloseHandle(pi.hThread);
job->handle = pi.hProcess;
return lwt_unix_alloc_job(&(job->job));
}
}
#endif
|
// Copyright (c) 2017-2021 offa
// Copyright 2011 Ciaran McHale.
//
// 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.
#pragma once
namespace danek
{
namespace lex
{
//--------
// Constants for lexical symbols, for everything except
// keywords and function names. Constants for those are
// defined in a subclass.
//--------
enum LexBaseSymbols
{
LEX_IDENT_SYM = 1,
LEX_SEMICOLON_SYM = 2,
LEX_PLUS_SYM = 3,
LEX_QUESTION_EQUALS_SYM = 4,
LEX_EQUALS_SYM = 5,
LEX_EQUALS_EQUALS_SYM = 6,
LEX_NOT_EQUALS_SYM = 7,
LEX_STRING_SYM = 8,
LEX_COMMA_SYM = 9,
LEX_AND_SYM = 10,
LEX_OR_SYM = 11,
LEX_NOT_SYM = 12,
LEX_AT_SYM = 13,
LEX_OPEN_BRACKET_SYM = 14,
LEX_CLOSE_BRACKET_SYM = 15,
LEX_OPEN_BRACE_SYM = 16,
LEX_CLOSE_BRACE_SYM = 17,
LEX_OPEN_PAREN_SYM = 18,
LEX_CLOSE_PAREN_SYM = 19,
LEX_EOF_SYM = 20,
LEX_UNKNOWN_SYM = 21,
LEX_UNKNOWN_FUNC_SYM = 22,
LEX_IDENT_TOO_LONG_SYM = 23,
LEX_STRING_WITH_EOL_SYM = 24,
LEX_ILLEGAL_IDENT_SYM = 25,
LEX_TWO_DOTS_IDENT_SYM = 26,
LEX_BLOCK_STRING_WITH_EOF_SYM = 27,
LEX_SOLE_DOT_IDENT_SYM = 28
};
}
}
|
//
// UIImage+RenderMode.h
// BaisiTest
//
// Created by HEYANG on 16/1/19.
// Copyright © 2016年 HEYANG. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (RenderMode)
/** 取消UIImage的渲染模式 */
+ (UIImage *)imageRenderingModeImageNamed:(NSString *)imageName;
@end
|
#ifndef EVOLVE_H
#define EVOLVE_H
void evolve_step(const double mass[], double pos[][NDIM], double vel[][NDIM],
double acc[][NDIM], double jrk[][NDIM], double dst[],
double old_pos[][NDIM], double old_vel[][NDIM],
double old_acc[][NDIM], double old_jrk[][NDIM],
int n, double dt, double & epot, double & coll_time);
void predict_step(double pos[][NDIM], double vel[][NDIM],
const double acc[][NDIM], const double jrk[][NDIM],
int n, double dt);
void correct_step(double pos[][NDIM], double vel[][NDIM],
const double acc[][NDIM], const double jrk[][NDIM],
const double old_pos[][NDIM], const double old_vel[][NDIM],
const double old_acc[][NDIM], const double old_jrk[][NDIM],
int n, double dt);
void get_acc_jrk_pot_coll(const double mass[], const double pos[][NDIM],
const double vel[][NDIM], double acc[][NDIM],
double jrk[][NDIM], double dst[], int n, double & epot,
double & coll_time);
#endif |
//
// UIImageView+BKUpload.h
// BKFrameworkDemo
//
// Created by bestkai on 2017/3/22.
// Copyright © 2017年 bestkai. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BKBaseRequest.h"
@interface UIImageView (BKUpload)
/**
Upload self image
@param url <#url description#>
@param parameters <#parameters description#>
@param dataParameter @{@"name":@"fieldNameHere",@"fileName":@"avatar.jpg",@"mimeType":@"image/jpeg"}
@param progressBlock <#progressBlock description#>
@param successBlock <#successBlock description#>
@param failureBlock <#failureBlock description#>
*/
- (void)bk_uploadImageWithURL:(NSString *)url parameterDictionary:(NSDictionary *)parameters andDataParameterDic:(NSDictionary*)dataParameter progress:(BKRequestProgressBlock)progressBlock successed:(BKRequestSuccessBlock)successBlock failed:(BKRequestFailureBlock)failureBlock;
@end
|
//
// CustomCell.h
// RKAccordionTableView
//
// Created by Pai on 7/4/17.
// Copyright © 2017 Radhakrishna Pai. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "RKAccordionCell.h"
typedef void (^ActionBlock)();
@interface CustomCell : RKAccordionCell
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (weak, nonatomic) IBOutlet UIButton *arrowButton;
@property (strong, nonatomic) ActionBlock actionBlock;
@property (strong, nonatomic) NSIndexPath *indexPath;
@end
|
//
// YNCoreData.h
// YNCommonProject
//
// Created by 王阳 on 2016/12/6.
// Copyright © 2016年 王阳. All rights reserved.
//
#ifndef YNCoreData_h
#define YNCoreData_h
#import "NSFetchRequest+YNExtensions.h"
#import "NSManagedObject+YNDictionary.h"
#import "NSManagedObject+YNExtensions.h"
#import "NSManagedObjectContext+YNExtensions.h"
#import "NSManagedObjectContext+YNFetching.h"
#import "NSManagedObjectContext+YNFetchRequestsConstructors.h"
#import "NSManagedObjectContext+YNObjectClear.h"
#endif /* YNCoreData_h */
|
//
// MasterViewController.h
// iCloud Test One
//
// Created by Lucien Dupont on 6/21/15.
// Copyright © 2015 Lucien Dupont. All rights reserved.
//
#import <UIKit/UIKit.h>
@class DetailViewController;
@interface MasterViewController : UITableViewController
@property (strong, nonatomic) DetailViewController *detailViewController;
@end
|
#ifndef _PRINTING_H_
#define _PRINTING_H_
/* C/C++ headers */
#include <stdio.h>
#include <cstdlib>
#include <string>
/* Local headers */
#include "types.h"
#include "cminus.h"
#include "cminus.tab.h"
/* Printing and String manipulation */
const char * iboolToString( int ib ); // Returns "true" for 1, "false" for 0
std::string applyIndents( std::string s, int indent_count );
const char * typeToStr( Type t ); // Returns literal string of type, eg "int" for Integer
const char * nodekindToStr( NodeKind nk );
std::string svalResolve( TreeNode * tree ); // Resolves the svalue of node or token as a C++ string
std::string opToStr( TokenData * tok );
/* Failed attempt as generic errors. May be revived in the future. */
void printError( int line, std::string err );
void printWarning( int line, std::string warn );
void printTreeNode( void * node );
void printTokenData( void * token );
// TODO: combine the two print tree functions, or move bulk to another function?
// Recursively prints the abstract syntax tree
void printAbstractTree(TreeNode * tree, int indent_count = 0);
// Recursively prints the annotated syntax tree
void printAnnotatedTree(TreeNode * tree, int indent_count = 0);
#endif
|
/*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2014 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HKBASE_HK_FIXED_INPLACE_ARRAY_H
#define HKBASE_HK_FIXED_INPLACE_ARRAY_H
/// This is an array of fixed size with inplace storage. It will ASSERT if its capacity is exhausted.
/// Essentially a wrapper around a C array with additional safety checks in debug.
template <typename T, int N>
class hkFixedInplaceArray
{
public:
typedef T ItemType;
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_ARRAY, hkFixedInplaceArray);
/// Creates a zero length array.
HK_FORCE_INLINE hkFixedInplaceArray() : m_size(0) {}
/// Returns the size.
HK_FORCE_INLINE int getSize() const { return m_size; }
/// Returns true is the array is full.
HK_FORCE_INLINE bool isFull() const { return m_size == N; }
/// Clear the array.
HK_FORCE_INLINE void clear() { m_size = 0; }
/// Returns the capacity.
HK_FORCE_INLINE int getCapacity() const { return N; }
/// Returns a pointer to the beginning of the array.
HK_FORCE_INLINE T* begin() { return m_data; }
/// Returns a pointer to the beginning of the array.
HK_FORCE_INLINE const T* begin() const { return m_data; }
/// Append elements to the array.
HK_FORCE_INLINE void append(const T* items, int count) { while(count--) pushBack(*items++); }
/// Sets the size (i.e. number of used elements).
HK_FORCE_INLINE void setSize(int size) { m_size = size; HK_ASSERT2(0x48488B10, m_size <= N, "Fixed inplace array capacity overflow"); }
/// Sets the size (i.e. number of used elements).
HK_FORCE_INLINE void setSizeUnchecked(int size) { setSize(size); }
/// Checks if the size is zero.
HK_FORCE_INLINE hkBool isEmpty() const { return m_size == 0; }
/// Increments the size by 1 and returns a reference to the first element created.
HK_FORCE_INLINE T& expandOne() { HK_ASSERT2(0x48488B11, m_size < N, "Fixed inplace array capacity overflow"); return m_data[m_size++]; }
/// Increments the size by 1 and returns a reference to the first element created.
HK_FORCE_INLINE T* expandBy(int n) { HK_ASSERT2(0x48488B11, m_size+n <= N, "Fixed inplace array capacity overflow"); T* res = m_data+m_size; m_size += n; return res; }
/// Read/write access to the i'th element.
HK_FORCE_INLINE T& operator[] (int i) { HK_ASSERT2(0x48488B12, i >= 0 && i < m_size, "Index out of range"); return m_data[i]; }
/// Read only access to the i'th element.
HK_FORCE_INLINE const T& operator[] (int i) const { HK_ASSERT2(0x48488B12, i >= 0 && i < m_size, "Index out of range"); return m_data[i]; }
/// Adds an element to the end.
HK_FORCE_INLINE void pushBack(const T& e) { expandOne() = e; }
/// Adds an element to the end.
HK_FORCE_INLINE void pushBackUnchecked(const T& e) { pushBack(e); }
/// Remove the last element.
HK_FORCE_INLINE void popBack() { HK_ASSERT2(0x48488B14, m_size > 0, "Empty array"); m_size--; }
/// Remove the i'th element and replace its location with the last element of the array.
HK_FORCE_INLINE void removeAt(int i) { operator[](i) = back(); popBack(); }
/// Inserts t at index i. Elements from i to the end are copied up one place.
HK_FORCE_INLINE void insertAt(int i, const T& t)
{
HK_ASSERT2(0x48488B11, m_size < N, "Fixed inplace array capacity overflow");
for(int j=m_size; j>i; j--)
{
m_data[j] = m_data[j-1];
}
m_data[i] = t;
m_size++;
}
/// Read/write access to the last element.
HK_FORCE_INLINE T& back() { return operator[](m_size-1); }
/// Read only access to the last element.
HK_FORCE_INLINE const T& back() const { return operator[](m_size-1); }
/// Linear search.
inline int indexOf(const T& v) const { for(int i=0; i<m_size; ++i) { if(m_data[i] == v) return i; } return -1; }
protected:
T m_data[N];
int m_size;
};
#include <Common/Base/Container/Array/hkFixedInplaceArray.inl>
#endif // HKBASE_HK_FIXED_INPLACE_ARRAY_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907)
*
* Confidential Information of Havok. (C) Copyright 1999-2014
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
|
#include<REG52.h>//51µ¥Æ¬»úÍ·Îļþ
void delay();//ÑÓʱº¯ÊýÉùÃ÷
sbit a = P1^0;//Êä³ö¶Ë¿Ú¶¨Òå
main()
{
while(1)
{
a = 0;
delay();
a = 1;
delay();
}
}
void delay()//ÑÓʱº¯Êý
{
unsigned char i;//×Ö·ûÐͱäÁ¿i¶¨Òå
for(i=200;i>0;i--);//Ñ»·ÑÓʱ
} |
#define CIMPLE_PLATFORM_LINUX_IX86_GNU
//#define CIMPLE_PLATFORM_LINUX_PPC_GNU
|
//
// open horizon -- undefined_darkness@outlook.com
//
#pragma once
#include <vector>
#include <string>
//------------------------------------------------------------
//ToDo - dependency inversion?
namespace gui { struct menu_controls; }
namespace game { struct plane_controls; }
//------------------------------------------------------------
class joystick_config
{
public:
void init(const char *name);
void update_config();
void update(const float *axes, int axes_count, const unsigned char *btns, int btns_count);
void apply_controls(game::plane_controls &controls, bool &pause);
void apply_controls(gui::menu_controls &controls);
private:
static unsigned int convert_cmd(const std::string &cmd);
private:
struct axis
{
int idx;
float deadzone;
bool inverted;
unsigned int cmd;
};
std::vector<axis> m_axes;
struct btn
{
int idx;
unsigned int cmd;
};
std::vector<btn> m_buttons;
private:
std::vector<float> m_joy_axes;
std::vector<bool> m_joy_btns;
};
//------------------------------------------------------------
|
#include <errno.h>
#include <stdint.h>
#include <sys/mman.h>
#include <onyx/heap.h>
#include <onyx/limits.h>
#include "syscall.h"
/* Expand the heap in-place if brk can be used, or otherwise via mmap,
* using an exponential lower bound on growth by mmap to make
* fragmentation asymptotically irrelevant. The size argument is both
* an input and an output, since the caller needs to know the size
* allocated, which will be larger than requested due to page alignment
* and mmap minimum size rules. The caller is responsible for locking
* to prevent concurrent calls. */
unsigned long get_brk()
{
return (unsigned long) heap_get()->brk;
}
void *sbrk(intptr_t);
void *__expand_heap(size_t *pn)
{
static uintptr_t brk;
size_t n = *pn;
if (n > SIZE_MAX / 2 - PAGE_SIZE)
{
errno = ENOMEM;
return 0;
}
n += -n & (PAGE_SIZE - 1);
if (!brk)
{
brk = get_brk();
brk += -brk & (PAGE_SIZE - 1);
}
if (n < SIZE_MAX - brk && sbrk(n) != (void *) -1)
{
*pn = n;
brk += n;
return (void *) (brk - n);
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.