text
stringlengths 2
100k
| meta
dict |
---|---|
<!doctype html>
<html>
<title>npm-deprecate</title>
<meta http-equiv="content-type" value="text/html;utf-8">
<link rel="stylesheet" type="text/css" href="../../static/style.css">
<body>
<div id="wrapper">
<h1><a href="../api/npm-deprecate.html">npm-deprecate</a></h1> <p>Deprecate a version of a package</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<pre><code>npm.commands.deprecate(args, callback)</code></pre>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p>This command will update the npm registry entry for a package, providing
a deprecation warning to all who attempt to install it.</p>
<p>The 'args' parameter must have exactly two elements:</p>
<ul><li><p><code>package[@version]</code></p><p>The <code>version</code> portion is optional, and may be either a range, or a
specific version, or a tag.</p></li><li><p><code>message</code></p><p>The warning message that will be printed whenever a user attempts to
install the package.</p></li></ul>
<p>Note that you must be the package owner to deprecate something. See the
<code>owner</code> and <code>adduser</code> help topics.</p>
<p>To un-deprecate a package, specify an empty string (<code>""</code>) for the <code>message</code> argument.</p>
<h2 id="SEE-ALSO">SEE ALSO</h2>
<ul><li><a href="../api/npm-publish.html">npm-publish(3)</a></li><li><a href="../api/npm-unpublish.html">npm-unpublish(3)</a></li><li><a href="../misc/npm-registry.html">npm-registry(7)</a></li></ul>
</div>
<p id="footer">npm-deprecate — [email protected]</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
.filter(function (el) {
return el.parentNode === wrapper
&& el.tagName.match(/H[1-6]/)
&& el.id
})
var l = 2
, toc = document.createElement("ul")
toc.innerHTML = els.map(function (el) {
var i = el.tagName.charAt(1)
, out = ""
while (i > l) {
out += "<ul>"
l ++
}
while (i < l) {
out += "</ul>"
l --
}
out += "<li><a href='#" + el.id + "'>" +
( el.innerText || el.text || el.innerHTML)
+ "</a>"
return out
}).join("\n")
toc.id = "toc"
document.body.appendChild(toc)
})()
</script>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on Sat Jan 12 20:50:59 2019 by Eclipse SUMO duarouter Version v1_0_1+1015-8e01b2d
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/duarouterConfiguration.xsd">
<input>
<net-file value="input_net.net.xml"/>
<route-files value="input_trips.trips.xml"/>
</input>
<output>
<write-license value="true"/>
<output-file value="routes.rou.xml"/>
<alternatives-output value="routes.rou.alt.xml"/>
</output>
<report>
<xml-validation value="never"/>
<no-step-log value="true"/>
</report>
</configuration>
-->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vehicle id="0" depart="0.00">
<routeDistribution last="0">
<route cost="914.79" probability="1.00000000" edges="src f600 b100 dest"/>
</routeDistribution>
</vehicle>
</routes>
| {
"pile_set_name": "Github"
} |
+++
title = "page 4"
description = "Ceci est une page test"
hidden = true
+++
Ceci est une page de demo | {
"pile_set_name": "Github"
} |
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-consul-exporter.serviceAccountName" . }}
labels:
app: {{ template "prometheus-consul-exporter.name" . }}
chart: {{ template "prometheus-consul-exporter.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end -}}
| {
"pile_set_name": "Github"
} |
#undef UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <afunix.h>
#include <stdlib.h>
#include <stdio.h>
#pragma comment(lib, "Ws2_32")
#define SERVER_SOCKET "server.sock"
int __cdecl main(void) {
SOCKET ClientSocket = INVALID_SOCKET;
SOCKET ListenSocket = INVALID_SOCKET;
int Result;
char SendBuffer[] = "af_unix from Windows to WSL!";
int SendResult;
SOCKADDR_UN ServerSocket;
WSADATA WsaData;
// Initialize Winsock
Result = WSAStartup(MAKEWORD(2, 2), &WsaData);
if (Result != 0) {
printf("WSAStartup failed with error: %d\n", Result);
goto Exit;
}
// Create a AF_UNIX stream server socket.
ListenSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (ListenSocket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
goto Exit;
}
memset(&ServerSocket, 0, sizeof(ServerSocket));
ServerSocket.sun_family = AF_UNIX;
strncpy(ServerSocket.sun_path, SERVER_SOCKET, strlen(SERVER_SOCKET));
// Bind the socket to the path.
Result = bind(ListenSocket, (struct sockaddr *)&ServerSocket, sizeof(ServerSocket));
if (Result == SOCKET_ERROR) {
printf("bind failed with error: %d\n", WSAGetLastError());
goto Exit;
}
// Listen to start accepting connections.
Result = listen(ListenSocket, SOMAXCONN);
if (Result == SOCKET_ERROR) {
printf("listen failed with error: %d\n", WSAGetLastError());
goto Exit;
}
printf("Accepting connections on: '%s'\n", SERVER_SOCKET);
// Accept a connection.
ClientSocket = accept(ListenSocket, NULL, NULL);
if (ClientSocket == INVALID_SOCKET) {
printf("accept failed with error: %d\n", WSAGetLastError());
goto Exit;
}
printf("Accepted a connection.\n");
printf("Relayed %zu bytes: '%s'\n", strlen(SendBuffer), SendBuffer);
// Send some data.
SendResult = send(ClientSocket, SendBuffer, (int)strlen(SendBuffer), 0);
if (SendResult == SOCKET_ERROR) {
printf("send failed with error: %d\n", WSAGetLastError());
goto Exit;
}
// shutdown the connection.
printf("Shutting down\n");
Result = shutdown(ClientSocket, 0);
if (Result == SOCKET_ERROR) {
printf("shutdown failed with error: %d\n", WSAGetLastError());
goto Exit;
}
Exit:
// cleanup
if (ListenSocket != INVALID_SOCKET) {
closesocket(ListenSocket);
}
if (ClientSocket != INVALID_SOCKET) {
closesocket(ClientSocket);
}
// Analogous to `unlink`
DeleteFileA(SERVER_SOCKET);
WSACleanup();
return 0;
} | {
"pile_set_name": "Github"
} |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::Result;
use bytecode_verifier::{verify_module, verify_script};
use compiled_stdlib::{stdlib_modules, StdLibOptions};
use ir_to_bytecode::{
compiler::{compile_module, compile_script},
parser::{parse_module, parse_script},
};
use libra_types::account_address::AccountAddress;
use vm::{
access::ScriptAccess,
errors::{Location, VMError},
file_format::{CompiledModule, CompiledScript},
};
#[allow(unused_macros)]
macro_rules! instr_count {
($compiled: expr, $instr: pat) => {
$compiled
.as_inner()
.code
.code
.iter()
.filter(|ins| match ins {
$instr => true,
_ => false,
})
.count();
};
}
fn compile_script_string_impl(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<(CompiledScript, Option<VMError>)> {
let parsed_script = parse_script("file_name", code).unwrap();
let compiled_script = compile_script(None, parsed_script, &deps)?.0;
let mut serialized_script = Vec::<u8>::new();
compiled_script.serialize(&mut serialized_script)?;
let deserialized_script = CompiledScript::deserialize(&serialized_script)
.map_err(|e| e.finish(Location::Undefined).into_vm_status())?;
assert_eq!(compiled_script, deserialized_script);
// Always return a CompiledScript because some callers explicitly care about unverified
// modules.
Ok(match verify_script(&compiled_script) {
Ok(_) => (compiled_script, None),
Err(error) => (compiled_script, Some(error)),
})
}
pub fn compile_script_string_and_assert_no_error(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledScript> {
let (verified_script, verification_error) = compile_script_string_impl(code, deps)?;
assert!(verification_error.is_none());
Ok(verified_script)
}
pub fn compile_script_string(code: &str) -> Result<CompiledScript> {
compile_script_string_and_assert_no_error(code, vec![])
}
#[allow(dead_code)]
pub fn compile_script_string_with_deps(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledScript> {
compile_script_string_and_assert_no_error(code, deps)
}
#[allow(dead_code)]
pub fn compile_script_string_and_assert_error(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledScript> {
let (verified_script, verification_error) = compile_script_string_impl(code, deps)?;
assert!(verification_error.is_some());
Ok(verified_script)
}
fn compile_module_string_impl(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<(CompiledModule, Option<VMError>)> {
let address = AccountAddress::ZERO;
let module = parse_module("file_name", code).unwrap();
let compiled_module = compile_module(address, module, &deps)?.0;
let mut serialized_module = Vec::<u8>::new();
compiled_module.serialize(&mut serialized_module)?;
let deserialized_module = CompiledModule::deserialize(&serialized_module)
.map_err(|e| e.finish(Location::Undefined).into_vm_status())?;
assert_eq!(compiled_module, deserialized_module);
// Always return a CompiledModule because some callers explicitly care about unverified
// modules.
Ok(match verify_module(&compiled_module) {
Ok(_) => (compiled_module, None),
Err(error) => (compiled_module, Some(error)),
})
}
pub fn compile_module_string_and_assert_no_error(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledModule> {
let (verified_module, verification_error) = compile_module_string_impl(code, deps)?;
assert!(verification_error.is_none());
Ok(verified_module)
}
pub fn compile_module_string(code: &str) -> Result<CompiledModule> {
compile_module_string_and_assert_no_error(code, vec![])
}
#[allow(dead_code)]
pub fn compile_module_string_with_deps(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledModule> {
compile_module_string_and_assert_no_error(code, deps)
}
#[allow(dead_code)]
pub fn compile_module_string_and_assert_error(
code: &str,
deps: Vec<CompiledModule>,
) -> Result<CompiledModule> {
let (verified_module, verification_error) = compile_module_string_impl(code, deps)?;
assert!(verification_error.is_some());
Ok(verified_module)
}
pub fn count_locals(script: &CompiledScript) -> usize {
script.signature_at(script.code().locals).0.len()
}
pub fn compile_module_string_with_stdlib(code: &str) -> Result<CompiledModule> {
compile_module_string_and_assert_no_error(code, stdlib())
}
pub fn compile_script_string_with_stdlib(code: &str) -> Result<CompiledScript> {
compile_script_string_and_assert_no_error(code, stdlib())
}
fn stdlib() -> Vec<CompiledModule> {
stdlib_modules(StdLibOptions::Compiled).to_vec()
}
| {
"pile_set_name": "Github"
} |
{
"tests":[
{
"name":"managedInstances vulnerabilityAssessments - empty",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/managedInstances_vulnerabilityAssessments",
"json":{
"apiVersion":"2018-06-01-preview",
"properties":{
}
},
"expectedErrors":[
{
"message": "Missing required property: name",
"dataPath": "/",
"schemaPath": "/required/0"
},
{
"message": "Missing required property: type",
"dataPath": "/",
"schemaPath": "/required/1"
},
{
"message": "Data does not match any schemas from \"oneOf\"",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf",
"subErrors": [
{
"message": "Missing required property: storageContainerPath",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/0"
},
{
"message": "Invalid type: object (expected string)",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/1/type"
}
]
}
]
},
{
"name":"managedInstances vulnerabilityAssessments - min",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/managedInstances_vulnerabilityAssessments",
"json":{
"apiVersion":"2018-06-01-preview",
"name":"myInstance/default",
"type":"Microsoft.Sql/managedInstances/vulnerabilityAssessments",
"properties":{
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
},
{
"name":"servers vulnerabilityAssessments - empty",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/servers_vulnerabilityAssessments",
"json":{
"apiVersion":"2018-06-01-preview",
"properties":{
}
},
"expectedErrors":[
{
"message": "Missing required property: name",
"dataPath": "/",
"schemaPath": "/required/0"
},
{
"message": "Missing required property: type",
"dataPath": "/",
"schemaPath": "/required/1"
},
{
"message": "Data does not match any schemas from \"oneOf\"",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf",
"subErrors": [
{
"message": "Missing required property: storageContainerPath",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/0"
},
{
"message": "Invalid type: object (expected string)",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/1/type"
}
]
}
]
},
{
"name":"servers vulnerabilityAssessments - min",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/servers_vulnerabilityAssessments",
"json":{
"apiVersion":"2018-06-01-preview",
"name":"myServer/default",
"type":"Microsoft.Sql/servers/vulnerabilityAssessments",
"properties":{
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
},
{
"name":"servers databases securityAlertPolicies - empty",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/servers_databases_securityAlertPolicies",
"json":{
"apiVersion":"2018-06-01-preview",
"properties":{
}
},
"expectedErrors":[
{
"message": "Missing required property: name",
"dataPath": "/",
"schemaPath": "/required/0"
},
{
"message": "Missing required property: type",
"dataPath": "/",
"schemaPath": "/required/1"
},
{
"message": "Data does not match any schemas from \"oneOf\"",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf",
"subErrors": [
{
"message": "Missing required property: state",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/0/required/0"
},
{
"message": "Invalid type: object (expected string)",
"dataPath": "/properties",
"schemaPath": "/properties/properties/oneOf/1/type"
}
]
}
]
},
{
"name":"servers databases securityAlertPolicies - min",
"definition":"https://schema.management.azure.com/schemas/2018-06-01-preview/Microsoft.Sql.json#/resourceDefinitions/servers_databases_securityAlertPolicies",
"json":{
"apiVersion":"2018-06-01-preview",
"name":"myServer/myDatabase/default",
"type":"Microsoft.Sql/servers/databases/securityAlertPolicies",
"properties": {
"state": "Enabled"
}
}
}
]
}
| {
"pile_set_name": "Github"
} |
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim 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, 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.
*/
/** \file
*
* Ultra lightweight ring buffer, for fast insertion/deletion.
*/
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 128
/** Maximum number of data elements to buffer before forcing a flush.
* Must be less than BUFFER_SIZE
*/
#define BUFFER_NEARLY_FULL 96
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
/** Datatype which may be used to store the count of data stored in a buffer, retrieved
* via a call to \ref RingBuffer_GetCount().
*/
#if (BUFFER_SIZE <= 0xFF)
#define RingBuff_Count_t uint8_t
#else
#define RingBuff_Count_t uint16_t
#endif
/* Type Defines: */
/** Type define for a new ring buffer object. Buffers should be initialized via a call to
* \ref RingBuffer_InitBuffer() before use.
*/
typedef struct
{
RingBuff_Data_t Buffer[BUFFER_SIZE]; /**< Internal ring buffer data, referenced by the buffer pointers. */
RingBuff_Data_t* In; /**< Current storage location in the circular buffer */
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
* by re-initializing them using this function.
*
* \param[out] Buffer Pointer to a ring buffer structure to initialize
*/
static inline void RingBuffer_InitBuffer(RingBuff_t* const Buffer)
{
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Buffer->In = Buffer->Buffer;
Buffer->Out = Buffer->Buffer;
}
}
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
* when reading out the contents of the buffer, so that as small a time as possible is spent
* in an atomic lock.
*
* \note The value returned by this function is guaranteed to only be the minimum number of bytes
* stored in the given buffer; this value may change as other threads write new data and so
* the returned number should be used only to determine how many successive reads may safely
* be performed on the buffer.
*
* \param[in] Buffer Pointer to a ring buffer structure whose count is to be computed
*/
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
return Count;
}
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
*
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
*/
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
}
/** Atomically determines if the specified ring buffer contains any data. This should
* be tested before removing data from the buffer, to ensure that the buffer does not
* underflow.
*
* If the data is to be removed in a loop, store the total number of bytes stored in the
* buffer (via a call to the \ref RingBuffer_GetCount() function) in a temporary variable
* to reduce the time spent in atomicity locks.
*
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
*/
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
}
/** Inserts an element into the ring buffer.
*
* \note Only one execution thread (main program thread or an ISR) may insert into a single buffer
* otherwise data corruption may occur. Insertion and removal may occur from different execution
* threads.
*
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
* \param[in] Data Data element to insert into the buffer
*/
static inline void RingBuffer_Insert(RingBuff_t* const Buffer,
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Buffer->Count++;
}
}
/** Removes an element from the ring buffer.
*
* \note Only one execution thread (main program thread or an ISR) may remove from a single buffer
* otherwise data corruption may occur. Insertion and removal may occur from different execution
* threads.
*
* \param[in,out] Buffer Pointer to a ring buffer structure to retrieve from
*
* \return Next data element stored in the buffer
*/
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Buffer->Count--;
}
return Data;
}
#endif
| {
"pile_set_name": "Github"
} |
# Several scripts pull information from Galaxy's standard configuration
# file. The post-processing scripts use the following variables.
[app:main]
enable_api = True
library_import_dir = /source/galaxy/upload
[galaxy_amqp]
host = rabbitmq.host.machine
port = 5672
userid = rabbitmq_user
password = rabbitmq_passwd
virtual_host = galaxy_messaging_engine
queue = galaxy_queue
exchange = galaxy_exchange
routing_key = bar_code_scanner
| {
"pile_set_name": "Github"
} |
/**
* Provides a library of known unsafe deserializers.
* See https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-Json-Attacks.pdf.
*/
import csharp
/** An unsafe deserializer. */
abstract class UnsafeDeserializer extends Callable { }
/** An unsafe deserializer method in the `System.*` namespace. */
class SystemDeserializer extends UnsafeDeserializer {
SystemDeserializer() {
this
.hasQualifiedName("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter",
"Deserialize")
or
this
.hasQualifiedName("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter",
"UnsafeDeserialize")
or
this
.hasQualifiedName("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter",
"UnsafeDeserializeMethodResponse")
or
this
.hasQualifiedName("System.Runtime.Deserialization.Formatters.Soap.SoapFormatter",
"Deserialize")
or
this.hasQualifiedName("System.Web.UI.ObjectStateFormatter", "Deserialize")
or
this.hasQualifiedName("System.Runtime.Serialization.NetDataContractSerializer", "Deserialize")
or
this.hasQualifiedName("System.Runtime.Serialization.NetDataContractSerializer", "ReadObject")
or
this.hasQualifiedName("System.Web.UI.LosFormatter", "Deserialize")
or
this.hasQualifiedName("System.Workflow.ComponentModel.Activity", "Load")
or
this.hasQualifiedName("System.Resources.ResourceReader", "ResourceReader")
or
this.hasQualifiedName("System.Messaging", "BinaryMessageFormatter")
or
this.hasQualifiedName("System.Windows.Markup.XamlReader", "Parse")
or
this.hasQualifiedName("System.Windows.Markup.XamlReader", "Load")
or
this.hasQualifiedName("System.Windows.Markup.XamlReader", "LoadAsync")
}
}
/** An unsafe deserializer method in the `Microsoft.*` namespace. */
class MicrosoftDeserializer extends UnsafeDeserializer {
MicrosoftDeserializer() {
this.hasQualifiedName("Microsoft.Web.Design.Remote.ProxyObject", "DecodeValue")
}
}
/**
* An unsafe deserializer method that calls any unsafe deserializer on any of
* the parameters.
*/
class WrapperDeserializer extends UnsafeDeserializer {
WrapperDeserializer() {
exists(Call call |
call.getEnclosingCallable() = this and
call.getAnArgument() instanceof ParameterAccess and
call.getTarget() instanceof UnsafeDeserializer
)
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env wish
# http://wiki.tcl.tk/14140
proc stars'go {c factor} {
set w [winfo width $c]
set h [winfo height $c]
$c scale all [expr {$w/2}] [expr {$h/2}] $factor $factor
foreach item [$c find all] {
if {[llength [$c bbox $item]] == 0} {$c delete $item; continue} ;# (1)
foreach {x0 y0 x1 y1} [$c bbox $item] break
if {$x1<0 || $x0>$w || $y1<0 || $y0>$h} {$c delete $item}
}
time {
set x [expr {rand()*$w}]
set y [expr {rand()*$h}]
set col [lpick {white yellow beige bisque cyan}]
$c create oval $x $y [expr {$x+1}] [expr {$y+1}] -fill $col \
-outline $col
} 10
after $::ms [info level 0]
}
proc lpick list {lindex $list [expr {int(rand()*[llength $list])}]}
#-- Let's go!
pack [canvas .c -bg black] -fill both -expand 1
set ms 40
bind . <Up> {incr ms -5}
bind . <Down> {incr ms 5}
stars'go .c 1.05
| {
"pile_set_name": "Github"
} |
A tuple struct or tuple variant was used in a pattern as if it were a struct or
struct variant.
Erroneous code example:
```compile_fail,E0769
enum E {
A(i32),
}
let e = E::A(42);
match e {
E::A { number } => { // error!
println!("{}", number);
}
}
```
To fix this error, you can use the tuple pattern:
```
# enum E {
# A(i32),
# }
# let e = E::A(42);
match e {
E::A(number) => { // ok!
println!("{}", number);
}
}
```
Alternatively, you can also use the struct pattern by using the correct field
names and binding them to new identifiers:
```
# enum E {
# A(i32),
# }
# let e = E::A(42);
match e {
E::A { 0: number } => { // ok!
println!("{}", number);
}
}
```
| {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser.
*/
@protocol CRKKeyedDataStoreProtocol <NSObject>
@required
- (NSData *)dataForKey:(NSString *)arg1 error:(id*)arg2;
- (bool)removeDataForKey:(NSString *)arg1 error:(id*)arg2;
- (bool)setData:(NSData *)arg1 forKey:(NSString *)arg2 error:(id*)arg3;
@end
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<DelphiColorizerTheme modified="2014-06-03 17:39:02" author="Delphi IDE Theme Colorizer" versionapp="1.0.0.0">
<ColorMap>
<BtnFrameColor>$00CEB25D</BtnFrameColor>
<BtnSelectedColor>$0062F0FF</BtnSelectedColor>
<BtnSelectedFont>clBlack</BtnSelectedFont>
<Color>$00E6D8AD</Color>
<DisabledColor>clSilver</DisabledColor>
<DisabledFontColor>clGrayText</DisabledFontColor>
<DisabledFontShadow>clBtnHighlight</DisabledFontShadow>
<FontColor>clBlack</FontColor>
<FrameBottomRightInner>$00CEB25D</FrameBottomRightInner>
<FrameBottomRightOuter>$00CEB25D</FrameBottomRightOuter>
<FrameTopLeftInner>$00CEB25D</FrameTopLeftInner>
<FrameTopLeftOuter>$00CEB25D</FrameTopLeftOuter>
<HighlightColor>$0062F0FF</HighlightColor>
<HotColor>$0062F0FF</HotColor>
<HotFontColor>clDefault</HotFontColor>
<MenuColor>$00F0E8CE</MenuColor>
<SelectedColor>$0062F0FF</SelectedColor>
<SelectedFontColor>clBlack</SelectedFontColor>
<ShadowColor>$00CEB25D</ShadowColor>
<UnusedColor>clWhite</UnusedColor>
</ColorMap>
</DelphiColorizerTheme>
| {
"pile_set_name": "Github"
} |
require('../../modules/es6.symbol');
require('../../modules/es6.object.assign');
require('../../modules/es6.object.is');
require('../../modules/es6.object.set-prototype-of');
require('../../modules/es6.object.to-string');
require('../../modules/es6.object.freeze');
require('../../modules/es6.object.seal');
require('../../modules/es6.object.prevent-extensions');
require('../../modules/es6.object.is-frozen');
require('../../modules/es6.object.is-sealed');
require('../../modules/es6.object.is-extensible');
require('../../modules/es6.object.get-own-property-descriptor');
require('../../modules/es6.object.get-prototype-of');
require('../../modules/es6.object.keys');
require('../../modules/es6.object.get-own-property-names');
require('../../modules/es7.object.get-own-property-descriptors');
require('../../modules/es7.object.values');
require('../../modules/es7.object.entries');
require('../../modules/core.object.is-object');
require('../../modules/core.object.classof');
require('../../modules/core.object.define');
require('../../modules/core.object.make');
module.exports = require('../../modules/$.core').Object; | {
"pile_set_name": "Github"
} |
package me.libraryaddict.disguise.utilities.params;
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
import me.libraryaddict.disguise.utilities.translations.TranslateType;
import java.util.*;
/**
* Created by libraryaddict on 7/09/2018.
*/
public abstract class ParamInfo {
private Class paramClass;
private String descriptiveName;
private String name;
private Map<String, Object> possibleValues;
/**
* Used for translations, namely ItemStack and it's 'Glowing' and 'null' counterparts
*/
private String[] otherValues;
private String description;
public ParamInfo(Class paramClass, String name, String description) {
this(paramClass, name, name, description);
}
public ParamInfo(Class paramClass, String name, String descriptiveName, String description) {
this.name = name;
this.paramClass = paramClass;
this.descriptiveName = descriptiveName;
this.description = description;
}
public ParamInfo(Class paramClass, String name, String description, Enum[] possibleValues) {
this(paramClass, name, name, description, possibleValues);
}
public ParamInfo(Class paramClass, String name, String descriptiveName, String description, Enum[] possibleValues) {
this(paramClass, name, descriptiveName, description);
this.possibleValues = new LinkedHashMap<>();
for (Enum anEnum : possibleValues) {
this.getValues().put(anEnum.name(), anEnum);
}
}
public ParamInfo(Class paramClass, String name, String description, Map<String, Object> possibleValues) {
this(paramClass, name, name, description, possibleValues);
}
public ParamInfo(Class paramClass, String name, String descriptiveName, String description,
Map<String, Object> possibleValues) {
this(paramClass, name, descriptiveName, description);
this.possibleValues = new LinkedHashMap<>();
this.possibleValues.putAll(possibleValues);
}
public boolean canTranslateValues() {
return getValues() != null;
}
public String[] getOtherValues() {
return this.otherValues;
}
public void setOtherValues(String... otherValues) {
if (this.otherValues != null) {
this.otherValues = Arrays.copyOf(this.otherValues, this.otherValues.length + otherValues.length);
for (int i = 0; i < otherValues.length; i++) {
this.otherValues[this.otherValues.length - (otherValues.length - i)] = otherValues[i];
}
} else {
this.otherValues = otherValues;
}
}
public boolean canReturnNull() {
return false;
}
protected abstract Object fromString(String string) throws DisguiseParseException;
public abstract String toString(Object object);
public Object fromString(List<String> arguments) throws DisguiseParseException {
// Don't consume a string immediately, if it errors we need to check other param types
String string = arguments.get(0);
Object value = fromString(string);
// Throw error if null wasn't expected
if (value == null && !canReturnNull()) {
throw new IllegalArgumentException();
}
arguments.remove(0);
return value;
}
public int getMinArguments() {
return 1;
}
public boolean hasValues() {
return getValues() != null;
}
protected Class getParamClass() {
return paramClass;
}
public boolean isParam(Class paramClass) {
return getParamClass() == paramClass;
}
public String getName() {
return TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(getRawName());
}
public String getDescriptiveName() {
return TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(getRawDescriptiveName());
}
public String getRawName() {
return this.name;
}
public String getRawDescriptiveName() {
return descriptiveName;
}
public String getDescription() {
return TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(getRawDescription());
}
public String getRawDescription() {
return description;
}
public Map<String, Object> getValues() {
return this.possibleValues;
}
public Set<String> getEnums(String tabComplete) {
if (getOtherValues() != null) {
HashSet<String> set = new HashSet<>(getValues().keySet());
set.addAll(Arrays.asList(getOtherValues()));
return set;
}
return getValues().keySet();
}
/**
* Is the values it returns all it can do?
*/
public boolean isCustomValues() {
return true;
}
}
| {
"pile_set_name": "Github"
} |
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 7a394794b02666f42a5716da06e2b3d0
timeCreated: 1468691258
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
// boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
// Copyright 2009-2011 Vicente J. Botet Escriba
// Copyright (c) Microsoft Corporation 2014
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/system for documentation.
#ifndef BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
#define BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
#include <boost/chrono/config.hpp>
#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/operators.hpp>
#include <boost/chrono/detail/system.hpp>
#include <iostream>
#include <boost/type_traits/common_type.hpp>
#include <boost/chrono/clock_string.hpp>
#ifndef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_prefix.hpp> // must be the last #include
#endif
namespace boost { namespace chrono {
class BOOST_CHRONO_DECL process_real_cpu_clock {
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<process_real_cpu_clock> time_point;
BOOST_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
};
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
class BOOST_CHRONO_DECL process_user_cpu_clock {
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<process_user_cpu_clock> time_point;
BOOST_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
};
class BOOST_CHRONO_DECL process_system_cpu_clock {
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<process_system_cpu_clock> time_point;
BOOST_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
};
#endif
template <typename Rep>
struct process_times
: arithmetic<process_times<Rep>,
multiplicative<process_times<Rep>, Rep,
less_than_comparable<process_times<Rep> > > >
{
//typedef process_real_cpu_clock::rep rep;
typedef Rep rep;
process_times()
: real(0)
, user(0)
, system(0){}
#if ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
template <typename Rep2>
explicit process_times(
Rep2 r)
: real(r)
, user(r)
, system(r){}
#endif
template <typename Rep2>
explicit process_times(
process_times<Rep2> const& rhs)
: real(rhs.real)
, user(rhs.user)
, system(rhs.system){}
process_times(
rep r,
rep u,
rep s)
: real(r)
, user(u)
, system(s){}
rep real; // real (i.e wall clock) time
rep user; // user cpu time
rep system; // system cpu time
#if ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
operator rep() const
{
return real;
}
#endif
template <typename Rep2>
bool operator==(process_times<Rep2> const& rhs) {
return (real==rhs.real &&
user==rhs.user &&
system==rhs.system);
}
process_times& operator+=(
process_times const& rhs)
{
real+=rhs.real;
user+=rhs.user;
system+=rhs.system;
return *this;
}
process_times& operator-=(
process_times const& rhs)
{
real-=rhs.real;
user-=rhs.user;
system-=rhs.system;
return *this;
}
process_times& operator*=(
process_times const& rhs)
{
real*=rhs.real;
user*=rhs.user;
system*=rhs.system;
return *this;
}
process_times& operator*=(rep const& rhs)
{
real*=rhs;
user*=rhs;
system*=rhs;
return *this;
}
process_times& operator/=(process_times const& rhs)
{
real/=rhs.real;
user/=rhs.user;
system/=rhs.system;
return *this;
}
process_times& operator/=(rep const& rhs)
{
real/=rhs;
user/=rhs;
system/=rhs;
return *this;
}
bool operator<(process_times const & rhs) const
{
if (real < rhs.real) return true;
if (real > rhs.real) return false;
if (user < rhs.user) return true;
if (user > rhs.user) return false;
if (system < rhs.system) return true;
else return false;
}
template <class CharT, class Traits>
void print(std::basic_ostream<CharT, Traits>& os) const
{
os << "{"<< real <<";"<< user <<";"<< system << "}";
}
template <class CharT, class Traits>
void read(std::basic_istream<CharT, Traits>& is)
{
typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
in_iterator i(is);
in_iterator e;
if (i == e || *i++ != '{') // mandatory '{'
{
is.setstate(is.failbit | is.eofbit);
return;
}
CharT x,y,z;
is >> real >> x >> user >> y >> system >> z;
if (!is.good() || (x != ';')|| (y != ';')|| (z != '}'))
{
is.setstate(is.failbit);
}
}
};
}
template <class Rep1, class Rep2>
struct common_type<
chrono::process_times<Rep1>,
chrono::process_times<Rep2>
>
{
typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
};
template <class Rep1, class Rep2>
struct common_type<
chrono::process_times<Rep1>,
Rep2
>
{
typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
};
template <class Rep1, class Rep2>
struct common_type<
Rep1,
chrono::process_times<Rep2>
>
{
typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
};
namespace chrono
{
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator==(const duration<process_times<Rep1>, Period1>& lhs,
const duration<process_times<Rep2>, Period2>& rhs)
{
return boost::chrono::detail::duration_eq<
duration<Rep1, Period1>, duration<Rep2, Period2>
>()(duration<Rep1, Period1>(lhs.count().real), duration<Rep2, Period2>(rhs.count().real));
}
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator==(const duration<process_times<Rep1>, Period1>& lhs,
const duration<Rep2, Period2>& rhs)
{
return boost::chrono::detail::duration_eq<
duration<Rep1, Period1>, duration<Rep2, Period2> >()(duration<Rep1, Period1>(lhs.count().real), rhs);
}
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator==(const duration<Rep1, Period1>& lhs,
const duration<process_times<Rep2>, Period2>& rhs)
{
return rhs == lhs;
}
// Duration <
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator< (const duration<process_times<Rep1>, Period1>& lhs,
const duration<Rep2, Period2>& rhs)
{
return boost::chrono::detail::duration_lt<
duration<Rep1, Period1>, duration<Rep2, Period2> >()(duration<Rep1, Period1>(lhs.count().real), rhs);
}
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator< (const duration<Rep1, Period1>& lhs,
const duration<process_times<Rep2>, Period2>& rhs)
{
return boost::chrono::detail::duration_lt<
duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, duration<Rep2, Period2>(rhs.count().real));
}
template <class Rep1, class Period1, class Rep2, class Period2>
inline BOOST_CONSTEXPR
bool
operator< (const duration<process_times<Rep1>, Period1>& lhs,
const duration<process_times<Rep2>, Period2>& rhs)
{
return boost::chrono::detail::duration_lt<
duration<Rep1, Period1>, duration<Rep2, Period2>
>()(duration<Rep1, Period1>(lhs.count().real), duration<Rep2, Period2>(rhs.count().real));
}
typedef process_times<nanoseconds::rep> process_cpu_clock_times;
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
class BOOST_CHRONO_DECL process_cpu_clock
{
public:
typedef process_cpu_clock_times times;
typedef boost::chrono::duration<times, nano> duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<process_cpu_clock> time_point;
BOOST_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
#endif
};
#endif
template <class CharT, class Traits, typename Rep>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
process_times<Rep> const& rhs)
{
rhs.print(os);
return os;
}
template <class CharT, class Traits, typename Rep>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is,
process_times<Rep>& rhs)
{
rhs.read(is);
return is;
}
template <typename Rep>
struct duration_values<process_times<Rep> >
{
typedef process_times<Rep> Res;
public:
static Res zero()
{
return Res();
}
static Res max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return Res((std::numeric_limits<Rep>::max)(),
(std::numeric_limits<Rep>::max)(),
(std::numeric_limits<Rep>::max)());
}
static Res min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return Res((std::numeric_limits<Rep>::min)(),
(std::numeric_limits<Rep>::min)(),
(std::numeric_limits<Rep>::min)());
}
};
template<class CharT>
struct clock_string<process_real_cpu_clock, CharT>
{
static std::basic_string<CharT> name()
{
static const CharT
u[] =
{ 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l', '_', 'c', 'l', 'o', 'c', 'k' };
static const std::basic_string<CharT> str(u, u + sizeof(u)
/ sizeof(u[0]));
return str;
}
static std::basic_string<CharT> since()
{
const CharT
u[] =
{ ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
return str;
}
};
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
template<class CharT>
struct clock_string<process_user_cpu_clock, CharT>
{
static std::basic_string<CharT> name()
{
static const CharT
u[] =
{ 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r', '_', 'c', 'l', 'o', 'c', 'k' };
static const std::basic_string<CharT> str(u, u + sizeof(u)
/ sizeof(u[0]));
return str;
}
static std::basic_string<CharT> since()
{
const CharT
u[] =
{ ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
return str;
}
};
template<class CharT>
struct clock_string<process_system_cpu_clock, CharT>
{
static std::basic_string<CharT> name()
{
static const CharT
u[] =
{ 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
static const std::basic_string<CharT> str(u, u + sizeof(u)
/ sizeof(u[0]));
return str;
}
static std::basic_string<CharT> since()
{
const CharT
u[] =
{ ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
return str;
}
};
template<class CharT>
struct clock_string<process_cpu_clock, CharT>
{
static std::basic_string<CharT> name()
{
static const CharT u[] =
{ 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'c', 'l', 'o', 'c', 'k' };
static const std::basic_string<CharT> str(u, u + sizeof(u)
/ sizeof(u[0]));
return str;
}
static std::basic_string<CharT> since()
{
const CharT
u[] =
{ ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
return str;
}
};
#endif
} // namespace chrono
} // namespace boost
namespace std {
template <typename Rep>
struct numeric_limits<boost::chrono::process_times<Rep> >
{
typedef boost::chrono::process_times<Rep> Res;
public:
static const bool is_specialized = true;
static Res min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return Res((std::numeric_limits<Rep>::min)(),
(std::numeric_limits<Rep>::min)(),
(std::numeric_limits<Rep>::min)());
}
static Res max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return Res((std::numeric_limits<Rep>::max)(),
(std::numeric_limits<Rep>::max)(),
(std::numeric_limits<Rep>::max)());
}
static Res lowest() throw()
{
return (min)();
}
static const int digits = std::numeric_limits<Rep>::digits+
std::numeric_limits<Rep>::digits+
std::numeric_limits<Rep>::digits;
static const int digits10 = std::numeric_limits<Rep>::digits10+
std::numeric_limits<Rep>::digits10+
std::numeric_limits<Rep>::digits10;
static const bool is_signed = Rep::is_signed;
static const bool is_integer = Rep::is_integer;
static const bool is_exact = Rep::is_exact;
static const int radix = 0;
//~ static Res epsilon() throw() { return 0; }
//~ static Res round_error() throw() { return 0; }
//~ static const int min_exponent = 0;
//~ static const int min_exponent10 = 0;
//~ static const int max_exponent = 0;
//~ static const int max_exponent10 = 0;
//~ static const bool has_infinity = false;
//~ static const bool has_quiet_NaN = false;
//~ static const bool has_signaling_NaN = false;
//~ static const float_denorm_style has_denorm = denorm_absent;
//~ static const bool has_denorm_loss = false;
//~ static Res infinity() throw() { return 0; }
//~ static Res quiet_NaN() throw() { return 0; }
//~ static Res signaling_NaN() throw() { return 0; }
//~ static Res denorm_min() throw() { return 0; }
//~ static const bool is_iec559 = false;
//~ static const bool is_bounded = true;
//~ static const bool is_modulo = false;
//~ static const bool traps = false;
//~ static const bool tinyness_before = false;
//~ static const float_round_style round_style = round_toward_zero;
};
}
#ifndef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
#else
#include <boost/chrono/detail/inlined/process_cpu_clocks.hpp>
#endif
#endif
#endif // BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
| {
"pile_set_name": "Github"
} |
<?php
define('MODULE_PAYMENT_VIVAWALLET_TEXT_TITLE', 'Vivawallet - πιστωτική κάρτα');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_DESCRIPTION', 'Με πιστωτική κάρτα Vivawallet');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_TYPE', 'Type:');
define('MODULE_PAYMENT_VIVAWALLET_CARD_TYPE', 'Credit Card Type:');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_CREDIT_CARD_NUMBER', 'Credit Card Number:');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_CREDIT_CARD_EXPIRES', 'Credit Card Expiry Date:');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_JS_CC_OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' characters.\n');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_JS_CC_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_ERROR_MESSAGE', 'There has been an error processing your credit card. Please try again.');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_DECLINED_MESSAGE', 'Your credit card was declined. Please try another card or contact your bank for more info.');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_ERROR', 'Credit Card Error!');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_ERROR_CARDTYPE', 'No card was selected.');
define('MODULE_PAYMENT_VIVAWALLET_TEXT_ERROR_GENERAL', 'Your transaction is not approved and the transaction was not completed. Please try again or use another credit card.');
define('MODULE_PAYMENT_VIVAWALLET_NOINSTAL', 'Χωρίς Δόσεις');
define('MODULE_PAYMENT_VIVAWALLET_INSTALMENTS', 'Άτοκες Μηνιαίες Δόσεις:');
define('MODULE_PAYMENT_VIVAWALLET_TEXT', 'δόσεις');
define('MODULE_PAYMENT_VIVAWALLET_INFO', '');
define('MODULE_PAYMENT_VIVAWALLET_WARNING', '<br><br><strong><font color="#ff0000">ΠΡΟΣΟΧΗ:</font></strong> Αφού πατήσετε το "Επιβεβαίωση πληρωμής" θα κατευθυνθείτε στο ασφαλές περιβάλλον της Vivawallet για να ολοκληρώσετε την πληρωμή σας. <b>Μετά την πληρωμή, πατήστε ΝΑΙ στο αναδυόμενο παράθυρο που θα σας εμφανιστεί για να επιστρέψετε στο ηλεκτρονικό μας κατάστημα.');
?>
| {
"pile_set_name": "Github"
} |
package me.ykrank.s1next.data.api.model.wrapper;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import me.ykrank.s1next.data.api.model.Account;
@SuppressWarnings("UnusedDeclaration")
@JsonIgnoreProperties(ignoreUnknown = true)
public class BaseDataWrapper<T extends Account> extends OriginWrapper<T> {
}
| {
"pile_set_name": "Github"
} |
package io.github.resilience4j.reactor;
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.bulkhead.BulkheadConfig;
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
import io.github.resilience4j.ratelimiter.RateLimiter;
import io.github.resilience4j.ratelimiter.RateLimiterConfig;
import io.github.resilience4j.reactor.bulkhead.operator.BulkheadOperator;
import io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerOperator;
import io.github.resilience4j.reactor.ratelimiter.operator.RateLimiterOperator;
import io.github.resilience4j.reactor.retry.RetryOperator;
import io.github.resilience4j.retry.Retry;
import io.github.resilience4j.retry.RetryConfig;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import java.io.IOException;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
public class CombinedOperatorsTest {
private final RateLimiter rateLimiter = RateLimiter.of("test",
RateLimiterConfig.custom().limitForPeriod(5).timeoutDuration(Duration.ZERO)
.limitRefreshPeriod(Duration.ofSeconds(10)).build());
private final CircuitBreaker circuitBreaker = CircuitBreaker.of("test",
CircuitBreakerConfig.custom()
.waitDurationInOpenState(Duration.of(10, ChronoUnit.SECONDS))
.slidingWindowSize(4)
.permittedNumberOfCallsInHalfOpenState(4)
.build());
private final RetryConfig config = io.github.resilience4j.retry.RetryConfig.ofDefaults();
private final Retry retry = Retry.of("testName", config);
private final RetryOperator<String> retryOperator = RetryOperator.of(retry);
private Bulkhead bulkhead = Bulkhead
.of("test",
BulkheadConfig.custom().maxConcurrentCalls(1).maxWaitDuration(Duration.ZERO).build());
@Test
public void shouldEmitEvents() {
StepVerifier.create(
Flux.just("Event 1", "Event 2")
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
).expectNext("Event 1")
.expectNext("Event 2")
.verifyComplete();
}
@Test
public void shouldEmitEventsWithRetry() {
StepVerifier.create(
Flux.just("Event 1", "Event 2")
.transformDeferred(retryOperator)
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
).expectNext("Event 1")
.expectNext("Event 2")
.verifyComplete();
}
@Test
public void shouldEmitEvent() {
StepVerifier.create(
Mono.just("Event 1")
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
).expectNext("Event 1")
.verifyComplete();
}
@Test
public void shouldEmitEventWithRetry() {
StepVerifier.create(
Mono.just("Event 1")
.transformDeferred(retryOperator)
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
).expectNext("Event 1")
.verifyComplete();
}
@Test
public void shouldPropagateError() {
StepVerifier.create(
Flux.error(new IOException("BAM!"))
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
).expectError(IOException.class)
.verify(Duration.ofSeconds(1));
}
@Test
public void shouldEmitErrorWithCircuitBreakerOpenExceptionEvenWhenErrorDuringSubscribe() {
circuitBreaker.transitionToOpenState();
StepVerifier.create(
Flux.error(new IOException("BAM!"))
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
).expectError(CallNotPermittedException.class)
.verify(Duration.ofSeconds(1));
}
@Test
public void shouldEmitErrorWithCircuitBreakerOpenExceptionEvenWhenErrorNotOnSubscribe() {
circuitBreaker.transitionToOpenState();
StepVerifier.create(
Flux.error(new IOException("BAM!"), true)
.transformDeferred(CircuitBreakerOperator.of(circuitBreaker))
.transformDeferred(BulkheadOperator.of(bulkhead))
.transformDeferred(RateLimiterOperator.of(rateLimiter))
).expectError(CallNotPermittedException.class)
.verify(Duration.ofSeconds(1));
}
}
| {
"pile_set_name": "Github"
} |
package geo_test
import (
"context"
"strings"
"testing"
_ "github.com/influxdata/flux/builtin"
"github.com/influxdata/flux/querytest"
"github.com/influxdata/flux/stdlib/experimental/geo"
"github.com/influxdata/flux/values"
)
func TestS2CellIDToken_NewQuery(t *testing.T) {
tests := []querytest.NewQueryTestCase{
{
Name: "no args",
Raw: `import "experimental/geo" geo.s2CellIDToken()`,
WantErr: true, // missing required parameter(s)
},
{
Name: "too few args",
Raw: `import "experimental/geo" geo.s2CellIDToken(token: "89c284")`,
WantErr: true, // missing required parameter(s)
},
}
for _, tc := range tests {
tc := tc
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
querytest.NewQueryTestHelper(t, tc)
})
}
}
func TestS2CellIDToken_Process(t *testing.T) {
type point struct {
lat float64
lon float64
}
testCases := []struct {
name string
token string
point *point
level int64
want string
wantErr bool
errSubstring string
}{
{
name: "parent level 7 for token",
token: "89c284", // level 9
level: 7,
want: "89c2c",
},
{
name: "parent level 7 for lat/lon",
point: &point{40.808978, -73.558041},
level: 7,
want: "89c2c",
},
{
name: "wrong level",
token: "89c284", // level 9
level: 11, // cannot request higher level than source token
wantErr: true,
errSubstring: "requested level greater then current level",
},
{
name: "invalid level",
token: "89c284", // level 9
level: 0,
wantErr: true,
errSubstring: "level value must be [1, 30]",
},
{
name: "invalid token",
token: "%*^&(*^*%&$",
level: 7,
wantErr: true,
errSubstring: "invalid token specified",
},
}
for _, tc := range testCases {
tc := tc
s2CellIDToken := geo.Functions["s2CellIDToken"]
var owv values.Object
if tc.token != "" {
owv = values.NewObjectWithValues(map[string]values.Value{
"token": values.NewString(tc.token),
"level": values.NewInt(tc.level),
})
} else if tc.point != nil {
owv = values.NewObjectWithValues(map[string]values.Value{
"point": values.NewObjectWithValues(map[string]values.Value{
"lat": values.NewFloat(tc.point.lat),
"lon": values.NewFloat(tc.point.lon),
}),
"level": values.NewInt(tc.level),
})
}
result, err := s2CellIDToken.Call(context.Background(), owv)
if err != nil {
if !tc.wantErr {
t.Error(err.Error())
}
if tc.errSubstring != "" && !strings.Contains(err.Error(), tc.errSubstring) {
t.Errorf("[%s] expected error with '%s', got '%v'", tc.name, tc.errSubstring, err)
}
} else if tc.want != result.Str() {
t.Errorf("[%s] expected %v (%T), got %v (%T)", tc.name, tc.want, tc.want, result, result)
}
}
}
| {
"pile_set_name": "Github"
} |
using System;
using Smobiler.Core;
namespace SMOWMS.UI.Layout
{
partial class frmConSalesResultLayout : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
public frmConSalesResultLayout()
: base()
{
//This call is required by the SmobilerUserControl.
InitializeComponent();
//Add any initialization after the InitializeComponent() call
}
//SmobilerUserControl overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.plRow = new Smobiler.Core.Controls.Panel();
this.image1 = new Smobiler.Core.Controls.Image();
this.label1 = new Smobiler.Core.Controls.Label();
this.label3 = new Smobiler.Core.Controls.Label();
this.label4 = new Smobiler.Core.Controls.Label();
this.label17 = new Smobiler.Core.Controls.Label();
this.label7 = new Smobiler.Core.Controls.Label();
this.label8 = new Smobiler.Core.Controls.Label();
this.lblQuantStored = new Smobiler.Core.Controls.Label();
this.lblQuantRetreated = new Smobiler.Core.Controls.Label();
this.label13 = new Smobiler.Core.Controls.Label();
this.label14 = new Smobiler.Core.Controls.Label();
this.lblQuantPurchased = new Smobiler.Core.Controls.Label();
this.lblRealPrice = new Smobiler.Core.Controls.Label();
//
// plRow
//
this.plRow.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.image1,
this.label1,
this.label3,
this.label4,
this.label17,
this.label7,
this.label8,
this.lblQuantStored,
this.lblQuantRetreated,
this.label13,
this.label14,
this.lblQuantPurchased,
this.lblRealPrice});
this.plRow.Name = "plRow";
this.plRow.Size = new System.Drawing.Size(300, 150);
//
// image1
//
this.image1.DataMember = "Image";
this.image1.DisplayMember = "Image";
this.image1.Location = new System.Drawing.Point(6, 8);
this.image1.Name = "image1";
this.image1.Size = new System.Drawing.Size(45, 45);
//
// label1
//
this.label1.DataMember = "Name";
this.label1.DisplayMember = "Name";
this.label1.Location = new System.Drawing.Point(108, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 30);
this.label1.Text = "label1";
//
// label3
//
this.label3.Location = new System.Drawing.Point(6, 55);
this.label3.Name = "label3";
this.label3.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label3.Size = new System.Drawing.Size(100, 30);
this.label3.Text = "耗材编号";
//
// label4
//
this.label4.DataMember = "CID";
this.label4.DisplayMember = "CID";
this.label4.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.label4.Location = new System.Drawing.Point(106, 55);
this.label4.Name = "label4";
this.label4.Padding = new Smobiler.Core.Controls.Padding(0F, 0F, 10F, 0F);
this.label4.Size = new System.Drawing.Size(186, 30);
//
// label17
//
this.label17.Location = new System.Drawing.Point(51, 18);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(57, 30);
this.label17.Text = "耗材名称";
//
// label7
//
this.label7.Location = new System.Drawing.Point(149, 85);
this.label7.Name = "label7";
this.label7.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label7.Size = new System.Drawing.Size(70, 30);
this.label7.Text = "出库数量";
//
// label8
//
this.label8.Location = new System.Drawing.Point(149, 115);
this.label8.Name = "label8";
this.label8.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label8.Size = new System.Drawing.Size(70, 30);
this.label8.Text = "退库数量";
//
// lblQuantStored
//
this.lblQuantStored.DisplayMember = "QUANTOUT";
this.lblQuantStored.ForeColor = System.Drawing.Color.DodgerBlue;
this.lblQuantStored.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.lblQuantStored.Location = new System.Drawing.Point(219, 85);
this.lblQuantStored.Name = "lblQuantStored";
this.lblQuantStored.Padding = new Smobiler.Core.Controls.Padding(0F, 0F, 10F, 0F);
this.lblQuantStored.Size = new System.Drawing.Size(73, 30);
//
// lblQuantRetreated
//
this.lblQuantRetreated.DisplayMember = "QUANTRETREATED";
this.lblQuantRetreated.ForeColor = System.Drawing.Color.Red;
this.lblQuantRetreated.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.lblQuantRetreated.Location = new System.Drawing.Point(219, 115);
this.lblQuantRetreated.Name = "lblQuantRetreated";
this.lblQuantRetreated.Padding = new Smobiler.Core.Controls.Padding(0F, 0F, 10F, 0F);
this.lblQuantRetreated.Size = new System.Drawing.Size(73, 30);
//
// label13
//
this.label13.Location = new System.Drawing.Point(6, 85);
this.label13.Name = "label13";
this.label13.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label13.Size = new System.Drawing.Size(70, 30);
this.label13.Text = "实售数量";
//
// label14
//
this.label14.Location = new System.Drawing.Point(6, 115);
this.label14.Name = "label14";
this.label14.Padding = new Smobiler.Core.Controls.Padding(5F, 0F, 0F, 0F);
this.label14.Size = new System.Drawing.Size(70, 30);
this.label14.Text = "实售单价";
//
// lblQuantPurchased
//
this.lblQuantPurchased.DisplayMember = "QUANTSALED";
this.lblQuantPurchased.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.lblQuantPurchased.Location = new System.Drawing.Point(76, 85);
this.lblQuantPurchased.Name = "lblQuantPurchased";
this.lblQuantPurchased.Padding = new Smobiler.Core.Controls.Padding(0F, 0F, 10F, 0F);
this.lblQuantPurchased.Size = new System.Drawing.Size(73, 30);
//
// lblRealPrice
//
this.lblRealPrice.DisplayMember = "REALPRICE";
this.lblRealPrice.HorizontalAlignment = Smobiler.Core.Controls.HorizontalAlignment.Right;
this.lblRealPrice.Location = new System.Drawing.Point(76, 115);
this.lblRealPrice.Name = "lblRealPrice";
this.lblRealPrice.Padding = new Smobiler.Core.Controls.Padding(0F, 0F, 10F, 0F);
this.lblRealPrice.Size = new System.Drawing.Size(73, 30);
//
// frmConSalesResultLayout
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.plRow});
this.Size = new System.Drawing.Size(300, 150);
this.Name = "frmConSalesResultLayout";
}
#endregion
private Smobiler.Core.Controls.Panel plRow;
private Smobiler.Core.Controls.Image image1;
private Smobiler.Core.Controls.Label label1;
private Smobiler.Core.Controls.Label label3;
private Smobiler.Core.Controls.Label label4;
private Smobiler.Core.Controls.Label label17;
private Smobiler.Core.Controls.Label label7;
private Smobiler.Core.Controls.Label label8;
private Smobiler.Core.Controls.Label lblQuantStored;
private Smobiler.Core.Controls.Label lblQuantRetreated;
private Smobiler.Core.Controls.Label label13;
private Smobiler.Core.Controls.Label label14;
private Smobiler.Core.Controls.Label lblQuantPurchased;
private Smobiler.Core.Controls.Label lblRealPrice;
}
} | {
"pile_set_name": "Github"
} |
@ stdcall KdD0Transition()
@ stdcall KdD3Transition()
@ stdcall KdDebuggerInitialize0(ptr)
@ stdcall KdDebuggerInitialize1(ptr)
@ stdcall KdReceivePacket(long ptr ptr ptr ptr)
@ stdcall KdRestore(long)
@ stdcall KdSave(long)
@ stdcall KdSendPacket(long ptr ptr ptr)
| {
"pile_set_name": "Github"
} |
#! /bin/sh -vx
# $Id: check.test 45809 2017-11-15 00:36:56Z karl $
# Copyright 2017 Karl Berry <[email protected]>
# Copyright 2014, 2015 Peter Breitenlohner <[email protected]>
# You may freely use, modify and/or distribute this file.
tests=omegaware/tests
test -d $tests || mkdir -p $tests
TEXMFCNF=$srcdir/../kpathsea
OFMFONTS=".;./$tests"
export TEXMFCNF OFMFONTS
echo && echo "*** ofm2opl check xcheck"
./wofm2opl $srcdir/$tests/check $tests/xcheck || exit 1
echo && echo "*** diff check.opl xcheck.opl"
diff $srcdir/$tests/check.opl $tests/xcheck.opl || exit 1
echo && echo "*** opl2ofm xcheck xchecked"
./wopl2ofm $tests/xcheck $tests/xchecked || exit 1
echo && echo "*** ofm2opl xchecked stdout (xchecked.opl)"
./wofm2opl $tests/xchecked >$tests/xchecked.opl || exit 1
echo && echo "*** diff checked.opl xchecked.opl"
diff $srcdir/$tests/checked.opl $tests/xchecked.opl || exit 1
| {
"pile_set_name": "Github"
} |
#include "burnint.h"
#include "arm_intf.h"
//#define DEBUG_LOG
#define MAX_MEMORY 0x04000000 // max
#define MAX_MASK 0x03ffffff // max-1
#define PAGE_SIZE 0x00001000 // 400 would be better...
#define PAGE_COUNT (MAX_MEMORY/PAGE_SIZE)
#define PAGE_SHIFT 12 // 0x1000 -> 12 bits
#define PAGE_BYTE_AND 0x00fff // 0x1000 - 1 (byte align)
#define PAGE_LONG_AND 0x00ffc // 0x1000 - 4 (ignore last 4 bytes, long align)
#define READ 0
#define WRITE 1
#define FETCH 2
static UINT8 **membase[3]; // 0 read, 1, write, 2 opcode
static void (*pWriteLongHandler)(UINT32, UINT32 ) = NULL;
static void (*pWriteByteHandler)(UINT32, UINT8 ) = NULL;
static UINT32 (*pReadLongHandler)(UINT32) = NULL;
static UINT8 (*pReadByteHandler)(UINT32) = NULL;
UINT32 ArmSpeedHackAddress;
static void (*pArmSpeedHackCallback)();
extern void arm_set_irq_line(INT32 irqline, INT32 state);
cpu_core_config ArmConfig =
{
ArmOpen,
ArmClose,
ArmReadByte,
Arm_write_rom_byte,
ArmGetActive,
ArmGetTotalCycles,
ArmNewFrame,
ArmRun,
ArmRunEnd,
ArmReset,
0x04000000,
0
};
void ArmSetSpeedHack(UINT32 address, void (*pCallback)())
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetSpeedHack called without init\n"));
#endif
ArmSpeedHackAddress = address;
pArmSpeedHackCallback = pCallback;
}
void ArmOpen(INT32)
{
}
void ArmClose()
{
}
void ArmMapMemory(UINT8 *src, INT32 start, INT32 finish, INT32 type)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmMapMemory called without init\n"));
#endif
UINT32 len = (finish-start) >> PAGE_SHIFT;
for (UINT32 i = 0; i < len+1; i++)
{
UINT32 offset = i + (start >> PAGE_SHIFT);
if (type & (1 << READ)) membase[ READ][offset] = src + (i << PAGE_SHIFT);
if (type & (1 << WRITE)) membase[WRITE][offset] = src + (i << PAGE_SHIFT);
if (type & (1 << FETCH)) membase[FETCH][offset] = src + (i << PAGE_SHIFT);
}
}
void ArmSetWriteByteHandler(void (*write)(UINT32, UINT8))
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetWriteByteHandler called without init\n"));
#endif
pWriteByteHandler = write;
}
void ArmSetWriteLongHandler(void (*write)(UINT32, UINT32))
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetWriteLongHandler called without init\n"));
#endif
pWriteLongHandler = write;
}
void ArmSetReadByteHandler(UINT8 (*read)(UINT32))
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetReadByteHandler called without init\n"));
#endif
pReadByteHandler = read;
}
void ArmSetReadLongHandler(UINT32 (*read)(UINT32))
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetReadLongHandler called without init\n"));
#endif
pReadLongHandler = read;
}
void ArmWriteByte(UINT32 addr, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmWriteByte called without init\n"));
#endif
addr &= MAX_MASK;
#ifdef DEBUG_LOG
bprintf (PRINT_NORMAL, _T("%5.5x, %2.2x wb\n"), addr, data);
#endif
if (membase[WRITE][addr >> PAGE_SHIFT] != NULL) {
membase[WRITE][addr >> PAGE_SHIFT][addr & PAGE_BYTE_AND] = data;
return;
}
if (pWriteByteHandler) {
pWriteByteHandler(addr, data);
}
}
void ArmWriteLong(UINT32 addr, UINT32 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmWriteLong called without init\n"));
#endif
addr &= MAX_MASK;
#ifdef DEBUG_LOG
bprintf (PRINT_NORMAL, _T("%5.5x, %8.8x wd\n"), addr, data);
#endif
if (membase[WRITE][addr >> PAGE_SHIFT] != NULL) {
*((UINT32*)(membase[WRITE][addr >> PAGE_SHIFT] + (addr & PAGE_LONG_AND))) = BURN_ENDIAN_SWAP_INT32(data);
return;
}
if (pWriteLongHandler) {
pWriteLongHandler(addr, data);
}
}
UINT8 ArmReadByte(UINT32 addr)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmReadByte called without init\n"));
#endif
addr &= MAX_MASK;
#ifdef DEBUG_LOG
bprintf (PRINT_NORMAL, _T("%5.5x, rb\n"), addr);
#endif
if (membase[ READ][addr >> PAGE_SHIFT] != NULL) {
return membase[READ][addr >> PAGE_SHIFT][addr & PAGE_BYTE_AND];
}
if (pReadByteHandler) {
return pReadByteHandler(addr);
}
return 0;
}
UINT32 ArmReadLong(UINT32 addr)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmReadLong called without init\n"));
#endif
addr &= MAX_MASK;
#ifdef DEBUG_LOG
bprintf (PRINT_NORMAL, _T("%5.5x, rl\n"), addr);
#endif
if (membase[ READ][addr >> PAGE_SHIFT] != NULL) {
return BURN_ENDIAN_SWAP_INT32(*((UINT32*)(membase[ READ][addr >> PAGE_SHIFT] + (addr & PAGE_LONG_AND))));
}
if (pReadLongHandler) {
return pReadLongHandler(addr);
}
return 0;
}
UINT32 ArmFetchLong(UINT32 addr)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmFetchLong called without init\n"));
#endif
addr &= MAX_MASK;
#ifdef DEBUG_LOG
bprintf (PRINT_NORMAL, _T("%5.5x, rlo\n"), addr);
#endif
#if 1
if (ArmSpeedHackAddress == addr) {
// bprintf (0, _T("speed hack activated! %d cycles killed!\n"), ArmRemainingCycles());
if (pArmSpeedHackCallback) {
pArmSpeedHackCallback();
} else {
ArmRunEnd();
}
}
#else
if (ArmSpeedHackAddress) {
bprintf (0, _T("%x, %d\n"), ArmGetPC(0), ArmRemainingCycles());
ArmRunEnd();
}
#endif
if (membase[FETCH][addr >> PAGE_SHIFT] != NULL) {
return BURN_ENDIAN_SWAP_INT32(*((UINT32*)(membase[FETCH][addr >> PAGE_SHIFT] + (addr & PAGE_LONG_AND))));
}
// good enough for now...
if (pReadLongHandler) {
return pReadLongHandler(addr);
}
return 0;
}
void ArmSetIRQLine(INT32 line, INT32 state)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmSetIRQLine called without init\n"));
#endif
if (state == CPU_IRQSTATUS_NONE || state == CPU_IRQSTATUS_ACK) {
arm_set_irq_line(line, state);
}
else if (CPU_IRQSTATUS_AUTO) {
arm_set_irq_line(line, CPU_IRQSTATUS_ACK);
ArmRun(0);
arm_set_irq_line(line, CPU_IRQSTATUS_NONE);
}
}
// For cheats/etc
void Arm_write_rom_byte(UINT32 addr, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("Arm_write_rom_byte called without init\n"));
#endif
addr &= MAX_MASK;
// write to rom & ram
if (membase[WRITE][addr >> PAGE_SHIFT] != NULL) {
membase[WRITE][addr >> PAGE_SHIFT][addr & PAGE_BYTE_AND] = data;
}
if (membase[READ][addr >> PAGE_SHIFT] != NULL) {
membase[READ][addr >> PAGE_SHIFT][addr & PAGE_BYTE_AND] = data;
}
if (pWriteByteHandler) {
pWriteByteHandler(addr, data);
}
}
INT32 ArmGetActive()
{
return 0; // only one cpu supported
}
void ArmInit(INT32 /*CPU*/) // only one cpu supported
{
DebugCPU_ARMInitted = 1;
for (INT32 i = 0; i < 3; i++) {
membase[i] = (UINT8**)malloc(PAGE_COUNT * sizeof(UINT8**));
memset (membase[i], 0, PAGE_COUNT * sizeof(UINT8**));
}
pWriteLongHandler = NULL;
pWriteByteHandler = NULL;
pReadLongHandler = NULL;
pReadByteHandler = NULL;
CpuCheatRegister(0, &ArmConfig);
pArmSpeedHackCallback = NULL;
ArmSpeedHackAddress = ~0;
}
void ArmExit()
{
#if defined FBA_DEBUG
if (!DebugCPU_ARMInitted) bprintf(PRINT_ERROR, _T("ArmExit called without init\n"));
#endif
if (!DebugCPU_ARMInitted) return;
for (INT32 i = 0; i < 3; i++) {
if (membase[i]) {
free (membase[i]);
membase[i] = NULL;
}
}
DebugCPU_ARMInitted = 0;
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Tue Jul 07 00:34:33 BST 2020 -->
<title>com.facebook.litho.sections.annotations</title>
<meta name="date" content="2020-07-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.facebook.litho.sections.annotations";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- @generated -->
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/facebook/litho/sections/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../com/facebook/litho/sections/common/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/facebook/litho/sections/annotations/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package com.facebook.litho.sections.annotations</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Annotation Types Summary table, listing annotation types, and an explanation">
<caption><span>Annotation Types Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Annotation Type</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnBindService.html" title="annotation in com.facebook.litho.sections.annotations">OnBindService</a></td>
<td class="colLast">
<div class="block">The method with this annotation will be called whenever the Service has been created or
transferred from the old tree to the new tree and are therefore ready to be used.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnCreateChildren.html" title="annotation in com.facebook.litho.sections.annotations">OnCreateChildren</a></td>
<td class="colLast">
<div class="block">Every class that is annotated with <code>GroupSectionSpec</code> requires a method that is annotated
with <a href="../../../../../com/facebook/litho/sections/annotations/OnCreateChildren.html" title="annotation in com.facebook.litho.sections.annotations"><code>OnCreateChildren</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnCreateService.html" title="annotation in com.facebook.litho.sections.annotations">OnCreateService</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the Component is created for the
first time and should create the Service it wishes to use.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnDataBound.html" title="annotation in com.facebook.litho.sections.annotations">OnDataBound</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the data corresponding to this
Section props is now visible to the <code>SectionTree.Target</code> of the <code>SectionTree
</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnDataRendered.html" title="annotation in com.facebook.litho.sections.annotations">OnDataRendered</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the data corresponding to this
Section props is now rendered complete.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnDiff.html" title="annotation in com.facebook.litho.sections.annotations">OnDiff</a></td>
<td class="colLast">
<div class="block">A class annotated with <code>DiffSectionSpec</code> requires a method with this annotation.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnRefresh.html" title="annotation in com.facebook.litho.sections.annotations">OnRefresh</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the Ui rendering the <code>Section
</code> requests a refresh of the content.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnUnbindService.html" title="annotation in com.facebook.litho.sections.annotations">OnUnbindService</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the Service has been transferred
from the old tree to the new tree.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/facebook/litho/sections/annotations/OnViewportChanged.html" title="annotation in com.facebook.litho.sections.annotations">OnViewportChanged</a></td>
<td class="colLast">
<div class="block">The method annotated with this annotation will be called when the UI rendering the <code>Section
</code> scrolls to a new position.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/facebook/litho/sections/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../com/facebook/litho/sections/common/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/facebook/litho/sections/annotations/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
module.exports = {
'all': require('./collection/all'),
'any': require('./collection/any'),
'at': require('./collection/at'),
'collect': require('./collection/collect'),
'contains': require('./collection/contains'),
'countBy': require('./collection/countBy'),
'detect': require('./collection/detect'),
'each': require('./collection/each'),
'eachRight': require('./collection/eachRight'),
'every': require('./collection/every'),
'filter': require('./collection/filter'),
'find': require('./collection/find'),
'findLast': require('./collection/findLast'),
'findWhere': require('./collection/findWhere'),
'foldl': require('./collection/foldl'),
'foldr': require('./collection/foldr'),
'forEach': require('./collection/forEach'),
'forEachRight': require('./collection/forEachRight'),
'groupBy': require('./collection/groupBy'),
'include': require('./collection/include'),
'includes': require('./collection/includes'),
'indexBy': require('./collection/indexBy'),
'inject': require('./collection/inject'),
'invoke': require('./collection/invoke'),
'map': require('./collection/map'),
'max': require('./math/max'),
'min': require('./math/min'),
'partition': require('./collection/partition'),
'pluck': require('./collection/pluck'),
'reduce': require('./collection/reduce'),
'reduceRight': require('./collection/reduceRight'),
'reject': require('./collection/reject'),
'sample': require('./collection/sample'),
'select': require('./collection/select'),
'shuffle': require('./collection/shuffle'),
'size': require('./collection/size'),
'some': require('./collection/some'),
'sortBy': require('./collection/sortBy'),
'sortByAll': require('./collection/sortByAll'),
'sortByOrder': require('./collection/sortByOrder'),
'sum': require('./math/sum'),
'where': require('./collection/where')
};
| {
"pile_set_name": "Github"
} |
/*
Copyright 2020 The Knative Authors
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.
*/
// Code generated by informer-gen. DO NOT EDIT.
package internalinterfaces
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
cache "k8s.io/client-go/tools/cache"
versioned "knative.dev/eventing/pkg/client/clientset/versioned"
)
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
type SharedInformerFactory interface {
Start(stopCh <-chan struct{})
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
}
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
type TweakListOptionsFunc func(*v1.ListOptions)
| {
"pile_set_name": "Github"
} |
# $NetBSD: buildlink3.mk,v 1.1 2012/09/15 17:25:40 dholland Exp $
BUILDLINK_TREE+= sparsehash
.if !defined(SPARSEHASH_BUILDLINK3_MK)
SPARSEHASH_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.sparsehash+= sparsehash>=2.0.2
BUILDLINK_ABI_DEPENDS.sparsehash+= sparsehash>=2.0.2
BUILDLINK_PKGSRCDIR.sparsehash?= ../../devel/sparsehash
.endif # SPARSEHASH_BUILDLINK3_MK
BUILDLINK_TREE+= -sparsehash
| {
"pile_set_name": "Github"
} |
package railo.runtime.cache.eh.remote.rest.sax;
public class CacheMeta {
private CacheConfiguration cacheConfiguration;
private CacheStatistics cacheStatistics;
public CacheMeta(CacheConfiguration cacheConfiguration, CacheStatistics cacheStatistics) {
this.cacheConfiguration=cacheConfiguration;
this.cacheStatistics=cacheStatistics;
}
/**
* @return the cacheConfiguration
*/
public CacheConfiguration getCacheConfiguration() {
return cacheConfiguration;
}
/**
* @return the cacheStatistics
*/
public CacheStatistics getCacheStatistics() {
return cacheStatistics;
}
}
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
char buf[128];
int bytes = readlink("/proc/self/exe", buf, 128);
if(bytes == 128) {
perror("readlink");
return -1;
}
buf[bytes] = '\0';
printf("readlink on /proc/self/exe returns %d (%s)\n", bytes, buf);
return 0;
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/keyframes-test.js"></script>
<script>
test(function() {
assertAnimationStyles([
{opacity: '0', left: '0px', easing: 'steps(2, start)'},
{opacity: '0.25', left: '25px'},
{opacity: '0.75', left: '75px'},
], {
0: {opacity: '0.125', left: '12.5px'},
0.125: {opacity: '0.125', left: '12.5px'},
0.25: {opacity: '0.25', left: '25px'},
0.375: {opacity: '0.25', left: '25px'},
0.5: {opacity: '0.25', left: '25px'},
0.625: {opacity: '0.375', left: '37.5px'},
0.75: {opacity: '0.5', left: '50px'},
0.875: {opacity: '0.625', left: '62.5px'},
1: {opacity: '0.75', left: '75px'},
}, 'with easing on first keyframe');
assertAnimationStyles([
{opacity: '0', left: '0px'},
{opacity: '0.5', left: '50px', easing: 'steps(2, start)'},
{opacity: '0.75', left: '75px'},
], {
0: {opacity: '0', left: '0px'},
0.125: {opacity: '0.125', left: '12.5px'},
0.25: {opacity: '0.25', left: '25px'},
0.375: {opacity: '0.375', left: '37.5px'},
0.5: {opacity: '0.625', left: '62.5px'},
0.625: {opacity: '0.625', left: '62.5px'},
0.75: {opacity: '0.75', left: '75px'},
0.875: {opacity: '0.75', left: '75px'},
1: {opacity: '0.75', left: '75px'},
}, 'with easing on second keyframe');
},
'element.animate() with eased keyframe',
{
help: 'http://dev.w3.org/fxtf/web-animations/#the-keyframe-dictionary',
assert: [
'element.animate() should start an animation when keyframes are specified with timing functions',
'for their easing property. The animation should use the given timing function between consecutive',
'keyframe offsets.',
],
author: 'Alan Cutter',
});
test(function() {
assertAnimationStyles([
{opacity: '0', offset: 0, easing: 'steps(2, start)'},
{left: '0px', offset: 0},
{opacity: '0.5', left: '50px'},
], {
0: {opacity: '0.25', left: '0px'},
0.25: {opacity: '0.25', left: '12.5px'},
0.5: {opacity: '0.5', left: '25px'},
0.75: {opacity: '0.5', left: '37.5px'},
1: {opacity: '0.5', left: '50px'},
});
},
'element.animate() with eased keyframe on single property',
{
help: 'http://dev.w3.org/fxtf/web-animations/#the-keyframe-dictionary',
assert: [
'element.animate() should start an animation when keyframes are specified with timing functions',
'for their easing property. The animation should use the given timing function only on the properties',
'specified in the same keyframe.',
],
author: 'Alan Cutter',
});
test(function() {
assertAnimationStyles([
{opacity: '0', left: '0px'},
{opacity: '0.5', left: '50px', easing: 'steps(2, start)'},
], {
0: {opacity: '0', left: '0px'},
0.25: {opacity: '0.125', left: '12.5px'},
0.5: {opacity: '0.25', left: '25px'},
0.75: {opacity: '0.375', left: '37.5px'},
1: {opacity: '0.5', left: '50px'},
});
},
'element.animate() with easing on last keyframe',
{
help: 'http://dev.w3.org/fxtf/web-animations/#the-keyframe-dictionary',
assert: [
'element.animate() should start an animation when keyframes are specified with timing functions',
'for their easing property. Easing on the last keyframes should have no effect on the animation.',
],
author: 'Alan Cutter',
});
</script>
| {
"pile_set_name": "Github"
} |
{
"frameGrid" : {
"size" : [25, 30],
"dimensions" : [6, 1]
}
}
| {
"pile_set_name": "Github"
} |
/*
* 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
*/
#define ST2084_MAX_LUMINANCE 10000.0f
#define REFERENCE_WHITE 100.0f
#if chroma_loc == 1
#define chroma_sample(a,b,c,d) (((a) + (c)) * 0.5f)
#elif chroma_loc == 3
#define chroma_sample(a,b,c,d) (a)
#elif chroma_loc == 4
#define chroma_sample(a,b,c,d) (((a) + (b)) * 0.5f)
#elif chroma_loc == 5
#define chroma_sample(a,b,c,d) (c)
#elif chroma_loc == 6
#define chroma_sample(a,b,c,d) (((c) + (d)) * 0.5f)
#else
#define chroma_sample(a,b,c,d) (((a) + (b) + (c) + (d)) * 0.25f)
#endif
constant const float ST2084_M1 = 0.1593017578125f;
constant const float ST2084_M2 = 78.84375f;
constant const float ST2084_C1 = 0.8359375f;
constant const float ST2084_C2 = 18.8515625f;
constant const float ST2084_C3 = 18.6875f;
__constant float yuv2rgb_bt2020[] = {
1.0f, 0.0f, 1.4746f,
1.0f, -0.16455f, -0.57135f,
1.0f, 1.8814f, 0.0f
};
__constant float yuv2rgb_bt709[] = {
1.0f, 0.0f, 1.5748f,
1.0f, -0.18732f, -0.46812f,
1.0f, 1.8556f, 0.0f
};
__constant float rgb2yuv_bt709[] = {
0.2126f, 0.7152f, 0.0722f,
-0.11457f, -0.38543f, 0.5f,
0.5f, -0.45415f, -0.04585f
};
__constant float rgb2yuv_bt2020[] ={
0.2627f, 0.678f, 0.0593f,
-0.1396f, -0.36037f, 0.5f,
0.5f, -0.4598f, -0.0402f,
};
float get_luma_dst(float3 c) {
return luma_dst.x * c.x + luma_dst.y * c.y + luma_dst.z * c.z;
}
float get_luma_src(float3 c) {
return luma_src.x * c.x + luma_src.y * c.y + luma_src.z * c.z;
}
float3 get_chroma_sample(float3 a, float3 b, float3 c, float3 d) {
return chroma_sample(a, b, c, d);
}
float eotf_st2084(float x) {
float p = powr(x, 1.0f / ST2084_M2);
float a = max(p -ST2084_C1, 0.0f);
float b = max(ST2084_C2 - ST2084_C3 * p, 1e-6f);
float c = powr(a / b, 1.0f / ST2084_M1);
return x > 0.0f ? c * ST2084_MAX_LUMINANCE / REFERENCE_WHITE : 0.0f;
}
__constant const float HLG_A = 0.17883277f;
__constant const float HLG_B = 0.28466892f;
__constant const float HLG_C = 0.55991073f;
// linearizer for HLG
float inverse_oetf_hlg(float x) {
float a = 4.0f * x * x;
float b = exp((x - HLG_C) / HLG_A) + HLG_B;
return x < 0.5f ? a : b;
}
// delinearizer for HLG
float oetf_hlg(float x) {
float a = 0.5f * sqrt(x);
float b = HLG_A * log(x - HLG_B) + HLG_C;
return x <= 1.0f ? a : b;
}
float3 ootf_hlg(float3 c, float peak) {
float luma = get_luma_src(c);
float gamma = 1.2f + 0.42f * log10(peak * REFERENCE_WHITE / 1000.0f);
gamma = max(1.0f, gamma);
float factor = peak * powr(luma, gamma - 1.0f) / powr(12.0f, gamma);
return c * factor;
}
float3 inverse_ootf_hlg(float3 c, float peak) {
float gamma = 1.2f + 0.42f * log10(peak * REFERENCE_WHITE / 1000.0f);
c *= powr(12.0f, gamma) / peak;
c /= powr(get_luma_dst(c), (gamma - 1.0f) / gamma);
return c;
}
float inverse_eotf_bt1886(float c) {
return c < 0.0f ? 0.0f : powr(c, 1.0f / 2.4f);
}
float oetf_bt709(float c) {
c = c < 0.0f ? 0.0f : c;
float r1 = 4.5f * c;
float r2 = 1.099f * powr(c, 0.45f) - 0.099f;
return c < 0.018f ? r1 : r2;
}
float inverse_oetf_bt709(float c) {
float r1 = c / 4.5f;
float r2 = powr((c + 0.099f) / 1.099f, 1.0f / 0.45f);
return c < 0.081f ? r1 : r2;
}
float3 yuv2rgb(float y, float u, float v) {
#ifdef FULL_RANGE_IN
u -= 0.5f; v -= 0.5f;
#else
y = (y * 255.0f - 16.0f) / 219.0f;
u = (u * 255.0f - 128.0f) / 224.0f;
v = (v * 255.0f - 128.0f) / 224.0f;
#endif
float r = y * rgb_matrix[0] + u * rgb_matrix[1] + v * rgb_matrix[2];
float g = y * rgb_matrix[3] + u * rgb_matrix[4] + v * rgb_matrix[5];
float b = y * rgb_matrix[6] + u * rgb_matrix[7] + v * rgb_matrix[8];
return (float3)(r, g, b);
}
float3 yuv2lrgb(float3 yuv) {
float3 rgb = yuv2rgb(yuv.x, yuv.y, yuv.z);
float r = linearize(rgb.x);
float g = linearize(rgb.y);
float b = linearize(rgb.z);
return (float3)(r, g, b);
}
float3 rgb2yuv(float r, float g, float b) {
float y = r*yuv_matrix[0] + g*yuv_matrix[1] + b*yuv_matrix[2];
float u = r*yuv_matrix[3] + g*yuv_matrix[4] + b*yuv_matrix[5];
float v = r*yuv_matrix[6] + g*yuv_matrix[7] + b*yuv_matrix[8];
#ifdef FULL_RANGE_OUT
u += 0.5f; v += 0.5f;
#else
y = (219.0f * y + 16.0f) / 255.0f;
u = (224.0f * u + 128.0f) / 255.0f;
v = (224.0f * v + 128.0f) / 255.0f;
#endif
return (float3)(y, u, v);
}
float rgb2y(float r, float g, float b) {
float y = r*yuv_matrix[0] + g*yuv_matrix[1] + b*yuv_matrix[2];
y = (219.0f * y + 16.0f) / 255.0f;
return y;
}
float3 lrgb2yuv(float3 c) {
float r = delinearize(c.x);
float g = delinearize(c.y);
float b = delinearize(c.z);
return rgb2yuv(r, g, b);
}
float lrgb2y(float3 c) {
float r = delinearize(c.x);
float g = delinearize(c.y);
float b = delinearize(c.z);
return rgb2y(r, g, b);
}
float3 lrgb2lrgb(float3 c) {
#ifdef RGB2RGB_PASSTHROUGH
return c;
#else
float r = c.x, g = c.y, b = c.z;
float rr = rgb2rgb[0] * r + rgb2rgb[1] * g + rgb2rgb[2] * b;
float gg = rgb2rgb[3] * r + rgb2rgb[4] * g + rgb2rgb[5] * b;
float bb = rgb2rgb[6] * r + rgb2rgb[7] * g + rgb2rgb[8] * b;
return (float3)(rr, gg, bb);
#endif
}
float3 ootf(float3 c, float peak) {
#ifdef ootf_impl
return ootf_impl(c, peak);
#else
return c;
#endif
}
float3 inverse_ootf(float3 c, float peak) {
#ifdef inverse_ootf_impl
return inverse_ootf_impl(c, peak);
#else
return c;
#endif
}
| {
"pile_set_name": "Github"
} |
/* AFS File Server client stubs
*
* Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/circ_buf.h>
#include "internal.h"
#include "afs_fs.h"
/*
* decode an AFSFid block
*/
static void xdr_decode_AFSFid(const __be32 **_bp, struct afs_fid *fid)
{
const __be32 *bp = *_bp;
fid->vid = ntohl(*bp++);
fid->vnode = ntohl(*bp++);
fid->unique = ntohl(*bp++);
*_bp = bp;
}
/*
* decode an AFSFetchStatus block
*/
static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
struct afs_file_status *status,
struct afs_vnode *vnode,
afs_dataversion_t *store_version)
{
afs_dataversion_t expected_version;
const __be32 *bp = *_bp;
umode_t mode;
u64 data_version, size;
u32 changed = 0; /* becomes non-zero if ctime-type changes seen */
kuid_t owner;
kgid_t group;
#define EXTRACT(DST) \
do { \
u32 x = ntohl(*bp++); \
changed |= DST - x; \
DST = x; \
} while (0)
status->if_version = ntohl(*bp++);
EXTRACT(status->type);
EXTRACT(status->nlink);
size = ntohl(*bp++);
data_version = ntohl(*bp++);
EXTRACT(status->author);
owner = make_kuid(&init_user_ns, ntohl(*bp++));
changed |= !uid_eq(owner, status->owner);
status->owner = owner;
EXTRACT(status->caller_access); /* call ticket dependent */
EXTRACT(status->anon_access);
EXTRACT(status->mode);
EXTRACT(status->parent.vnode);
EXTRACT(status->parent.unique);
bp++; /* seg size */
status->mtime_client = ntohl(*bp++);
status->mtime_server = ntohl(*bp++);
group = make_kgid(&init_user_ns, ntohl(*bp++));
changed |= !gid_eq(group, status->group);
status->group = group;
bp++; /* sync counter */
data_version |= (u64) ntohl(*bp++) << 32;
EXTRACT(status->lock_count);
size |= (u64) ntohl(*bp++) << 32;
bp++; /* spare 4 */
*_bp = bp;
if (size != status->size) {
status->size = size;
changed |= true;
}
status->mode &= S_IALLUGO;
_debug("vnode time %lx, %lx",
status->mtime_client, status->mtime_server);
if (vnode) {
status->parent.vid = vnode->fid.vid;
if (changed && !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
_debug("vnode changed");
i_size_write(&vnode->vfs_inode, size);
vnode->vfs_inode.i_uid = status->owner;
vnode->vfs_inode.i_gid = status->group;
vnode->vfs_inode.i_generation = vnode->fid.unique;
set_nlink(&vnode->vfs_inode, status->nlink);
mode = vnode->vfs_inode.i_mode;
mode &= ~S_IALLUGO;
mode |= status->mode;
barrier();
vnode->vfs_inode.i_mode = mode;
}
vnode->vfs_inode.i_ctime.tv_sec = status->mtime_server;
vnode->vfs_inode.i_mtime = vnode->vfs_inode.i_ctime;
vnode->vfs_inode.i_atime = vnode->vfs_inode.i_ctime;
vnode->vfs_inode.i_version = data_version;
}
expected_version = status->data_version;
if (store_version)
expected_version = *store_version;
if (expected_version != data_version) {
status->data_version = data_version;
if (vnode && !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
_debug("vnode modified %llx on {%x:%u}",
(unsigned long long) data_version,
vnode->fid.vid, vnode->fid.vnode);
set_bit(AFS_VNODE_MODIFIED, &vnode->flags);
set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags);
}
} else if (store_version) {
status->data_version = data_version;
}
}
/*
* decode an AFSCallBack block
*/
static void xdr_decode_AFSCallBack(const __be32 **_bp, struct afs_vnode *vnode)
{
const __be32 *bp = *_bp;
vnode->cb_version = ntohl(*bp++);
vnode->cb_expiry = ntohl(*bp++);
vnode->cb_type = ntohl(*bp++);
vnode->cb_expires = vnode->cb_expiry + get_seconds();
*_bp = bp;
}
static void xdr_decode_AFSCallBack_raw(const __be32 **_bp,
struct afs_callback *cb)
{
const __be32 *bp = *_bp;
cb->version = ntohl(*bp++);
cb->expiry = ntohl(*bp++);
cb->type = ntohl(*bp++);
*_bp = bp;
}
/*
* decode an AFSVolSync block
*/
static void xdr_decode_AFSVolSync(const __be32 **_bp,
struct afs_volsync *volsync)
{
const __be32 *bp = *_bp;
volsync->creation = ntohl(*bp++);
bp++; /* spare2 */
bp++; /* spare3 */
bp++; /* spare4 */
bp++; /* spare5 */
bp++; /* spare6 */
*_bp = bp;
}
/*
* encode the requested attributes into an AFSStoreStatus block
*/
static void xdr_encode_AFS_StoreStatus(__be32 **_bp, struct iattr *attr)
{
__be32 *bp = *_bp;
u32 mask = 0, mtime = 0, owner = 0, group = 0, mode = 0;
mask = 0;
if (attr->ia_valid & ATTR_MTIME) {
mask |= AFS_SET_MTIME;
mtime = attr->ia_mtime.tv_sec;
}
if (attr->ia_valid & ATTR_UID) {
mask |= AFS_SET_OWNER;
owner = from_kuid(&init_user_ns, attr->ia_uid);
}
if (attr->ia_valid & ATTR_GID) {
mask |= AFS_SET_GROUP;
group = from_kgid(&init_user_ns, attr->ia_gid);
}
if (attr->ia_valid & ATTR_MODE) {
mask |= AFS_SET_MODE;
mode = attr->ia_mode & S_IALLUGO;
}
*bp++ = htonl(mask);
*bp++ = htonl(mtime);
*bp++ = htonl(owner);
*bp++ = htonl(group);
*bp++ = htonl(mode);
*bp++ = 0; /* segment size */
*_bp = bp;
}
/*
* decode an AFSFetchVolumeStatus block
*/
static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp,
struct afs_volume_status *vs)
{
const __be32 *bp = *_bp;
vs->vid = ntohl(*bp++);
vs->parent_id = ntohl(*bp++);
vs->online = ntohl(*bp++);
vs->in_service = ntohl(*bp++);
vs->blessed = ntohl(*bp++);
vs->needs_salvage = ntohl(*bp++);
vs->type = ntohl(*bp++);
vs->min_quota = ntohl(*bp++);
vs->max_quota = ntohl(*bp++);
vs->blocks_in_use = ntohl(*bp++);
vs->part_blocks_avail = ntohl(*bp++);
vs->part_max_blocks = ntohl(*bp++);
*_bp = bp;
}
/*
* deliver reply data to an FS.FetchStatus
*/
static int afs_deliver_fs_fetch_status(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter(",,%u", last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
xdr_decode_AFSCallBack(&bp, vnode);
if (call->reply2)
xdr_decode_AFSVolSync(&bp, call->reply2);
_leave(" = 0 [done]");
return 0;
}
/*
* FS.FetchStatus operation type
*/
static const struct afs_call_type afs_RXFSFetchStatus = {
.name = "FS.FetchStatus",
.deliver = afs_deliver_fs_fetch_status,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* fetch the status information for a file
*/
int afs_fs_fetch_file_status(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
struct afs_volsync *volsync,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter(",%x,{%x:%u},,",
key_serial(key), vnode->fid.vid, vnode->fid.vnode);
call = afs_alloc_flat_call(&afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->reply2 = volsync;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
bp[0] = htonl(FSFETCHSTATUS);
bp[1] = htonl(vnode->fid.vid);
bp[2] = htonl(vnode->fid.vnode);
bp[3] = htonl(vnode->fid.unique);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.FetchData
*/
static int afs_deliver_fs_fetch_data(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
struct page *page;
void *buffer;
int ret;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
switch (call->unmarshall) {
case 0:
call->offset = 0;
call->unmarshall++;
if (call->operation_ID != FSFETCHDATA64) {
call->unmarshall++;
goto no_msw;
}
/* extract the upper part of the returned data length of an
* FSFETCHDATA64 op (which should always be 0 using this
* client) */
case 1:
_debug("extract data length (MSW)");
ret = afs_extract_data(call, skb, last, &call->tmp, 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->count = ntohl(call->tmp);
_debug("DATA length MSW: %u", call->count);
if (call->count > 0)
return -EBADMSG;
call->offset = 0;
call->unmarshall++;
no_msw:
/* extract the returned data length */
case 2:
_debug("extract data length");
ret = afs_extract_data(call, skb, last, &call->tmp, 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->count = ntohl(call->tmp);
_debug("DATA length: %u", call->count);
if (call->count > PAGE_SIZE)
return -EBADMSG;
call->offset = 0;
call->unmarshall++;
/* extract the returned data */
case 3:
_debug("extract data");
if (call->count > 0) {
page = call->reply3;
buffer = kmap_atomic(page);
ret = afs_extract_data(call, skb, last, buffer,
call->count);
kunmap_atomic(buffer);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
}
call->offset = 0;
call->unmarshall++;
/* extract the metadata */
case 4:
ret = afs_extract_data(call, skb, last, call->buffer,
(21 + 3 + 6) * 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
xdr_decode_AFSCallBack(&bp, vnode);
if (call->reply2)
xdr_decode_AFSVolSync(&bp, call->reply2);
call->offset = 0;
call->unmarshall++;
case 5:
_debug("trailer");
if (skb->len != 0)
return -EBADMSG;
break;
}
if (!last)
return 0;
if (call->count < PAGE_SIZE) {
_debug("clear");
page = call->reply3;
buffer = kmap_atomic(page);
memset(buffer + call->count, 0, PAGE_SIZE - call->count);
kunmap_atomic(buffer);
}
_leave(" = 0 [done]");
return 0;
}
/*
* FS.FetchData operation type
*/
static const struct afs_call_type afs_RXFSFetchData = {
.name = "FS.FetchData",
.deliver = afs_deliver_fs_fetch_data,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSFetchData64 = {
.name = "FS.FetchData64",
.deliver = afs_deliver_fs_fetch_data,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* fetch data from a very large file
*/
static int afs_fs_fetch_data64(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
off_t offset, size_t length,
struct page *buffer,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter("");
ASSERTCMP(length, <, ULONG_MAX);
call = afs_alloc_flat_call(&afs_RXFSFetchData64, 32, (21 + 3 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->reply2 = NULL; /* volsync */
call->reply3 = buffer;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA64;
/* marshall the parameters */
bp = call->request;
bp[0] = htonl(FSFETCHDATA64);
bp[1] = htonl(vnode->fid.vid);
bp[2] = htonl(vnode->fid.vnode);
bp[3] = htonl(vnode->fid.unique);
bp[4] = htonl(upper_32_bits(offset));
bp[5] = htonl((u32) offset);
bp[6] = 0;
bp[7] = htonl((u32) length);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* fetch data from a file
*/
int afs_fs_fetch_data(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
off_t offset, size_t length,
struct page *buffer,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
if (upper_32_bits(offset) || upper_32_bits(offset + length))
return afs_fs_fetch_data64(server, key, vnode, offset, length,
buffer, wait_mode);
_enter("");
call = afs_alloc_flat_call(&afs_RXFSFetchData, 24, (21 + 3 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->reply2 = NULL; /* volsync */
call->reply3 = buffer;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA;
/* marshall the parameters */
bp = call->request;
bp[0] = htonl(FSFETCHDATA);
bp[1] = htonl(vnode->fid.vid);
bp[2] = htonl(vnode->fid.vnode);
bp[3] = htonl(vnode->fid.unique);
bp[4] = htonl(offset);
bp[5] = htonl(length);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.GiveUpCallBacks
*/
static int afs_deliver_fs_give_up_callbacks(struct afs_call *call,
struct sk_buff *skb, bool last)
{
_enter(",{%u},%d", skb->len, last);
if (skb->len > 0)
return -EBADMSG; /* shouldn't be any reply data */
return 0;
}
/*
* FS.GiveUpCallBacks operation type
*/
static const struct afs_call_type afs_RXFSGiveUpCallBacks = {
.name = "FS.GiveUpCallBacks",
.deliver = afs_deliver_fs_give_up_callbacks,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* give up a set of callbacks
* - the callbacks are held in the server->cb_break ring
*/
int afs_fs_give_up_callbacks(struct afs_server *server,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t ncallbacks;
__be32 *bp, *tp;
int loop;
ncallbacks = CIRC_CNT(server->cb_break_head, server->cb_break_tail,
ARRAY_SIZE(server->cb_break));
_enter("{%zu},", ncallbacks);
if (ncallbacks == 0)
return 0;
if (ncallbacks > AFSCBMAX)
ncallbacks = AFSCBMAX;
_debug("break %zu callbacks", ncallbacks);
call = afs_alloc_flat_call(&afs_RXFSGiveUpCallBacks,
12 + ncallbacks * 6 * 4, 0);
if (!call)
return -ENOMEM;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
tp = bp + 2 + ncallbacks * 3;
*bp++ = htonl(FSGIVEUPCALLBACKS);
*bp++ = htonl(ncallbacks);
*tp++ = htonl(ncallbacks);
atomic_sub(ncallbacks, &server->cb_break_n);
for (loop = ncallbacks; loop > 0; loop--) {
struct afs_callback *cb =
&server->cb_break[server->cb_break_tail];
*bp++ = htonl(cb->fid.vid);
*bp++ = htonl(cb->fid.vnode);
*bp++ = htonl(cb->fid.unique);
*tp++ = htonl(cb->version);
*tp++ = htonl(cb->expiry);
*tp++ = htonl(cb->type);
smp_mb();
server->cb_break_tail =
(server->cb_break_tail + 1) &
(ARRAY_SIZE(server->cb_break) - 1);
}
ASSERT(ncallbacks > 0);
wake_up_nr(&server->cb_break_waitq, ncallbacks);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.CreateFile or an FS.MakeDir
*/
static int afs_deliver_fs_create_vnode(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFid(&bp, call->reply2);
xdr_decode_AFSFetchStatus(&bp, call->reply3, NULL, NULL);
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
xdr_decode_AFSCallBack_raw(&bp, call->reply4);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.CreateFile and FS.MakeDir operation type
*/
static const struct afs_call_type afs_RXFSCreateXXXX = {
.name = "FS.CreateXXXX",
.deliver = afs_deliver_fs_create_vnode,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* create a file or make a directory
*/
int afs_fs_create(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
const char *name,
umode_t mode,
struct afs_fid *newfid,
struct afs_file_status *newstatus,
struct afs_callback *newcb,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t namesz, reqsz, padsz;
__be32 *bp;
_enter("");
namesz = strlen(name);
padsz = (4 - (namesz & 3)) & 3;
reqsz = (5 * 4) + namesz + padsz + (6 * 4);
call = afs_alloc_flat_call(&afs_RXFSCreateXXXX, reqsz,
(3 + 21 + 21 + 3 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->reply2 = newfid;
call->reply3 = newstatus;
call->reply4 = newcb;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = htonl(namesz);
memcpy(bp, name, namesz);
bp = (void *) bp + namesz;
if (padsz > 0) {
memset(bp, 0, padsz);
bp = (void *) bp + padsz;
}
*bp++ = htonl(AFS_SET_MODE);
*bp++ = 0; /* mtime */
*bp++ = 0; /* owner */
*bp++ = 0; /* group */
*bp++ = htonl(mode & S_IALLUGO); /* unix mode */
*bp++ = 0; /* segment size */
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.RemoveFile or FS.RemoveDir
*/
static int afs_deliver_fs_remove(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.RemoveDir/FS.RemoveFile operation type
*/
static const struct afs_call_type afs_RXFSRemoveXXXX = {
.name = "FS.RemoveXXXX",
.deliver = afs_deliver_fs_remove,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* remove a file or directory
*/
int afs_fs_remove(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
const char *name,
bool isdir,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t namesz, reqsz, padsz;
__be32 *bp;
_enter("");
namesz = strlen(name);
padsz = (4 - (namesz & 3)) & 3;
reqsz = (5 * 4) + namesz + padsz;
call = afs_alloc_flat_call(&afs_RXFSRemoveXXXX, reqsz, (21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = htonl(namesz);
memcpy(bp, name, namesz);
bp = (void *) bp + namesz;
if (padsz > 0) {
memset(bp, 0, padsz);
bp = (void *) bp + padsz;
}
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.Link
*/
static int afs_deliver_fs_link(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *dvnode = call->reply, *vnode = call->reply2;
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
xdr_decode_AFSFetchStatus(&bp, &dvnode->status, dvnode, NULL);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.Link operation type
*/
static const struct afs_call_type afs_RXFSLink = {
.name = "FS.Link",
.deliver = afs_deliver_fs_link,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* make a hard link
*/
int afs_fs_link(struct afs_server *server,
struct key *key,
struct afs_vnode *dvnode,
struct afs_vnode *vnode,
const char *name,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t namesz, reqsz, padsz;
__be32 *bp;
_enter("");
namesz = strlen(name);
padsz = (4 - (namesz & 3)) & 3;
reqsz = (5 * 4) + namesz + padsz + (3 * 4);
call = afs_alloc_flat_call(&afs_RXFSLink, reqsz, (21 + 21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = dvnode;
call->reply2 = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSLINK);
*bp++ = htonl(dvnode->fid.vid);
*bp++ = htonl(dvnode->fid.vnode);
*bp++ = htonl(dvnode->fid.unique);
*bp++ = htonl(namesz);
memcpy(bp, name, namesz);
bp = (void *) bp + namesz;
if (padsz > 0) {
memset(bp, 0, padsz);
bp = (void *) bp + padsz;
}
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.Symlink
*/
static int afs_deliver_fs_symlink(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFid(&bp, call->reply2);
xdr_decode_AFSFetchStatus(&bp, call->reply3, NULL, NULL);
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, NULL);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.Symlink operation type
*/
static const struct afs_call_type afs_RXFSSymlink = {
.name = "FS.Symlink",
.deliver = afs_deliver_fs_symlink,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* create a symbolic link
*/
int afs_fs_symlink(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
const char *name,
const char *contents,
struct afs_fid *newfid,
struct afs_file_status *newstatus,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t namesz, reqsz, padsz, c_namesz, c_padsz;
__be32 *bp;
_enter("");
namesz = strlen(name);
padsz = (4 - (namesz & 3)) & 3;
c_namesz = strlen(contents);
c_padsz = (4 - (c_namesz & 3)) & 3;
reqsz = (6 * 4) + namesz + padsz + c_namesz + c_padsz + (6 * 4);
call = afs_alloc_flat_call(&afs_RXFSSymlink, reqsz,
(3 + 21 + 21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->reply2 = newfid;
call->reply3 = newstatus;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSYMLINK);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = htonl(namesz);
memcpy(bp, name, namesz);
bp = (void *) bp + namesz;
if (padsz > 0) {
memset(bp, 0, padsz);
bp = (void *) bp + padsz;
}
*bp++ = htonl(c_namesz);
memcpy(bp, contents, c_namesz);
bp = (void *) bp + c_namesz;
if (c_padsz > 0) {
memset(bp, 0, c_padsz);
bp = (void *) bp + c_padsz;
}
*bp++ = htonl(AFS_SET_MODE);
*bp++ = 0; /* mtime */
*bp++ = 0; /* owner */
*bp++ = 0; /* group */
*bp++ = htonl(S_IRWXUGO); /* unix mode */
*bp++ = 0; /* segment size */
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.Rename
*/
static int afs_deliver_fs_rename(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *orig_dvnode = call->reply, *new_dvnode = call->reply2;
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &orig_dvnode->status, orig_dvnode, NULL);
if (new_dvnode != orig_dvnode)
xdr_decode_AFSFetchStatus(&bp, &new_dvnode->status, new_dvnode,
NULL);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.Rename operation type
*/
static const struct afs_call_type afs_RXFSRename = {
.name = "FS.Rename",
.deliver = afs_deliver_fs_rename,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* create a symbolic link
*/
int afs_fs_rename(struct afs_server *server,
struct key *key,
struct afs_vnode *orig_dvnode,
const char *orig_name,
struct afs_vnode *new_dvnode,
const char *new_name,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
size_t reqsz, o_namesz, o_padsz, n_namesz, n_padsz;
__be32 *bp;
_enter("");
o_namesz = strlen(orig_name);
o_padsz = (4 - (o_namesz & 3)) & 3;
n_namesz = strlen(new_name);
n_padsz = (4 - (n_namesz & 3)) & 3;
reqsz = (4 * 4) +
4 + o_namesz + o_padsz +
(3 * 4) +
4 + n_namesz + n_padsz;
call = afs_alloc_flat_call(&afs_RXFSRename, reqsz, (21 + 21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = orig_dvnode;
call->reply2 = new_dvnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSRENAME);
*bp++ = htonl(orig_dvnode->fid.vid);
*bp++ = htonl(orig_dvnode->fid.vnode);
*bp++ = htonl(orig_dvnode->fid.unique);
*bp++ = htonl(o_namesz);
memcpy(bp, orig_name, o_namesz);
bp = (void *) bp + o_namesz;
if (o_padsz > 0) {
memset(bp, 0, o_padsz);
bp = (void *) bp + o_padsz;
}
*bp++ = htonl(new_dvnode->fid.vid);
*bp++ = htonl(new_dvnode->fid.vnode);
*bp++ = htonl(new_dvnode->fid.unique);
*bp++ = htonl(n_namesz);
memcpy(bp, new_name, n_namesz);
bp = (void *) bp + n_namesz;
if (n_padsz > 0) {
memset(bp, 0, n_padsz);
bp = (void *) bp + n_padsz;
}
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.StoreData
*/
static int afs_deliver_fs_store_data(struct afs_call *call,
struct sk_buff *skb, bool last)
{
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter(",,%u", last);
afs_transfer_reply(call, skb);
if (!last) {
_leave(" = 0 [more]");
return 0;
}
if (call->reply_size != call->reply_max) {
_leave(" = -EBADMSG [%u != %u]",
call->reply_size, call->reply_max);
return -EBADMSG;
}
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode,
&call->store_version);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
afs_pages_written_back(vnode, call);
_leave(" = 0 [done]");
return 0;
}
/*
* FS.StoreData operation type
*/
static const struct afs_call_type afs_RXFSStoreData = {
.name = "FS.StoreData",
.deliver = afs_deliver_fs_store_data,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSStoreData64 = {
.name = "FS.StoreData64",
.deliver = afs_deliver_fs_store_data,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* store a set of pages to a very large file
*/
static int afs_fs_store_data64(struct afs_server *server,
struct afs_writeback *wb,
pgoff_t first, pgoff_t last,
unsigned offset, unsigned to,
loff_t size, loff_t pos, loff_t i_size,
const struct afs_wait_mode *wait_mode)
{
struct afs_vnode *vnode = wb->vnode;
struct afs_call *call;
__be32 *bp;
_enter(",%x,{%x:%u},,",
key_serial(wb->key), vnode->fid.vid, vnode->fid.vnode);
call = afs_alloc_flat_call(&afs_RXFSStoreData64,
(4 + 6 + 3 * 2) * 4,
(21 + 6) * 4);
if (!call)
return -ENOMEM;
call->wb = wb;
call->key = wb->key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->mapping = vnode->vfs_inode.i_mapping;
call->first = first;
call->last = last;
call->first_offset = offset;
call->last_to = to;
call->send_pages = true;
call->store_version = vnode->status.data_version + 1;
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSTOREDATA64);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = 0; /* mask */
*bp++ = 0; /* mtime */
*bp++ = 0; /* owner */
*bp++ = 0; /* group */
*bp++ = 0; /* unix mode */
*bp++ = 0; /* segment size */
*bp++ = htonl(pos >> 32);
*bp++ = htonl((u32) pos);
*bp++ = htonl(size >> 32);
*bp++ = htonl((u32) size);
*bp++ = htonl(i_size >> 32);
*bp++ = htonl((u32) i_size);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* store a set of pages
*/
int afs_fs_store_data(struct afs_server *server, struct afs_writeback *wb,
pgoff_t first, pgoff_t last,
unsigned offset, unsigned to,
const struct afs_wait_mode *wait_mode)
{
struct afs_vnode *vnode = wb->vnode;
struct afs_call *call;
loff_t size, pos, i_size;
__be32 *bp;
_enter(",%x,{%x:%u},,",
key_serial(wb->key), vnode->fid.vid, vnode->fid.vnode);
size = to - offset;
if (first != last)
size += (loff_t)(last - first) << PAGE_SHIFT;
pos = (loff_t)first << PAGE_SHIFT;
pos += offset;
i_size = i_size_read(&vnode->vfs_inode);
if (pos + size > i_size)
i_size = size + pos;
_debug("size %llx, at %llx, i_size %llx",
(unsigned long long) size, (unsigned long long) pos,
(unsigned long long) i_size);
if (pos >> 32 || i_size >> 32 || size >> 32 || (pos + size) >> 32)
return afs_fs_store_data64(server, wb, first, last, offset, to,
size, pos, i_size, wait_mode);
call = afs_alloc_flat_call(&afs_RXFSStoreData,
(4 + 6 + 3) * 4,
(21 + 6) * 4);
if (!call)
return -ENOMEM;
call->wb = wb;
call->key = wb->key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->mapping = vnode->vfs_inode.i_mapping;
call->first = first;
call->last = last;
call->first_offset = offset;
call->last_to = to;
call->send_pages = true;
call->store_version = vnode->status.data_version + 1;
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSTOREDATA);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = 0; /* mask */
*bp++ = 0; /* mtime */
*bp++ = 0; /* owner */
*bp++ = 0; /* group */
*bp++ = 0; /* unix mode */
*bp++ = 0; /* segment size */
*bp++ = htonl(pos);
*bp++ = htonl(size);
*bp++ = htonl(i_size);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.StoreStatus
*/
static int afs_deliver_fs_store_status(struct afs_call *call,
struct sk_buff *skb, bool last)
{
afs_dataversion_t *store_version;
struct afs_vnode *vnode = call->reply;
const __be32 *bp;
_enter(",,%u", last);
afs_transfer_reply(call, skb);
if (!last) {
_leave(" = 0 [more]");
return 0;
}
if (call->reply_size != call->reply_max) {
_leave(" = -EBADMSG [%u != %u]",
call->reply_size, call->reply_max);
return -EBADMSG;
}
/* unmarshall the reply once we've received all of it */
store_version = NULL;
if (call->operation_ID == FSSTOREDATA)
store_version = &call->store_version;
bp = call->buffer;
xdr_decode_AFSFetchStatus(&bp, &vnode->status, vnode, store_version);
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.StoreStatus operation type
*/
static const struct afs_call_type afs_RXFSStoreStatus = {
.name = "FS.StoreStatus",
.deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSStoreData_as_Status = {
.name = "FS.StoreData",
.deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSStoreData64_as_Status = {
.name = "FS.StoreData64",
.deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* set the attributes on a very large file, using FS.StoreData rather than
* FS.StoreStatus so as to alter the file size also
*/
static int afs_fs_setattr_size64(struct afs_server *server, struct key *key,
struct afs_vnode *vnode, struct iattr *attr,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter(",%x,{%x:%u},,",
key_serial(key), vnode->fid.vid, vnode->fid.vnode);
ASSERT(attr->ia_valid & ATTR_SIZE);
call = afs_alloc_flat_call(&afs_RXFSStoreData64_as_Status,
(4 + 6 + 3 * 2) * 4,
(21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSTOREDATA64);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
xdr_encode_AFS_StoreStatus(&bp, attr);
*bp++ = 0; /* position of start of write */
*bp++ = 0;
*bp++ = 0; /* size of write */
*bp++ = 0;
*bp++ = htonl(attr->ia_size >> 32); /* new file length */
*bp++ = htonl((u32) attr->ia_size);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
* so as to alter the file size also
*/
static int afs_fs_setattr_size(struct afs_server *server, struct key *key,
struct afs_vnode *vnode, struct iattr *attr,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter(",%x,{%x:%u},,",
key_serial(key), vnode->fid.vid, vnode->fid.vnode);
ASSERT(attr->ia_valid & ATTR_SIZE);
if (attr->ia_size >> 32)
return afs_fs_setattr_size64(server, key, vnode, attr,
wait_mode);
call = afs_alloc_flat_call(&afs_RXFSStoreData_as_Status,
(4 + 6 + 3) * 4,
(21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSTOREDATA);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
xdr_encode_AFS_StoreStatus(&bp, attr);
*bp++ = 0; /* position of start of write */
*bp++ = 0; /* size of write */
*bp++ = htonl(attr->ia_size); /* new file length */
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* set the attributes on a file, using FS.StoreData if there's a change in file
* size, and FS.StoreStatus otherwise
*/
int afs_fs_setattr(struct afs_server *server, struct key *key,
struct afs_vnode *vnode, struct iattr *attr,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
if (attr->ia_valid & ATTR_SIZE)
return afs_fs_setattr_size(server, key, vnode, attr,
wait_mode);
_enter(",%x,{%x:%u},,",
key_serial(key), vnode->fid.vid, vnode->fid.vnode);
call = afs_alloc_flat_call(&afs_RXFSStoreStatus,
(4 + 6) * 4,
(21 + 6) * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
call->operation_ID = FSSTORESTATUS;
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSTORESTATUS);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
xdr_encode_AFS_StoreStatus(&bp, attr);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.GetVolumeStatus
*/
static int afs_deliver_fs_get_volume_status(struct afs_call *call,
struct sk_buff *skb, bool last)
{
const __be32 *bp;
char *p;
int ret;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
switch (call->unmarshall) {
case 0:
call->offset = 0;
call->unmarshall++;
/* extract the returned status record */
case 1:
_debug("extract status");
ret = afs_extract_data(call, skb, last, call->buffer,
12 * 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
bp = call->buffer;
xdr_decode_AFSFetchVolumeStatus(&bp, call->reply2);
call->offset = 0;
call->unmarshall++;
/* extract the volume name length */
case 2:
ret = afs_extract_data(call, skb, last, &call->tmp, 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->count = ntohl(call->tmp);
_debug("volname length: %u", call->count);
if (call->count >= AFSNAMEMAX)
return -EBADMSG;
call->offset = 0;
call->unmarshall++;
/* extract the volume name */
case 3:
_debug("extract volname");
if (call->count > 0) {
ret = afs_extract_data(call, skb, last, call->reply3,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
}
p = call->reply3;
p[call->count] = 0;
_debug("volname '%s'", p);
call->offset = 0;
call->unmarshall++;
/* extract the volume name padding */
if ((call->count & 3) == 0) {
call->unmarshall++;
goto no_volname_padding;
}
call->count = 4 - (call->count & 3);
case 4:
ret = afs_extract_data(call, skb, last, call->buffer,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->offset = 0;
call->unmarshall++;
no_volname_padding:
/* extract the offline message length */
case 5:
ret = afs_extract_data(call, skb, last, &call->tmp, 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->count = ntohl(call->tmp);
_debug("offline msg length: %u", call->count);
if (call->count >= AFSNAMEMAX)
return -EBADMSG;
call->offset = 0;
call->unmarshall++;
/* extract the offline message */
case 6:
_debug("extract offline");
if (call->count > 0) {
ret = afs_extract_data(call, skb, last, call->reply3,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
}
p = call->reply3;
p[call->count] = 0;
_debug("offline '%s'", p);
call->offset = 0;
call->unmarshall++;
/* extract the offline message padding */
if ((call->count & 3) == 0) {
call->unmarshall++;
goto no_offline_padding;
}
call->count = 4 - (call->count & 3);
case 7:
ret = afs_extract_data(call, skb, last, call->buffer,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->offset = 0;
call->unmarshall++;
no_offline_padding:
/* extract the message of the day length */
case 8:
ret = afs_extract_data(call, skb, last, &call->tmp, 4);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->count = ntohl(call->tmp);
_debug("motd length: %u", call->count);
if (call->count >= AFSNAMEMAX)
return -EBADMSG;
call->offset = 0;
call->unmarshall++;
/* extract the message of the day */
case 9:
_debug("extract motd");
if (call->count > 0) {
ret = afs_extract_data(call, skb, last, call->reply3,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
}
p = call->reply3;
p[call->count] = 0;
_debug("motd '%s'", p);
call->offset = 0;
call->unmarshall++;
/* extract the message of the day padding */
if ((call->count & 3) == 0) {
call->unmarshall++;
goto no_motd_padding;
}
call->count = 4 - (call->count & 3);
case 10:
ret = afs_extract_data(call, skb, last, call->buffer,
call->count);
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
call->offset = 0;
call->unmarshall++;
no_motd_padding:
case 11:
_debug("trailer %d", skb->len);
if (skb->len != 0)
return -EBADMSG;
break;
}
if (!last)
return 0;
_leave(" = 0 [done]");
return 0;
}
/*
* destroy an FS.GetVolumeStatus call
*/
static void afs_get_volume_status_call_destructor(struct afs_call *call)
{
kfree(call->reply3);
call->reply3 = NULL;
afs_flat_call_destructor(call);
}
/*
* FS.GetVolumeStatus operation type
*/
static const struct afs_call_type afs_RXFSGetVolumeStatus = {
.name = "FS.GetVolumeStatus",
.deliver = afs_deliver_fs_get_volume_status,
.abort_to_error = afs_abort_to_error,
.destructor = afs_get_volume_status_call_destructor,
};
/*
* fetch the status of a volume
*/
int afs_fs_get_volume_status(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
struct afs_volume_status *vs,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
void *tmpbuf;
_enter("");
tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL);
if (!tmpbuf)
return -ENOMEM;
call = afs_alloc_flat_call(&afs_RXFSGetVolumeStatus, 2 * 4, 12 * 4);
if (!call) {
kfree(tmpbuf);
return -ENOMEM;
}
call->key = key;
call->reply = vnode;
call->reply2 = vs;
call->reply3 = tmpbuf;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
bp[0] = htonl(FSGETVOLUMESTATUS);
bp[1] = htonl(vnode->fid.vid);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* deliver reply data to an FS.SetLock, FS.ExtendLock or FS.ReleaseLock
*/
static int afs_deliver_fs_xxxx_lock(struct afs_call *call,
struct sk_buff *skb, bool last)
{
const __be32 *bp;
_enter("{%u},{%u},%d", call->unmarshall, skb->len, last);
afs_transfer_reply(call, skb);
if (!last)
return 0;
if (call->reply_size != call->reply_max)
return -EBADMSG;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
/* xdr_decode_AFSVolSync(&bp, call->replyX); */
_leave(" = 0 [done]");
return 0;
}
/*
* FS.SetLock operation type
*/
static const struct afs_call_type afs_RXFSSetLock = {
.name = "FS.SetLock",
.deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* FS.ExtendLock operation type
*/
static const struct afs_call_type afs_RXFSExtendLock = {
.name = "FS.ExtendLock",
.deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* FS.ReleaseLock operation type
*/
static const struct afs_call_type afs_RXFSReleaseLock = {
.name = "FS.ReleaseLock",
.deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
/*
* get a lock on a file
*/
int afs_fs_set_lock(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
afs_lock_type_t type,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter("");
call = afs_alloc_flat_call(&afs_RXFSSetLock, 5 * 4, 6 * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSSETLOCK);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
*bp++ = htonl(type);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* extend a lock on a file
*/
int afs_fs_extend_lock(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter("");
call = afs_alloc_flat_call(&afs_RXFSExtendLock, 4 * 4, 6 * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSEXTENDLOCK);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
/*
* release a lock on a file
*/
int afs_fs_release_lock(struct afs_server *server,
struct key *key,
struct afs_vnode *vnode,
const struct afs_wait_mode *wait_mode)
{
struct afs_call *call;
__be32 *bp;
_enter("");
call = afs_alloc_flat_call(&afs_RXFSReleaseLock, 4 * 4, 6 * 4);
if (!call)
return -ENOMEM;
call->key = key;
call->reply = vnode;
call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
*bp++ = htonl(FSRELEASELOCK);
*bp++ = htonl(vnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique);
return afs_make_call(&server->addr, call, GFP_NOFS, wait_mode);
}
| {
"pile_set_name": "Github"
} |
package com.neu.his.component;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.json.JSONUtil;
import com.neu.his.bo.WebLog;
import io.swagger.annotations.ApiOperation;
import net.logstash.logback.marker.Markers;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 统一日志处理切面
*/
@Aspect
@Component
@Order(1)
public class WebLogAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(WebLogAspect.class);
private ThreadLocal<Long> startTime = new ThreadLocal<>();
@Pointcut("execution(public * com.neu.his.api.controller.*.*(..))")
public void webLog() {
}
@Before("webLog()")
public void doBefore(JoinPoint joinPoint) throws Throwable {
startTime.set(System.currentTimeMillis());
}
@AfterReturning(value = "webLog()", returning = "ret")
public void doAfterReturning(Object ret) throws Throwable {
}
@Around("webLog()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
//获取当前请求对象
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//记录请求信息(通过logstash传入elasticsearch)
WebLog webLog = new WebLog();
Object result = joinPoint.proceed();
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method.isAnnotationPresent(ApiOperation.class)) {
ApiOperation log = method.getAnnotation(ApiOperation.class);
webLog.setDescription(log.value());
}
long endTime = System.currentTimeMillis();
String urlStr = request.getRequestURL().toString();
webLog.setBasePath(StrUtil.removeSuffix(urlStr, URLUtil.url(urlStr).getPath()));
webLog.setIp(request.getRemoteUser());
webLog.setMethod(request.getMethod());
webLog.setParameter(getParameter(method, joinPoint.getArgs()));
webLog.setResult(result);
webLog.setSpendTime((int) (endTime - startTime.get()));
webLog.setStartTime(startTime.get());
webLog.setUri(request.getRequestURI());
webLog.setUrl(request.getRequestURL().toString());
Map<String,Object> logMap = new HashMap<>();
logMap.put("url",webLog.getUrl());
logMap.put("method",webLog.getMethod());
logMap.put("parameter",webLog.getParameter());
logMap.put("spendTime",webLog.getSpendTime());
logMap.put("description",webLog.getDescription());
// LOGGER.info("{}", JSONUtil.parse(webLog));
LOGGER.info(Markers.appendEntries(logMap), JSONUtil.parse(webLog).toString());
return result;
}
/**
* 根据方法和传入的参数获取请求参数
*/
private Object getParameter(Method method, Object[] args) {
List<Object> argList = new ArrayList<>();
Parameter[] parameters = method.getParameters();
for (int i = 0; i < parameters.length; i++) {
RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class);
if (requestBody != null) {
argList.add(args[i]);
}
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
if (requestParam != null) {
Map<String, Object> map = new HashMap<>();
String key = parameters[i].getName();
if (!StringUtils.isEmpty(requestParam.value())) {
key = requestParam.value();
}
map.put(key, args[i]);
argList.add(map);
}
}
if (argList.size() == 0) {
return null;
} else if (argList.size() == 1) {
return argList.get(0);
} else {
return argList;
}
}
}
| {
"pile_set_name": "Github"
} |
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: [email protected]
// Sales: [email protected]
//
// SecondaryYAxesChartView.m is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
#import "SecondaryYAxesChartView.h"
#import "SCDDataManager.h"
@implementation SecondaryYAxesChartView
- (Class)associatedType { return SCIChartSurface.class; }
- (BOOL)showDefaultModifiersInToolbar { return NO; }
- (void)initExample {
id<ISCIAxis> xAxis = [SCINumericAxis new];
xAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1];
xAxis.axisTitle = @"Bottom Axis";
id<ISCIAxis> rightYAxis = [SCINumericAxis new];
rightYAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1];
rightYAxis.axisId = @"rightAxisId";
rightYAxis.axisTitle = @"Right Axis";
rightYAxis.axisAlignment = SCIAxisAlignment_Right;
rightYAxis.tickLabelStyle = [[SCIFontStyle alloc] initWithFontSize:12 andTextColorCode:0xFF279B27];
rightYAxis.titleStyle = [[SCIFontStyle alloc] initWithFontSize:18 andTextColorCode:0xFF279B27];
id<ISCIAxis> leftYAxis = [SCINumericAxis new];
leftYAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1];
leftYAxis.axisId = @"leftAxisId";
leftYAxis.axisTitle = @"Left Axis";
leftYAxis.axisAlignment = SCIAxisAlignment_Left;
leftYAxis.tickLabelStyle = [[SCIFontStyle alloc] initWithFontSize:12 andTextColorCode:0xFF4083B7];
leftYAxis.titleStyle = [[SCIFontStyle alloc] initWithFontSize:18 andTextColorCode:0xFF4083B7];
SCIXyDataSeries *ds1 = [[SCIXyDataSeries alloc] initWithXType:SCIDataType_Double yType:SCIDataType_Double];
SCIXyDataSeries *ds2 = [[SCIXyDataSeries alloc] initWithXType:SCIDataType_Double yType:SCIDataType_Double];
SCDDoubleSeries *ds1Points = [SCDDataManager getFourierSeriesWithAmplitude:1.0 phaseShift:0.1 count:5000];
SCDDoubleSeries *ds2Points = [SCDDataManager getDampedSinewaveWithAmplitude:3.0 DampingFactor:0.005 PointCount:5000 Freq:10];
[ds1 appendValuesX:ds1Points.xValues y:ds1Points.yValues];
[ds2 appendValuesX:ds2Points.xValues y:ds2Points.yValues];
SCIFastLineRenderableSeries *rSeries1 = [SCIFastLineRenderableSeries new];
rSeries1.dataSeries = ds1;
rSeries1.strokeStyle = [[SCISolidPenStyle alloc] initWithColorCode:0xFF4083B7 thickness:1.0];
rSeries1.yAxisId = @"leftAxisId";
SCIFastLineRenderableSeries *rSeries2 = [SCIFastLineRenderableSeries new];
rSeries2.dataSeries = ds2;
rSeries2.strokeStyle = [[SCISolidPenStyle alloc] initWithColorCode:0xFF279B27 thickness:2.0];
rSeries2.yAxisId = @"rightAxisId";
[SCIUpdateSuspender usingWithSuspendable:self.surface withBlock:^{
[self.surface.xAxes add:xAxis];
[self.surface.yAxes add:leftYAxis];
[self.surface.yAxes add:rightYAxis];
[self.surface.renderableSeries add:rSeries1];
[self.surface.renderableSeries add:rSeries2];
[self.surface.chartModifiers add:[SCDExampleBaseViewController createDefaultModifiers]];
[SCIAnimations sweepSeries:rSeries1 duration:3.0 andEasingFunction:[SCICubicEase new]];
[SCIAnimations sweepSeries:rSeries2 duration:3.0 andEasingFunction:[SCICubicEase new]];
}];
}
@end
| {
"pile_set_name": "Github"
} |
{
"_args": [
[
"[email protected]",
"/Users/leonard.gonsalves/aws/Flask-Scaffold/app/templates/static"
]
],
"_development": true,
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-/PSQo37OJmRk2cxDGrmMWBnO0JU=",
"_location": "/degenerator",
"_optional": true,
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "degenerator",
"escapedName": "degenerator",
"rawSpec": "1.0.4",
"saveSpec": null,
"fetchSpec": "1.0.4"
},
"_requiredBy": [
"/pac-resolver"
],
"_resolved": "https://registry.npmjs.org/degenerator/-/degenerator-1.0.4.tgz",
"_spec": "1.0.4",
"_where": "/Users/leonard.gonsalves/aws/Flask-Scaffold/app/templates/static",
"author": {
"name": "Nathan Rajlich",
"email": "[email protected]",
"url": "http://n8.io/"
},
"bugs": {
"url": "https://github.com/TooTallNate/node-degenerator/issues"
},
"dependencies": {
"ast-types": "0.x.x",
"escodegen": "1.x.x",
"esprima": "3.x.x"
},
"description": "Turns sync functions into async generator functions",
"devDependencies": {
"mocha": "3.x.x"
},
"homepage": "https://github.com/TooTallNate/node-degenerator#readme",
"license": "MIT",
"main": "index.js",
"name": "degenerator",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/node-degenerator.git"
},
"scripts": {
"test": "mocha --reporter spec test/test.js"
},
"version": "1.0.4"
}
| {
"pile_set_name": "Github"
} |
[Link - Template App Weather Monitor (xdnny)](https://github.com/xdnny/weather-monitor-zabbix-postgresql)
| {
"pile_set_name": "Github"
} |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
include("lib/print_r.js");
function demo1() {
ncurses.initscr();
ncurses.printw('hello world !!!');
ncurses.refresh();
ncurses.getch();
ncurses.endwin();
}
function demo2() {
ncurses.initscr(); /* Start curses mode */
ncurses.raw(); /* Line buffering disabled */
ncurses.keypad(ncurses.stdscr, true); /* We get F1, F2 etc.. */
ncurses.noecho(); /* Don't echo() while we do getch */
ncurses.printw("Type any character to see it in bold\n");
ch = ncurses.getch(); /* If raw() hadn't been called
* we have to press enter before it
* gets to the program */
if(ch == ncurses.KEY_F(1)) { /* Without keypad enabled this will */
ncurses.printw("F1 Key pressed");/* not get to us either */
/* Without noecho() some ugly escape
* charachters might have been printed
* on screen */
}
else
{
ncurses.printw("The pressed key is ");
ncurses.attron(ncurses.A_BOLD);
ncurses.printw(String.fromCharCode(ch));
ncurses.attroff(ncurses.A_BOLD);
}
ncurses.refresh(); /* Print it on to the real screen */
ncurses.getch(); /* Wait for user input */
ncurses.endwin(); /* End curses mode */
}
function demo3() {
var mesg = 'just a string';
ncurses.initscr();
var maxyx = ncurses.getmaxyx();
var row = maxyx.row, col = maxyx.col;
ncurses.mvprintw(row/2, (col-mesg.length)/2, mesg);
ncurses.mvprintw(row-2, 0, 'this screen has ' + row + ' rows and ' + col + ' columns\n');
ncurses.printw('try resizing your window (if possible) and then run this program again');
ncurses.refresh();
ncurses.getch();
ncurses.endwin();
}
function demo4() {
var EOF = 'xxx';
var prev = EOF;
try {
ncurses.initscr(); /* Start curses mode */
var file = fs.readFile('main.cpp');
var maxyx = ncurses.getmaxyx(); /* find the boundaries of the screeen */
var row = maxyx.row, col = maxyx.col;
var yx, x, y;
for (var i=0, len=file.length; i<len; i++) {
var ch = file.charAt(i);
yx = ncurses.getyx(); /* get the current curser position */
y = yx.y;
x = yx.x;
if(y == (row - 1)) /* are we are at the end of the screen */
{
ncurses.printw("<-Press Any Key->"); /* tell the user to press a key */
ncurses.getch();
ncurses.clear(); /* clear the screen */
ncurses.move(0, 0); /* start at the beginning of the screen */
}
if(prev == '/' && ch == '*') /* If it is / and * then only
* switch bold on */
{
ncurses.attron(ncurses.A_BOLD); /* cut bold on */
yx = ncurses.getyx(); /* get the current curser position */
y = yx.y; x = yx.x;
ncurses.move(y, x - 1); /* back up one space */
ncurses.printw('/' + ch); /* The actual printing is done here */
}
else
ncurses.printw(ch);
ncurses.refresh();
if(prev == '*' && ch == '/')
ncurses.attroff(ncurses.A_BOLD); /* Switch it off once we got *
* and then / */
prev = ch;
}
}
finally {
ncurses.getch();
ncurses.endwin(); /* End curses mode */
}
}
function demo5() {
var my_win, startx, starty, width, height, ch;
ncurses.initscr();
ncurses.cbreak();
ncurses.keypad(ncurses.stdscr, true); /* I need that nifty F1 */
height = 3;
width = 10;
starty = (ncurses.LINES - height) / 2; /* Calculating for a center placement */
startx = (ncurses.COLS - width) / 2; /* of the window */
ncurses.printw("Press F1 to exit");
ncurses.refresh();
my_win = create_newwin(height, width, starty, startx);
while((ch = ncurses.getch()) != ncurses.KEY_F(1))
{ switch(ch)
{ case ncurses.KEY_LEFT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty,--startx);
break;
case ncurses.KEY_RIGHT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty,++startx);
break;
case ncurses.KEY_UP:
destroy_win(my_win);
my_win = create_newwin(height, width, --starty,startx);
break;
case ncurses.KEY_DOWN:
destroy_win(my_win);
my_win = create_newwin(height, width, ++starty,startx);
break;
}
}
ncurses.endwin(); /* End curses mode */
function create_newwin(height, width, starty, startx) {
var local_win = ncurses.newwin(height, width, starty, startx);
ncurses.box(local_win, 0, 0);
ncurses.wrefresh(local_win);
return local_win;
}
function destroy_win(local_win) {
ncurses.wborder(local_win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
ncurses.wrefresh(local_win);
ncurses.delwin(local_win);
}
}
function main(fn) {
function clearEol() {
var xy = ncurses.getyx();
var max_xy = ncurses.getmaxyx();
var x = xy.x, maxx = max_xy.x;
for (var i=x; i<maxx; i++) {
ncurses.printw(' ');
}
}
var entry, alive = true;
while (alive) {
ncurses.initscr();
ncurses.cbreak();
ncurses.clear();
var row = 0;
ncurses.attron(ncurses.A_STANDOUT);
ncurses.mvprintw(row++, 0, ' SilkJS NCurses Demos');
// ncurses.clrtoeol();
clearEol();
ncurses.attroff(ncurses.A_STANDOUT);
ncurses.mvprintw(++row, 0, '1) Hello, world');
ncurses.mvprintw(++row, 0, '2) getch demo');
ncurses.mvprintw(++row, 0, '3) window size demo');
ncurses.mvprintw(++row, 0, '4) less demo');
ncurses.mvprintw(++row, 0, '5) window demo');
row++;
ncurses.mvprintw(++row, 0, 'Press # or 0 to exit');
ncurses.refresh();
var raw = ncurses.getch();
if (raw === ncurses.KEY_RESIZE) {
// ncurses.clear();
ncurses.endwin();
continue;
}
entry = String.fromCharCode(raw);
ncurses.clear();
ncurses.endwin();
switch (entry) {
case '0':
case 'q':
alive = false;
break;
case '1':
demo1();
break;
case '2':
demo2();
break;
case '3':
demo3();
break;
case '4':
demo4();
break;
case '5':
demo5();
break;
}
}
}
| {
"pile_set_name": "Github"
} |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ToDo.UI.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if ((resourceMan == null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ToDo.UI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <SystemMigration/SMDXPCClientConnection.h>
#import <SystemMigration/SMDDebugProtocol-Protocol.h>
@interface SMDDebugCommands_XPCClientConnection : SMDXPCClientConnection <SMDDebugProtocol>
{
}
+ (id)daemonProtocolInterface;
+ (id)daemonProtocolInterfaceInstance;
- (void)interfacesAvailable:(CDUnknownBlockType)arg1;
- (void)allowLocalNetworkServer;
- (void)forceSlowEnumeration;
- (void)preferBackgroundMigrations;
- (void)delaySpotlightIndexing;
- (void)disableIdleExit;
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* 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.
*/
package com.tencentcloudapi.tag.v20180813.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DeleteResourceTagRequest extends AbstractModel{
/**
* 标签键
*/
@SerializedName("TagKey")
@Expose
private String TagKey;
/**
* [ 资源六段式描述 ](https://cloud.tencent.com/document/product/598/10606)
*/
@SerializedName("Resource")
@Expose
private String Resource;
/**
* Get 标签键
* @return TagKey 标签键
*/
public String getTagKey() {
return this.TagKey;
}
/**
* Set 标签键
* @param TagKey 标签键
*/
public void setTagKey(String TagKey) {
this.TagKey = TagKey;
}
/**
* Get [ 资源六段式描述 ](https://cloud.tencent.com/document/product/598/10606)
* @return Resource [ 资源六段式描述 ](https://cloud.tencent.com/document/product/598/10606)
*/
public String getResource() {
return this.Resource;
}
/**
* Set [ 资源六段式描述 ](https://cloud.tencent.com/document/product/598/10606)
* @param Resource [ 资源六段式描述 ](https://cloud.tencent.com/document/product/598/10606)
*/
public void setResource(String Resource) {
this.Resource = Resource;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "TagKey", this.TagKey);
this.setParamSimple(map, prefix + "Resource", this.Resource);
}
}
| {
"pile_set_name": "Github"
} |
#import <AVFoundation/AVBase.h>
#import <Foundation/Foundation.h>
#import <CoreMedia/CMTime.h>
#import <CoreGraphics/CoreGraphics.h>
@import AVFoundation;
@import JavaScriptCore;
@protocol JSBNSObject;
@protocol JSBAVAssetImageGenerator <JSExport, JSBNSObject>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (nonatomic) CGSize maximumSize;
@property (nonatomic, readonly) AVAsset *asset;
@property (nonatomic, copy) NSString *apertureMode;
@property (nonatomic) CMTime requestedTimeToleranceAfter;
@property (nonatomic, copy) AVVideoComposition *videoComposition;
@property (nonatomic, readonly) id customVideoCompositor;
@property (nonatomic) CMTime requestedTimeToleranceBefore;
@property (nonatomic) BOOL appliesPreferredTrackTransform;
+ (AVAssetImageGenerator *)assetImageGeneratorWithAsset:(AVAsset *)asset;
- (id)initWithAsset:(AVAsset *)asset;
- (id)copyCGImageAtTime:(CMTime)requestedTime actualTime:(CMTime *)actualTime error:(NSError **)outError;
- (void)generateCGImagesAsynchronouslyForTimes:(NSArray *)requestedTimes completionHandler:(AVAssetImageGeneratorCompletionHandler)handler;
- (void)cancelAllCGImageGeneration;
#pragma clang diagnostic pop
@end
| {
"pile_set_name": "Github"
} |
{
"name": "_tools",
"version": "1.0.0",
"private": true,
"license": "MIT",
"devDependencies": {
"prettier": "^2.0.5"
},
"scripts": {
"format": "prettier --write '../*/src/*.{js,ts}' && prettier --write '../*/webpack.config.js'"
}
}
| {
"pile_set_name": "Github"
} |
// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build amd64,freebsd
package unix
const (
// SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int
SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void
SYS_FORK = 2 // { int fork(void); }
SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); }
SYS_OPEN = 5 // { int open(char *path, int flags, int mode); }
SYS_CLOSE = 6 // { int close(int fd); }
SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); }
SYS_LINK = 9 // { int link(char *path, char *link); }
SYS_UNLINK = 10 // { int unlink(char *path); }
SYS_CHDIR = 12 // { int chdir(char *path); }
SYS_FCHDIR = 13 // { int fchdir(int fd); }
SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); }
SYS_CHMOD = 15 // { int chmod(char *path, int mode); }
SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); }
SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int
SYS_GETPID = 20 // { pid_t getpid(void); }
SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); }
SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); }
SYS_SETUID = 23 // { int setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t getuid(void); }
SYS_GETEUID = 25 // { uid_t geteuid(void); }
SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); }
SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); }
SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); }
SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); }
SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); }
SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); }
SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); }
SYS_ACCESS = 33 // { int access(char *path, int amode); }
SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); }
SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); }
SYS_SYNC = 36 // { int sync(void); }
SYS_KILL = 37 // { int kill(int pid, int signum); }
SYS_GETPPID = 39 // { pid_t getppid(void); }
SYS_DUP = 41 // { int dup(u_int fd); }
SYS_PIPE = 42 // { int pipe(void); }
SYS_GETEGID = 43 // { gid_t getegid(void); }
SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); }
SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); }
SYS_GETGID = 47 // { gid_t getgid(void); }
SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); }
SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); }
SYS_ACCT = 51 // { int acct(char *path); }
SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); }
SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); }
SYS_REBOOT = 55 // { int reboot(int opt); }
SYS_REVOKE = 56 // { int revoke(char *path); }
SYS_SYMLINK = 57 // { int symlink(char *path, char *link); }
SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); }
SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); }
SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int
SYS_CHROOT = 61 // { int chroot(char *path); }
SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); }
SYS_VFORK = 66 // { int vfork(void); }
SYS_SBRK = 69 // { int sbrk(int incr); }
SYS_SSTK = 70 // { int sstk(int incr); }
SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int
SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); }
SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); }
SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); }
SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); }
SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); }
SYS_GETPGRP = 81 // { int getpgrp(void); }
SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); }
SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); }
SYS_SWAPON = 85 // { int swapon(char *name); }
SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); }
SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); }
SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); }
SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); }
SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
SYS_FSYNC = 95 // { int fsync(int fd); }
SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); }
SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); }
SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); }
SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); }
SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); }
SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); }
SYS_LISTEN = 106 // { int listen(int s, int backlog); }
SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); }
SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); }
SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); }
SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); }
SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); }
SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); }
SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); }
SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); }
SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); }
SYS_SETREGID = 127 // { int setregid(int rgid, int egid); }
SYS_RENAME = 128 // { int rename(char *from, char *to); }
SYS_FLOCK = 131 // { int flock(int fd, int how); }
SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); }
SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); }
SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); }
SYS_MKDIR = 136 // { int mkdir(char *path, int mode); }
SYS_RMDIR = 137 // { int rmdir(char *path); }
SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); }
SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); }
SYS_SETSID = 147 // { int setsid(void); }
SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); }
SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); }
SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); }
SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); }
SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); }
SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); }
SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); }
SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); }
SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); }
SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); }
SYS_SETFIB = 175 // { int setfib(int fibnum); }
SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); }
SYS_SETGID = 181 // { int setgid(gid_t gid); }
SYS_SETEGID = 182 // { int setegid(gid_t egid); }
SYS_SETEUID = 183 // { int seteuid(uid_t euid); }
SYS_STAT = 188 // { int stat(char *path, struct stat *ub); }
SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); }
SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); }
SYS_PATHCONF = 191 // { int pathconf(char *path, int name); }
SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); }
SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int
SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int
SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); }
SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int
SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); }
SYS_UNDELETE = 205 // { int undelete(char *path); }
SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); }
SYS_GETPGID = 207 // { int getpgid(pid_t pid); }
SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); }
SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); }
SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); }
SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); }
SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); }
SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); }
SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); }
SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); }
SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); }
SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); }
SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); }
SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); }
SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); }
SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); }
SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); }
SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); }
SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); }
SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); }
SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); }
SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); }
SYS_RFORK = 251 // { int rfork(int flags); }
SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_ISSETUGID = 253 // { int issetugid(void); }
SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); }
SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); }
SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); }
SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); }
SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); }
SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); }
SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); }
SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); }
SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); }
SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); }
SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); }
SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); }
SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); }
SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); }
SYS_MODNEXT = 300 // { int modnext(int modid); }
SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); }
SYS_MODFNEXT = 302 // { int modfnext(int modid); }
SYS_MODFIND = 303 // { int modfind(const char *name); }
SYS_KLDLOAD = 304 // { int kldload(const char *file); }
SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); }
SYS_KLDFIND = 306 // { int kldfind(const char *file); }
SYS_KLDNEXT = 307 // { int kldnext(int fileid); }
SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); }
SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); }
SYS_GETSID = 310 // { int getsid(pid_t pid); }
SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); }
SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); }
SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); }
SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); }
SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); }
SYS_YIELD = 321 // { int yield(void); }
SYS_MLOCKALL = 324 // { int mlockall(int how); }
SYS_MUNLOCKALL = 325 // { int munlockall(void); }
SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); }
SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); }
SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); }
SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); }
SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); }
SYS_SCHED_YIELD = 331 // { int sched_yield (void); }
SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); }
SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); }
SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); }
SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); }
SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); }
SYS_JAIL = 338 // { int jail(struct jail *jail); }
SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); }
SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); }
SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); }
SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); }
SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); }
SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); }
SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); }
SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); }
SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); }
SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); }
SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); }
SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
SYS_KQUEUE = 362 // { int kqueue(void); }
SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); }
SYS___SETUGID = 374 // { int __setugid(int flag); }
SYS_EACCESS = 376 // { int eaccess(char *path, int amode); }
SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); }
SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); }
SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); }
SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); }
SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); }
SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); }
SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); }
SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); }
SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); }
SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); }
SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); }
SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); }
SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); }
SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); }
SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); }
SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); }
SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); }
SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); }
SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); }
SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); }
SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); }
SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); }
SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); }
SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); }
SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); }
SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); }
SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); }
SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); }
SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); }
SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); }
SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); }
SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); }
SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); }
SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); }
SYS_SWAPOFF = 424 // { int swapoff(const char *name); }
SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); }
SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); }
SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); }
SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); }
SYS_THR_EXIT = 431 // { void thr_exit(long *state); }
SYS_THR_SELF = 432 // { int thr_self(long *id); }
SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); }
SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); }
SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); }
SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); }
SYS_THR_WAKE = 443 // { int thr_wake(long id); }
SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); }
SYS_AUDIT = 445 // { int audit(const void *record, u_int length); }
SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); }
SYS_GETAUID = 447 // { int getauid(uid_t *auid); }
SYS_SETAUID = 448 // { int setauid(uid_t *auid); }
SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); }
SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); }
SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); }
SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); }
SYS_AUDITCTL = 453 // { int auditctl(char *path); }
SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); }
SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); }
SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); }
SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); }
SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); }
SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); }
SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);}
SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); }
SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); }
SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); }
SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); }
SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); }
SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); }
SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); }
SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); }
SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); }
SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); }
SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); }
SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); }
SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); }
SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); }
SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); }
SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); }
SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); }
SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); }
SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); }
SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); }
SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); }
SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); }
SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); }
SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); }
SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); }
SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); }
SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); }
SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); }
SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); }
SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); }
SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); }
SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); }
SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); }
SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); }
SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); }
SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); }
SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); }
SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); }
SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); }
SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); }
SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); }
SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); }
SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); }
SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); }
SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); }
SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); }
SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); }
SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); }
SYS_CAP_ENTER = 516 // { int cap_enter(void); }
SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }
SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); }
SYS_PDKILL = 519 // { int pdkill(int fd, int signum); }
SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); }
SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); }
SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); }
SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); }
SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); }
SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); }
SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); }
SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); }
SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); }
SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); }
SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); }
SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); }
SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); }
SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); }
SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); }
SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); }
SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); }
SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); }
SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); }
SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); }
SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); }
SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); }
SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); }
SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); }
SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); }
SYS_FDATASYNC = 550 // { int fdatasync(int fd); }
)
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/core/client/AWSError.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/networkmanager/NetworkManager_EXPORTS.h>
namespace Aws
{
namespace NetworkManager
{
enum class NetworkManagerErrors
{
//From Core//
//////////////////////////////////////////////////////////////////////////////////////////
INCOMPLETE_SIGNATURE = 0,
INTERNAL_FAILURE = 1,
INVALID_ACTION = 2,
INVALID_CLIENT_TOKEN_ID = 3,
INVALID_PARAMETER_COMBINATION = 4,
INVALID_QUERY_PARAMETER = 5,
INVALID_PARAMETER_VALUE = 6,
MISSING_ACTION = 7, // SDK should never allow
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
MISSING_PARAMETER = 9, // SDK should never allow
OPT_IN_REQUIRED = 10,
REQUEST_EXPIRED = 11,
SERVICE_UNAVAILABLE = 12,
THROTTLING = 13,
VALIDATION = 14,
ACCESS_DENIED = 15,
RESOURCE_NOT_FOUND = 16,
UNRECOGNIZED_CLIENT = 17,
MALFORMED_QUERY_STRING = 18,
SLOW_DOWN = 19,
REQUEST_TIME_TOO_SKEWED = 20,
INVALID_SIGNATURE = 21,
SIGNATURE_DOES_NOT_MATCH = 22,
INVALID_ACCESS_KEY_ID = 23,
REQUEST_TIMEOUT = 24,
NETWORK_CONNECTION = 99,
UNKNOWN = 100,
///////////////////////////////////////////////////////////////////////////////////////////
CONFLICT= static_cast<int>(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
INTERNAL_SERVER,
SERVICE_QUOTA_EXCEEDED
};
class AWS_NETWORKMANAGER_API NetworkManagerError : public Aws::Client::AWSError<NetworkManagerErrors>
{
public:
NetworkManagerError() {}
NetworkManagerError(const Aws::Client::AWSError<Aws::Client::CoreErrors>& rhs) : Aws::Client::AWSError<NetworkManagerErrors>(rhs) {}
NetworkManagerError(Aws::Client::AWSError<Aws::Client::CoreErrors>&& rhs) : Aws::Client::AWSError<NetworkManagerErrors>(rhs) {}
NetworkManagerError(const Aws::Client::AWSError<NetworkManagerErrors>& rhs) : Aws::Client::AWSError<NetworkManagerErrors>(rhs) {}
NetworkManagerError(Aws::Client::AWSError<NetworkManagerErrors>&& rhs) : Aws::Client::AWSError<NetworkManagerErrors>(rhs) {}
template <typename T>
T GetModeledError();
};
namespace NetworkManagerErrorMapper
{
AWS_NETWORKMANAGER_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
}
} // namespace NetworkManager
} // namespace Aws
| {
"pile_set_name": "Github"
} |
<?php
$image = tmpfile();
var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR));
?>
| {
"pile_set_name": "Github"
} |
require 'spec_helper'
describe FbGraph::AdAccount, '.new' do
it 'should setup all supported attributes' do
attributes = {
:id => 'act_12345566',
:account_id => 12345566,
:name => 'Test Ad Account',
:account_status => 1,
:daily_spend_limit => 20000,
:currency => "USD",
:timezone_id => 1,
:timezone_name => "America/Los_Angeles",
:capabilities => [1,2,3],
:account_groups =>[{"account_group_id"=>12344321, "name"=>"Account Group", "status"=>1}],
:is_personal => 1,
:business_name => "Business Inc.",
:business_street => "123 Fake St.",
:business_street2 => "Apt. 2B",
:business_city => "New York",
:business_state => "Alabama",
:business_zip => "33333",
:business_country_code => "US",
:vat_status => 1,
:agency_client_declaration => {
"agency_representing_client"=>1,
"client_based_in_france"=>0,
"has_written_mandate_from_advertiser"=>1,
"is_client_paying_invoices"=>1,
"client_name"=>"Client Smith",
"client_email_address"=>"[email protected]",
"client_street" => "321 Real St.",
"client_street2" => "Suite 123",
"client_city" => "Los Angeles",
"client_province" => "AB",
"client_postal_code" => "33433",
"client_country_code" => "CA"
},
:spend_cap => 1500,
:amount_spent => 1499
}
ad_account = FbGraph::AdAccount.new(attributes.delete(:id), attributes)
ad_account.identifier.should == "act_12345566"
ad_account.account_id.should == 12345566
ad_account.name.should == "Test Ad Account"
ad_account.account_status.should == 1
ad_account.daily_spend_limit.should == 20000
ad_account.currency.should == "USD"
ad_account.timezone_id.should == 1
ad_account.timezone_name.should == "America/Los_Angeles"
ad_account.capabilities.should == [1,2,3]
ad_account.account_groups.should == [{"account_group_id"=>12344321, "name"=>"Account Group", "status"=>1}]
ad_account.is_personal.should == 1
ad_account.business_name.should == "Business Inc."
ad_account.business_street.should == "123 Fake St."
ad_account.business_street2.should == "Apt. 2B"
ad_account.business_city.should == "New York"
ad_account.business_state.should == "Alabama"
ad_account.business_zip.should == "33333"
ad_account.business_country_code.should == "US"
ad_account.vat_status.should == 1
ad_account.agency_client_declaration.should == {
"agency_representing_client"=>1,
"client_based_in_france"=>0,
"has_written_mandate_from_advertiser"=>1,
"is_client_paying_invoices"=>1,
"client_name"=>"Client Smith",
"client_email_address"=>"[email protected]",
"client_street" => "321 Real St.",
"client_street2" => "Suite 123",
"client_city" => "Los Angeles",
"client_province" => "AB",
"client_postal_code" => "33433",
"client_country_code" => "CA"
}
ad_account.spend_cap.should == 1500
ad_account.amount_spent.should == 1499
end
end
describe FbGraph::AdAccount, '.fetch' do
it 'should get the ad account' do
mock_graph :get, 'act_12345566', 'ad_accounts/test_ad_account', :access_token => 'access_token' do
ad_account = FbGraph::AdAccount.fetch('act_12345566', :access_token => 'access_token')
ad_account.identifier.should == "act_12345566"
ad_account.account_id.should == 12345566
ad_account.name.should == "Test Ad Account"
ad_account.account_status.should == 1
ad_account.daily_spend_limit.should == 20000
ad_account.currency.should == "USD"
ad_account.timezone_id.should == 1
ad_account.timezone_name.should == "America/Los_Angeles"
ad_account.capabilities.should == [1,2,3]
ad_account.account_groups.should == [{"account_group_id"=>12344321, "name"=>"Account Group", "status"=>1}]
ad_account.is_personal.should == 1
ad_account.business_name.should == "Business Inc."
ad_account.business_street.should == "123 Fake St."
ad_account.business_street2.should == "Apt. 2B"
ad_account.business_city.should == "New York"
ad_account.business_state.should == "Alabama"
ad_account.business_zip.should == "33333"
ad_account.business_country_code.should == "US"
ad_account.vat_status.should == 1
ad_account.agency_client_declaration.should == {
"agency_representing_client"=>1,
"client_based_in_france"=>0,
"has_written_mandate_from_advertiser"=>1,
"is_client_paying_invoices"=>1,
"client_name"=>"Client Smith",
"client_email_address"=>"[email protected]",
"client_street" => "321 Real St.",
"client_street2" => "Suite 123",
"client_city" => "Los Angeles",
"client_province" => "AB",
"client_postal_code" => "33433",
"client_country_code" => "CA"
}
ad_account.spend_cap.should == 1500
ad_account.amount_spent.should == 1499
end
end
end
| {
"pile_set_name": "Github"
} |
#ifndef COCOS2DX_SCRIPT_LUA_COCOS2DX_SUPPORT_GENERATED_LUA_COCOS2DX_PHYSICS_MANUAL_H
#define COCOS2DX_SCRIPT_LUA_COCOS2DX_SUPPORT_GENERATED_LUA_COCOS2DX_PHYSICS_MANUAL_H
#if CC_USE_PHYSICS
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
#include "cocos2d.h"
#include "LuaScriptHandlerMgr.h"
int register_all_cocos2dx_physics_manual(lua_State* tolua_S);
#endif // CC_USE_PHYSICS
#endif // #ifndef COCOS2DX_SCRIPT_LUA_COCOS2DX_SUPPORT_GENERATED_LUA_COCOS2DX_PHYSICS_MANUAL_H
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef FUNCTION_TYPES_H
#define FUNCTION_TYPES_H
class FunctionObject
{
int data_[10]; // dummy variable to prevent small object optimization in
// std::function
public:
static int count;
FunctionObject() {
++count;
for (int i = 0; i < 10; ++i) data_[i] = i;
}
FunctionObject(const FunctionObject&) {++count;}
~FunctionObject() {--count; ((void)data_); }
int operator()() const { return 42; }
int operator()(int i) const { return i; }
int operator()(int i, int) const { return i; }
int operator()(int i, int, int) const { return i; }
};
int FunctionObject::count = 0;
class MemFunClass
{
int data_[10]; // dummy variable to prevent small object optimization in
// std::function
public:
static int count;
MemFunClass() {
++count;
for (int i = 0; i < 10; ++i) data_[i] = 0;
}
MemFunClass(const MemFunClass&) {++count; ((void)data_); }
~MemFunClass() {--count;}
int foo() const { return 42; }
int foo(int i) const { return i; }
int foo(int i, int) const { return i; }
int foo(int i, int, int) const { return i; }
};
int MemFunClass::count = 0;
int FreeFunction() { return 42; }
int FreeFunction(int i) {return i;}
int FreeFunction(int i, int) { return i; }
int FreeFunction(int i, int, int) { return i; }
#endif // FUNCTION_TYPES_H
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>CraigsUtilityLibrary-DataTypes</id>
<version>4.0.304</version>
<title>Craig's Utility Library DataTypes Namespace</title>
<authors>James Craig</authors>
<owners>James Craig</owners>
<licenseUrl>https://github.com/JaCraig/Craig-s-Utility-Library/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/JaCraig/Craig-s-Utility-Library</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Craig's Utility Library is one of the largest collections of utility classes and extension methods for .Net. It includes code to help with tasks including encryption, compression, serialization, file management, email, image manipulation, SQL, various file formats (CSV, iCal, etc.), randomization, validation, math related classes, various data types, reflection, code gen, events, code profiling, etc.</description>
<summary>This is the DataTypes namespace from Craig's Utility Library</summary>
<releaseNotes>This version is a complete rewrite from the 3.X line. This will break all of your code, so don't update unless you're a brave soul.</releaseNotes>
<copyright>Copyright 2011</copyright>
<tags>utility utilities</tags>
<dependencies>
<dependency id="CraigsUtilityLibrary-IoC" version="[4.0.304]" />
<dependency id="Microsoft.CodeAnalysis.CSharp" version="[1.3.2]" />
</dependencies>
<references>
<reference file="Utilities.DataTypes.dll" />
</references>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework="net40" />
<frameworkAssembly assemblyName="System.ComponentModel.DataAnnotations" targetFramework="net40" />
<frameworkAssembly assemblyName="System.configuration" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Core" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Data" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Data.DataSetExtensions" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Data.Entity.Design" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Drawing" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Runtime.Serialization" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Runtime.Serialization.Formatters.Soap" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Web" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Windows.Forms" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Xml" targetFramework="net40" />
<frameworkAssembly assemblyName="System.Xml.Linq" targetFramework="net40" />
</frameworkAssemblies>
</metadata>
<files>
<file src="lib\Utilities.DataTypes.dll" target="lib\net40" />
<file src="lib\Utilities.DataTypes.pdb" target="lib\net40" />
<file src="lib\Utilities.DataTypes.xml" target="lib\net40" />
<file src="lib\CodeContracts\Utilities.DataTypes.Contracts.dll" target="lib\net40\CodeContracts" />
<file src="lib\CodeContracts\Utilities.DataTypes.Contracts.pdb" target="lib\net40\CodeContracts" />
</files>
</package> | {
"pile_set_name": "Github"
} |
#ifndef asmdom_test_utils_hpp
#define asmdom_test_utils_hpp
#include "../../src/cpp/asm-dom.hpp"
#include <emscripten/val.h>
#include <string>
void assertEquals(emscripten::val actual, emscripten::val expected);
void assertNotEquals(emscripten::val actual, emscripten::val expected);
emscripten::val getBodyFirstChild();
emscripten::val getRoot();
emscripten::val getNode(asmdom::VNode* vnode);
bool onClick(emscripten::val event);
#endif | {
"pile_set_name": "Github"
} |
namespace Xamarin.Forms.Platform.UWP
{
public interface IDontGetFocus
{
}
}
| {
"pile_set_name": "Github"
} |
//about.js
//获取应用实例
var app = getApp();
Page({
data: {
version: '',
showLog: false
},
onLoad: function(){
this.setData({
version: app.version,
year: new Date().getFullYear()
});
},
toggleLog: function(){
this.setData({
showLog: !this.data.showLog
});
}
}); | {
"pile_set_name": "Github"
} |
---
version: 1
interactions:
- request:
body: Service=7i6HN3TK9wS159v2gPAZ8A&Version=8&address=example.com&format=format&format_version=2&hostname=example.com&message_type=classic&name=test-syslog&placement=waf_debug&port=1234&tls_ca_cert=-----BEGIN+CERTIFICATE-----%0AMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL%0AMAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC%0AVU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx%0ANDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD%0ATjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu%0AZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE%2FB7j%0AV14qeyslnr26xZUsSVko36ZnhiaO%2FzbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj%0AgbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA%0AFFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE%0ACBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS%0ABgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE%0ABQADQQA%2FugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z%2F%2BHQX67aRfgZu7KWdI%2BJu%0AWm7DCfrPNGVwFWUQOmsPue9rZBgO%0A-----END+CERTIFICATE-----&tls_client_cert=-----BEGIN+CERTIFICATE-----%0AMIIE6DCCAtACCQCzHO2a8qU6KzANBgkqhkiG9w0BAQsFADA2MRIwEAYDVQQDDAls%0Ab2NhbGhvc3QxIDAeBgNVBAoMF0NsaWVudCBDZXJ0aWZpY2F0ZSBEZW1vMB4XDTE5%0AMTIwNTE3MjY1N1oXDTIwMTIwNDE3MjY1N1owNjESMBAGA1UEAwwJbG9jYWxob3N0%0AMSAwHgYDVQQKDBdDbGllbnQgQ2VydGlmaWNhdGUgRGVtbzCCAiIwDQYJKoZIhvcN%0AAQEBBQADggIPADCCAgoCggIBAJ3iM9y8yWa9P%2BMRVj9Jj%2BrpNGDDrS1z2kl7SgDB%0AZisFYCHccvLfnz10OCWkI4fUWeAbsg2QJZ8i1EdFDtWnqhPXyqUsHRZRAI92ujvf%0A4g9r7ID0MENfVKOIY7ye3aphHUEW5lAkkJae12QcxyjTbrbfE0kQXpBHYaqFPRZs%0ACTXZOOZfSuEVxcrRJMjlt1J8thnGGmaa3yH6o1yt6hQdTp9JNzzeUwWe78PaAms8%0ARaLcaDXC7fsgByI8j9coKOluQdinYxkBLAHMpo7x6QuOYA3oguZXAUpMXJMJCQD2%0ANd0WL33Dy4XHcPrhw%2BlfCVW7E1sbWO3Ka1ZVeu0FEF0erOKAmfQk2eoMJzR9qKwm%0AkbM2rYq5qrN19a5Rdtxxov4zOuOyvI6b1Uz5PajN1dyXzuKImOXFmiEL7ykC8kxD%0Au8HA90pC2VK3V0mx6tsR%2FH6zMBIg2je51nJ%2F11VCmIgS5%2F%2Bjso1h%2BoUtqHAsWi1%2F%0A5u8lrQzMC3CR3VKLGCWhfF7NpQ82DYLnBh60t%2FE4mY0WX7GDAY8QTMKd4dnmKU6d%0AnKYDzXZR1he1c08%2B6NX%2BpdzJxih8Q%2FEG0PkNNla0MabMDsi7eFMUCjSPOUG99vGW%0APNvMqP%2FEvCmCW7VKmph4NSNHjwkxTTOQD%2FZGX9IpQWZkCxyCIMxAi1hCgu0zKR%2B%2B%0AU%2B7BAgMBAAEwDQYJKoZIhvcNAQELBQADggIBAC8av9I4ezwlmM7ysaJvC1IfCzNN%0AVawIK1U7bfj9Oyjl49Bn%2FyTwbbiQ8j5VjOza4umIwnYp1HP6%2FmlBO%2Bey8WFYPmDM%0AJAspk6sYEQW7MrbZ9QOmq24YAkwMzgK1hDASCKq4GJCzGDym3Zx6fvPnMCPdei2c%0AjgtjzzBmyewE0zcegOHDrFXTaUIfoSbduTbV9zClJ%2FpJDkTklRX1cYBtIox77gpZ%0A1cnIC803gi1rVCHRNdq85ltOTjoF1%2FwVamLy5c6CYlp5IPyVOm0nqbqra47QIwss%0AQSGxn5l52BC1jP1l3eK1mEr64%2BdbMhqX3ZQwhfuiQ9VmdovNN1NarPWfmQia6Spq%0ATfxN%2B3VhloKFUh%2BfgwNzWYLKCMnwBuPVhVGcpclvrj50MsyeiT2IfE8pqWw26g6g%0A0xu85AbqYKePaZ7wPoDddbwCIGr6BBT87Nsu%2BAqtnkH3uw34FDDcjWR1CmNuI1mP%0Aac6d1jdfbkL5ZUJTpTJi0BxWbTGupv8VzufteFRNa7U2h1O6%2BkyPmEpA3heEZcEO%0AHq5zIfW6QTUmBXDfMFzQ9h0764oBVwm29bjZ59bU3RhcAZtL8fi5BapNtoKAy55d%0AP%2F0WahbwNjP68QYVLBeK9Sfo0XxLU0hJP4RJUZSXy9kUuZ8xhAM%2F6PdE04cDq71v%0AZfq6%2FHA3phy85qyj%0A-----END+CERTIFICATE-----&tls_client_key=-----BEGIN+PRIVATE+KEY-----%0AMIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCd4jPcvMlmvT%2Fj%0AEVY%2FSY%2Fq6TRgw60tc9pJe0oAwWYrBWAh3HLy3589dDglpCOH1FngG7INkCWfItRH%0ARQ7Vp6oT18qlLB0WUQCPdro73%2BIPa%2ByA9DBDX1SjiGO8nt2qYR1BFuZQJJCWntdk%0AHMco02623xNJEF6QR2GqhT0WbAk12TjmX0rhFcXK0STI5bdSfLYZxhpmmt8h%2BqNc%0AreoUHU6fSTc83lMFnu%2FD2gJrPEWi3Gg1wu37IAciPI%2FXKCjpbkHYp2MZASwBzKaO%0A8ekLjmAN6ILmVwFKTFyTCQkA9jXdFi99w8uFx3D64cPpXwlVuxNbG1jtymtWVXrt%0ABRBdHqzigJn0JNnqDCc0faisJpGzNq2KuaqzdfWuUXbccaL%2BMzrjsryOm9VM%2BT2o%0AzdXcl87iiJjlxZohC%2B8pAvJMQ7vBwPdKQtlSt1dJserbEfx%2BszASINo3udZyf9dV%0AQpiIEuf%2Fo7KNYfqFLahwLFotf%2BbvJa0MzAtwkd1SixgloXxezaUPNg2C5wYetLfx%0AOJmNFl%2BxgwGPEEzCneHZ5ilOnZymA812UdYXtXNPPujV%2FqXcycYofEPxBtD5DTZW%0AtDGmzA7Iu3hTFAo0jzlBvfbxljzbzKj%2FxLwpglu1SpqYeDUjR48JMU0zkA%2F2Rl%2FS%0AKUFmZAscgiDMQItYQoLtMykfvlPuwQIDAQABAoICAF0M8SX6efS8Owf3ss4v68s2%0AUHFrQgiUzCUcrZvOYAmg7GxogbLUywQsF99PYsVuCN5FVGYb%2B6BTpaqvb7PKUjnJ%0Ap5w7aJU7fkoPXmllZNVT9Rp3UG6Uo8yR2L5VHy2IePZgqbK4KiMrUKSnNVXBbvIG%0AfVZFeIYuG8ilKECrwa3j7V4Q8Y%2FBBkanhreEc8wAxk5gbDTmt%2FVNw7Qep%2BPc9fZ4%0A7z5HhcS9THAwb9aFukDnB%2BAPl7S2xp2N9fSHrb0OB27KEGSvRSF2XP%2FIYWI3MjNg%0AQq3Av3jrkm%2FyFkVj1pELv0eu%2BqdIyTSDlLRZF6ZYUGsUrg%2FPif1i%2BcTxhBhtuNQE%0AlitIfxBiMf3Hyx8GTXWJACKFQY3r2zzDu2Nx7dprzcss3aJhHOtRie%2FBYLe4i5fP%0A88VYuEwKWo1LJVBq4GyZcvhehHxVlJTb3SdfnsicSUzEhuTZl%2F2lhswSZQfhJ34C%0AbFHSgR3QHwpbUJSm5qJ%2F4Uz6MqPyPD5bQKdKzuFpRaMQ3x%2F%2BS28hXtzzvD%2FalGrV%0AcNKEC6Bq8q1Vy%2F4KDqyhq17FVh29FbU%2FTzJSAPzEW8usfydCLox9namPMjOMz5LW%0AgYKR8FHABwyWsDDOTsWQtfZ7Gpjb%2B3RdPyZ%2FiTRME%2FBlu0wvuGgC2YSy315z%2F9I0%0AAE0C3gIjqFoGk3cP4A7VAoIBAQDMf%2B0potwuNQeZRZuTATyxn5qawwZ7b58rHwPw%0ANMtO%2FFNU8Vkc4%2FvXi5guRBCbB%2Fu3nNBieulp3EJ217NfE3AGhe9zvY%2BZT63YcVv2%0AgT6BiBZZ%2ByzPsNbT3vhnOuSOZA7m%2Bz8JzM5QhDR0LRYwnlIFf948GiAg4SAYG2%2BN%0AQWKtZqg559QfW41APBmw9RtZ0hPFBv6pQsvF0t1INc7oVbwX5xNwaKdzMvG2za9d%0AcKpXQrJtpaTF12x59RnmhzML1gzpZ1LWVSSXt1fgMxdzWRa%2FIcV%2BTLdF3%2BikL7st%0ALcrqCZ4INeJalcXSA6mOV61yOwxAzrw1dkZ9qZV0YaW0DzM7AoIBAQDFpPDcHW6I%0APTB3SXFYudCpbh%2FOLXBndSkk80YZ71VJIb8KtWN2KKZbGqnWOeJ17M3Hh5B0xjNT%0Ay5L%2BAXsL%2B0G8deOtWORDPSpWm6Q7OJmJY67vVh9U7dA70VPUGdqljy4a1fAwzZNU%0AmI4gpqwWjCl3c%2F6c%2FR4QY85YgkdAgoLPIc0LJr58MTx8zT4oaY8IXf4Sa2xO5kAa%0Ark4CoDHZw97N6LP8v4fEMZiqQZ8Mqa0UbX8ORlyF3aKGh0QaAAn9j7aJpEwgcjWh%0AaBnGI2b7JTofqJIsSbvvFOnNHt1hnkncm7fVXRvcgguHeJ1pVGiSs5h6aMvJ7IiW%0AmnXBrBzgho4zAoIBAQDC0gC70MaYUrbpgxHia6RJx7Z%2FR9rOD5oAd6zF01X46pPs%0A8Xym9F9BimCxevCi8WkSFJfFqjjiPA8prvbYVek8na5wgh%2Fiu7Dv6Zbl8Vz%2BBArf%0AMFYRivQuplXZ6pZBPPuhe6wjhvTqafia0TU5niqfyKCMe4suJ6rurHyKgsciURFl%0AEQHZ2dtoXZlQJ0ImQOfKpY5I7DS7QtbC61gxqTPnRaIUTe9w5RC3yZ4Ok74EIatg%0AoBSo0kEqsqE5KIYt%2BX8VgPS%2B8iBJVUandaUao73y2paOa0GSlOzKNhrIwL52VjEy%0Auzrod5UdLZYD4G2BzNUwjINrH0Gqh7u1Qy2cq3pvAoIBACbXDhpDkmglljOq9CJa%0Aib3yDUAIP%2FGk3YwMXrdUCC%2BR%2BSgSk1QyEtcOe1fFElLYUWwnoOTB2m5aMC3IfrTR%0AEI8Hn9F%2BCYWJLJvOhEy7B7kvJL6V7xxSi7xlm5Kv7f7hD09owYXlsFFMlYmnF2Rq%0A8O8vlVami1TvOCq%2Bl1%2F%2FBdPMsa3CVGa1ikyATPnGHLypM%2FfMsoEi0HAt1ti%2FQGyq%0ACEvwsgY2YWjV0kmLEcV8Rq4gAnr8qswHzRug02pEnbH9nwKXjfpGV3G7smz0ohUy%0AsKRuDSO07cDDHFsZ%2BKlpYNyAoXTFkmcYC0n5Ev4S%2F2Xs80cC9yFcYU8vVXrU5uvc%0ApW8CggEBAKblNJAibR6wAUHNzHOGs3EDZB%2Bw7h%2B1aFlDyAXJkBVspP5m62AmHEaN%0AJa00jDulaNq1Xp3bQI0DnNtoly0ihjskawSgKXsKI%2BE79eK7kPeYEZ4qN26v6rDg%0AKCMF8357GjjP7QpI79GwhDyXUwFns3W5stgHaBprhjBAQKQNuqCjrYHpem4EZlNT%0A5fwhCP%2FG9BcvHw4cT%2Fvt%2BjG24W5JFGnLNxtsdJIPsqQJQymIqISEdQgGk5%2Fppgla%0AVtFHIUtevjK72l8AAO0VRwrtAriILixPuTKM1nFj%2FlCG5hbFN%2B%2Fxm1CXLyVCumkV%0AImXgKS5UmJB53s9yiomen%2Fn7cUXvrAk%3D%0A-----END+PRIVATE+KEY-----&tls_hostname=example.com&token=abcd1234&use_tls=1
form:
Service:
- 7i6HN3TK9wS159v2gPAZ8A
Version:
- "8"
address:
- example.com
format:
- format
format_version:
- "2"
hostname:
- example.com
message_type:
- classic
name:
- test-syslog
placement:
- waf_debug
port:
- "1234"
tls_ca_cert:
- |-
-----BEGIN CERTIFICATE-----
MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
Wm7DCfrPNGVwFWUQOmsPue9rZBgO
-----END CERTIFICATE-----
tls_client_cert:
- |-
-----BEGIN CERTIFICATE-----
MIIE6DCCAtACCQCzHO2a8qU6KzANBgkqhkiG9w0BAQsFADA2MRIwEAYDVQQDDAls
b2NhbGhvc3QxIDAeBgNVBAoMF0NsaWVudCBDZXJ0aWZpY2F0ZSBEZW1vMB4XDTE5
MTIwNTE3MjY1N1oXDTIwMTIwNDE3MjY1N1owNjESMBAGA1UEAwwJbG9jYWxob3N0
MSAwHgYDVQQKDBdDbGllbnQgQ2VydGlmaWNhdGUgRGVtbzCCAiIwDQYJKoZIhvcN
AQEBBQADggIPADCCAgoCggIBAJ3iM9y8yWa9P+MRVj9Jj+rpNGDDrS1z2kl7SgDB
ZisFYCHccvLfnz10OCWkI4fUWeAbsg2QJZ8i1EdFDtWnqhPXyqUsHRZRAI92ujvf
4g9r7ID0MENfVKOIY7ye3aphHUEW5lAkkJae12QcxyjTbrbfE0kQXpBHYaqFPRZs
CTXZOOZfSuEVxcrRJMjlt1J8thnGGmaa3yH6o1yt6hQdTp9JNzzeUwWe78PaAms8
RaLcaDXC7fsgByI8j9coKOluQdinYxkBLAHMpo7x6QuOYA3oguZXAUpMXJMJCQD2
Nd0WL33Dy4XHcPrhw+lfCVW7E1sbWO3Ka1ZVeu0FEF0erOKAmfQk2eoMJzR9qKwm
kbM2rYq5qrN19a5Rdtxxov4zOuOyvI6b1Uz5PajN1dyXzuKImOXFmiEL7ykC8kxD
u8HA90pC2VK3V0mx6tsR/H6zMBIg2je51nJ/11VCmIgS5/+jso1h+oUtqHAsWi1/
5u8lrQzMC3CR3VKLGCWhfF7NpQ82DYLnBh60t/E4mY0WX7GDAY8QTMKd4dnmKU6d
nKYDzXZR1he1c08+6NX+pdzJxih8Q/EG0PkNNla0MabMDsi7eFMUCjSPOUG99vGW
PNvMqP/EvCmCW7VKmph4NSNHjwkxTTOQD/ZGX9IpQWZkCxyCIMxAi1hCgu0zKR++
U+7BAgMBAAEwDQYJKoZIhvcNAQELBQADggIBAC8av9I4ezwlmM7ysaJvC1IfCzNN
VawIK1U7bfj9Oyjl49Bn/yTwbbiQ8j5VjOza4umIwnYp1HP6/mlBO+ey8WFYPmDM
JAspk6sYEQW7MrbZ9QOmq24YAkwMzgK1hDASCKq4GJCzGDym3Zx6fvPnMCPdei2c
jgtjzzBmyewE0zcegOHDrFXTaUIfoSbduTbV9zClJ/pJDkTklRX1cYBtIox77gpZ
1cnIC803gi1rVCHRNdq85ltOTjoF1/wVamLy5c6CYlp5IPyVOm0nqbqra47QIwss
QSGxn5l52BC1jP1l3eK1mEr64+dbMhqX3ZQwhfuiQ9VmdovNN1NarPWfmQia6Spq
TfxN+3VhloKFUh+fgwNzWYLKCMnwBuPVhVGcpclvrj50MsyeiT2IfE8pqWw26g6g
0xu85AbqYKePaZ7wPoDddbwCIGr6BBT87Nsu+AqtnkH3uw34FDDcjWR1CmNuI1mP
ac6d1jdfbkL5ZUJTpTJi0BxWbTGupv8VzufteFRNa7U2h1O6+kyPmEpA3heEZcEO
Hq5zIfW6QTUmBXDfMFzQ9h0764oBVwm29bjZ59bU3RhcAZtL8fi5BapNtoKAy55d
P/0WahbwNjP68QYVLBeK9Sfo0XxLU0hJP4RJUZSXy9kUuZ8xhAM/6PdE04cDq71v
Zfq6/HA3phy85qyj
-----END CERTIFICATE-----
tls_client_key:
- |-
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCd4jPcvMlmvT/j
EVY/SY/q6TRgw60tc9pJe0oAwWYrBWAh3HLy3589dDglpCOH1FngG7INkCWfItRH
RQ7Vp6oT18qlLB0WUQCPdro73+IPa+yA9DBDX1SjiGO8nt2qYR1BFuZQJJCWntdk
HMco02623xNJEF6QR2GqhT0WbAk12TjmX0rhFcXK0STI5bdSfLYZxhpmmt8h+qNc
reoUHU6fSTc83lMFnu/D2gJrPEWi3Gg1wu37IAciPI/XKCjpbkHYp2MZASwBzKaO
8ekLjmAN6ILmVwFKTFyTCQkA9jXdFi99w8uFx3D64cPpXwlVuxNbG1jtymtWVXrt
BRBdHqzigJn0JNnqDCc0faisJpGzNq2KuaqzdfWuUXbccaL+MzrjsryOm9VM+T2o
zdXcl87iiJjlxZohC+8pAvJMQ7vBwPdKQtlSt1dJserbEfx+szASINo3udZyf9dV
QpiIEuf/o7KNYfqFLahwLFotf+bvJa0MzAtwkd1SixgloXxezaUPNg2C5wYetLfx
OJmNFl+xgwGPEEzCneHZ5ilOnZymA812UdYXtXNPPujV/qXcycYofEPxBtD5DTZW
tDGmzA7Iu3hTFAo0jzlBvfbxljzbzKj/xLwpglu1SpqYeDUjR48JMU0zkA/2Rl/S
KUFmZAscgiDMQItYQoLtMykfvlPuwQIDAQABAoICAF0M8SX6efS8Owf3ss4v68s2
UHFrQgiUzCUcrZvOYAmg7GxogbLUywQsF99PYsVuCN5FVGYb+6BTpaqvb7PKUjnJ
p5w7aJU7fkoPXmllZNVT9Rp3UG6Uo8yR2L5VHy2IePZgqbK4KiMrUKSnNVXBbvIG
fVZFeIYuG8ilKECrwa3j7V4Q8Y/BBkanhreEc8wAxk5gbDTmt/VNw7Qep+Pc9fZ4
7z5HhcS9THAwb9aFukDnB+APl7S2xp2N9fSHrb0OB27KEGSvRSF2XP/IYWI3MjNg
Qq3Av3jrkm/yFkVj1pELv0eu+qdIyTSDlLRZF6ZYUGsUrg/Pif1i+cTxhBhtuNQE
litIfxBiMf3Hyx8GTXWJACKFQY3r2zzDu2Nx7dprzcss3aJhHOtRie/BYLe4i5fP
88VYuEwKWo1LJVBq4GyZcvhehHxVlJTb3SdfnsicSUzEhuTZl/2lhswSZQfhJ34C
bFHSgR3QHwpbUJSm5qJ/4Uz6MqPyPD5bQKdKzuFpRaMQ3x/+S28hXtzzvD/alGrV
cNKEC6Bq8q1Vy/4KDqyhq17FVh29FbU/TzJSAPzEW8usfydCLox9namPMjOMz5LW
gYKR8FHABwyWsDDOTsWQtfZ7Gpjb+3RdPyZ/iTRME/Blu0wvuGgC2YSy315z/9I0
AE0C3gIjqFoGk3cP4A7VAoIBAQDMf+0potwuNQeZRZuTATyxn5qawwZ7b58rHwPw
NMtO/FNU8Vkc4/vXi5guRBCbB/u3nNBieulp3EJ217NfE3AGhe9zvY+ZT63YcVv2
gT6BiBZZ+yzPsNbT3vhnOuSOZA7m+z8JzM5QhDR0LRYwnlIFf948GiAg4SAYG2+N
QWKtZqg559QfW41APBmw9RtZ0hPFBv6pQsvF0t1INc7oVbwX5xNwaKdzMvG2za9d
cKpXQrJtpaTF12x59RnmhzML1gzpZ1LWVSSXt1fgMxdzWRa/IcV+TLdF3+ikL7st
LcrqCZ4INeJalcXSA6mOV61yOwxAzrw1dkZ9qZV0YaW0DzM7AoIBAQDFpPDcHW6I
PTB3SXFYudCpbh/OLXBndSkk80YZ71VJIb8KtWN2KKZbGqnWOeJ17M3Hh5B0xjNT
y5L+AXsL+0G8deOtWORDPSpWm6Q7OJmJY67vVh9U7dA70VPUGdqljy4a1fAwzZNU
mI4gpqwWjCl3c/6c/R4QY85YgkdAgoLPIc0LJr58MTx8zT4oaY8IXf4Sa2xO5kAa
rk4CoDHZw97N6LP8v4fEMZiqQZ8Mqa0UbX8ORlyF3aKGh0QaAAn9j7aJpEwgcjWh
aBnGI2b7JTofqJIsSbvvFOnNHt1hnkncm7fVXRvcgguHeJ1pVGiSs5h6aMvJ7IiW
mnXBrBzgho4zAoIBAQDC0gC70MaYUrbpgxHia6RJx7Z/R9rOD5oAd6zF01X46pPs
8Xym9F9BimCxevCi8WkSFJfFqjjiPA8prvbYVek8na5wgh/iu7Dv6Zbl8Vz+BArf
MFYRivQuplXZ6pZBPPuhe6wjhvTqafia0TU5niqfyKCMe4suJ6rurHyKgsciURFl
EQHZ2dtoXZlQJ0ImQOfKpY5I7DS7QtbC61gxqTPnRaIUTe9w5RC3yZ4Ok74EIatg
oBSo0kEqsqE5KIYt+X8VgPS+8iBJVUandaUao73y2paOa0GSlOzKNhrIwL52VjEy
uzrod5UdLZYD4G2BzNUwjINrH0Gqh7u1Qy2cq3pvAoIBACbXDhpDkmglljOq9CJa
ib3yDUAIP/Gk3YwMXrdUCC+R+SgSk1QyEtcOe1fFElLYUWwnoOTB2m5aMC3IfrTR
EI8Hn9F+CYWJLJvOhEy7B7kvJL6V7xxSi7xlm5Kv7f7hD09owYXlsFFMlYmnF2Rq
8O8vlVami1TvOCq+l1//BdPMsa3CVGa1ikyATPnGHLypM/fMsoEi0HAt1ti/QGyq
CEvwsgY2YWjV0kmLEcV8Rq4gAnr8qswHzRug02pEnbH9nwKXjfpGV3G7smz0ohUy
sKRuDSO07cDDHFsZ+KlpYNyAoXTFkmcYC0n5Ev4S/2Xs80cC9yFcYU8vVXrU5uvc
pW8CggEBAKblNJAibR6wAUHNzHOGs3EDZB+w7h+1aFlDyAXJkBVspP5m62AmHEaN
Ja00jDulaNq1Xp3bQI0DnNtoly0ihjskawSgKXsKI+E79eK7kPeYEZ4qN26v6rDg
KCMF8357GjjP7QpI79GwhDyXUwFns3W5stgHaBprhjBAQKQNuqCjrYHpem4EZlNT
5fwhCP/G9BcvHw4cT/vt+jG24W5JFGnLNxtsdJIPsqQJQymIqISEdQgGk5/ppgla
VtFHIUtevjK72l8AAO0VRwrtAriILixPuTKM1nFj/lCG5hbFN+/xm1CXLyVCumkV
ImXgKS5UmJB53s9yiomen/n7cUXvrAk=
-----END PRIVATE KEY-----
tls_hostname:
- example.com
token:
- abcd1234
use_tls:
- "1"
headers:
Content-Type:
- application/x-www-form-urlencoded
User-Agent:
- FastlyGo/1.3.0 (+github.com/fastly/go-fastly; go1.13.5)
url: https://api.fastly.com/service/7i6HN3TK9wS159v2gPAZ8A/version/8/logging/syslog
method: POST
response:
body: '{"address":"example.com","format":"format","format_version":"2","hostname":"example.com","message_type":"classic","name":"test-syslog","placement":"waf_debug","port":"1234","tls_ca_cert":"-----BEGIN
CERTIFICATE-----\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\nMAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC\nVU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx\nNDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD\nTjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu\nZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j\nV14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj\ngbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA\nFFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE\nCBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS\nBgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE\nBQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju\nWm7DCfrPNGVwFWUQOmsPue9rZBgO\n-----END
CERTIFICATE-----","tls_client_cert":"-----BEGIN CERTIFICATE-----\nMIIE6DCCAtACCQCzHO2a8qU6KzANBgkqhkiG9w0BAQsFADA2MRIwEAYDVQQDDAls\nb2NhbGhvc3QxIDAeBgNVBAoMF0NsaWVudCBDZXJ0aWZpY2F0ZSBEZW1vMB4XDTE5\nMTIwNTE3MjY1N1oXDTIwMTIwNDE3MjY1N1owNjESMBAGA1UEAwwJbG9jYWxob3N0\nMSAwHgYDVQQKDBdDbGllbnQgQ2VydGlmaWNhdGUgRGVtbzCCAiIwDQYJKoZIhvcN\nAQEBBQADggIPADCCAgoCggIBAJ3iM9y8yWa9P+MRVj9Jj+rpNGDDrS1z2kl7SgDB\nZisFYCHccvLfnz10OCWkI4fUWeAbsg2QJZ8i1EdFDtWnqhPXyqUsHRZRAI92ujvf\n4g9r7ID0MENfVKOIY7ye3aphHUEW5lAkkJae12QcxyjTbrbfE0kQXpBHYaqFPRZs\nCTXZOOZfSuEVxcrRJMjlt1J8thnGGmaa3yH6o1yt6hQdTp9JNzzeUwWe78PaAms8\nRaLcaDXC7fsgByI8j9coKOluQdinYxkBLAHMpo7x6QuOYA3oguZXAUpMXJMJCQD2\nNd0WL33Dy4XHcPrhw+lfCVW7E1sbWO3Ka1ZVeu0FEF0erOKAmfQk2eoMJzR9qKwm\nkbM2rYq5qrN19a5Rdtxxov4zOuOyvI6b1Uz5PajN1dyXzuKImOXFmiEL7ykC8kxD\nu8HA90pC2VK3V0mx6tsR/H6zMBIg2je51nJ/11VCmIgS5/+jso1h+oUtqHAsWi1/\n5u8lrQzMC3CR3VKLGCWhfF7NpQ82DYLnBh60t/E4mY0WX7GDAY8QTMKd4dnmKU6d\nnKYDzXZR1he1c08+6NX+pdzJxih8Q/EG0PkNNla0MabMDsi7eFMUCjSPOUG99vGW\nPNvMqP/EvCmCW7VKmph4NSNHjwkxTTOQD/ZGX9IpQWZkCxyCIMxAi1hCgu0zKR++\nU+7BAgMBAAEwDQYJKoZIhvcNAQELBQADggIBAC8av9I4ezwlmM7ysaJvC1IfCzNN\nVawIK1U7bfj9Oyjl49Bn/yTwbbiQ8j5VjOza4umIwnYp1HP6/mlBO+ey8WFYPmDM\nJAspk6sYEQW7MrbZ9QOmq24YAkwMzgK1hDASCKq4GJCzGDym3Zx6fvPnMCPdei2c\njgtjzzBmyewE0zcegOHDrFXTaUIfoSbduTbV9zClJ/pJDkTklRX1cYBtIox77gpZ\n1cnIC803gi1rVCHRNdq85ltOTjoF1/wVamLy5c6CYlp5IPyVOm0nqbqra47QIwss\nQSGxn5l52BC1jP1l3eK1mEr64+dbMhqX3ZQwhfuiQ9VmdovNN1NarPWfmQia6Spq\nTfxN+3VhloKFUh+fgwNzWYLKCMnwBuPVhVGcpclvrj50MsyeiT2IfE8pqWw26g6g\n0xu85AbqYKePaZ7wPoDddbwCIGr6BBT87Nsu+AqtnkH3uw34FDDcjWR1CmNuI1mP\nac6d1jdfbkL5ZUJTpTJi0BxWbTGupv8VzufteFRNa7U2h1O6+kyPmEpA3heEZcEO\nHq5zIfW6QTUmBXDfMFzQ9h0764oBVwm29bjZ59bU3RhcAZtL8fi5BapNtoKAy55d\nP/0WahbwNjP68QYVLBeK9Sfo0XxLU0hJP4RJUZSXy9kUuZ8xhAM/6PdE04cDq71v\nZfq6/HA3phy85qyj\n-----END
CERTIFICATE-----","tls_client_key":"-----BEGIN PRIVATE KEY-----\nMIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCd4jPcvMlmvT/j\nEVY/SY/q6TRgw60tc9pJe0oAwWYrBWAh3HLy3589dDglpCOH1FngG7INkCWfItRH\nRQ7Vp6oT18qlLB0WUQCPdro73+IPa+yA9DBDX1SjiGO8nt2qYR1BFuZQJJCWntdk\nHMco02623xNJEF6QR2GqhT0WbAk12TjmX0rhFcXK0STI5bdSfLYZxhpmmt8h+qNc\nreoUHU6fSTc83lMFnu/D2gJrPEWi3Gg1wu37IAciPI/XKCjpbkHYp2MZASwBzKaO\n8ekLjmAN6ILmVwFKTFyTCQkA9jXdFi99w8uFx3D64cPpXwlVuxNbG1jtymtWVXrt\nBRBdHqzigJn0JNnqDCc0faisJpGzNq2KuaqzdfWuUXbccaL+MzrjsryOm9VM+T2o\nzdXcl87iiJjlxZohC+8pAvJMQ7vBwPdKQtlSt1dJserbEfx+szASINo3udZyf9dV\nQpiIEuf/o7KNYfqFLahwLFotf+bvJa0MzAtwkd1SixgloXxezaUPNg2C5wYetLfx\nOJmNFl+xgwGPEEzCneHZ5ilOnZymA812UdYXtXNPPujV/qXcycYofEPxBtD5DTZW\ntDGmzA7Iu3hTFAo0jzlBvfbxljzbzKj/xLwpglu1SpqYeDUjR48JMU0zkA/2Rl/S\nKUFmZAscgiDMQItYQoLtMykfvlPuwQIDAQABAoICAF0M8SX6efS8Owf3ss4v68s2\nUHFrQgiUzCUcrZvOYAmg7GxogbLUywQsF99PYsVuCN5FVGYb+6BTpaqvb7PKUjnJ\np5w7aJU7fkoPXmllZNVT9Rp3UG6Uo8yR2L5VHy2IePZgqbK4KiMrUKSnNVXBbvIG\nfVZFeIYuG8ilKECrwa3j7V4Q8Y/BBkanhreEc8wAxk5gbDTmt/VNw7Qep+Pc9fZ4\n7z5HhcS9THAwb9aFukDnB+APl7S2xp2N9fSHrb0OB27KEGSvRSF2XP/IYWI3MjNg\nQq3Av3jrkm/yFkVj1pELv0eu+qdIyTSDlLRZF6ZYUGsUrg/Pif1i+cTxhBhtuNQE\nlitIfxBiMf3Hyx8GTXWJACKFQY3r2zzDu2Nx7dprzcss3aJhHOtRie/BYLe4i5fP\n88VYuEwKWo1LJVBq4GyZcvhehHxVlJTb3SdfnsicSUzEhuTZl/2lhswSZQfhJ34C\nbFHSgR3QHwpbUJSm5qJ/4Uz6MqPyPD5bQKdKzuFpRaMQ3x/+S28hXtzzvD/alGrV\ncNKEC6Bq8q1Vy/4KDqyhq17FVh29FbU/TzJSAPzEW8usfydCLox9namPMjOMz5LW\ngYKR8FHABwyWsDDOTsWQtfZ7Gpjb+3RdPyZ/iTRME/Blu0wvuGgC2YSy315z/9I0\nAE0C3gIjqFoGk3cP4A7VAoIBAQDMf+0potwuNQeZRZuTATyxn5qawwZ7b58rHwPw\nNMtO/FNU8Vkc4/vXi5guRBCbB/u3nNBieulp3EJ217NfE3AGhe9zvY+ZT63YcVv2\ngT6BiBZZ+yzPsNbT3vhnOuSOZA7m+z8JzM5QhDR0LRYwnlIFf948GiAg4SAYG2+N\nQWKtZqg559QfW41APBmw9RtZ0hPFBv6pQsvF0t1INc7oVbwX5xNwaKdzMvG2za9d\ncKpXQrJtpaTF12x59RnmhzML1gzpZ1LWVSSXt1fgMxdzWRa/IcV+TLdF3+ikL7st\nLcrqCZ4INeJalcXSA6mOV61yOwxAzrw1dkZ9qZV0YaW0DzM7AoIBAQDFpPDcHW6I\nPTB3SXFYudCpbh/OLXBndSkk80YZ71VJIb8KtWN2KKZbGqnWOeJ17M3Hh5B0xjNT\ny5L+AXsL+0G8deOtWORDPSpWm6Q7OJmJY67vVh9U7dA70VPUGdqljy4a1fAwzZNU\nmI4gpqwWjCl3c/6c/R4QY85YgkdAgoLPIc0LJr58MTx8zT4oaY8IXf4Sa2xO5kAa\nrk4CoDHZw97N6LP8v4fEMZiqQZ8Mqa0UbX8ORlyF3aKGh0QaAAn9j7aJpEwgcjWh\naBnGI2b7JTofqJIsSbvvFOnNHt1hnkncm7fVXRvcgguHeJ1pVGiSs5h6aMvJ7IiW\nmnXBrBzgho4zAoIBAQDC0gC70MaYUrbpgxHia6RJx7Z/R9rOD5oAd6zF01X46pPs\n8Xym9F9BimCxevCi8WkSFJfFqjjiPA8prvbYVek8na5wgh/iu7Dv6Zbl8Vz+BArf\nMFYRivQuplXZ6pZBPPuhe6wjhvTqafia0TU5niqfyKCMe4suJ6rurHyKgsciURFl\nEQHZ2dtoXZlQJ0ImQOfKpY5I7DS7QtbC61gxqTPnRaIUTe9w5RC3yZ4Ok74EIatg\noBSo0kEqsqE5KIYt+X8VgPS+8iBJVUandaUao73y2paOa0GSlOzKNhrIwL52VjEy\nuzrod5UdLZYD4G2BzNUwjINrH0Gqh7u1Qy2cq3pvAoIBACbXDhpDkmglljOq9CJa\nib3yDUAIP/Gk3YwMXrdUCC+R+SgSk1QyEtcOe1fFElLYUWwnoOTB2m5aMC3IfrTR\nEI8Hn9F+CYWJLJvOhEy7B7kvJL6V7xxSi7xlm5Kv7f7hD09owYXlsFFMlYmnF2Rq\n8O8vlVami1TvOCq+l1//BdPMsa3CVGa1ikyATPnGHLypM/fMsoEi0HAt1ti/QGyq\nCEvwsgY2YWjV0kmLEcV8Rq4gAnr8qswHzRug02pEnbH9nwKXjfpGV3G7smz0ohUy\nsKRuDSO07cDDHFsZ+KlpYNyAoXTFkmcYC0n5Ev4S/2Xs80cC9yFcYU8vVXrU5uvc\npW8CggEBAKblNJAibR6wAUHNzHOGs3EDZB+w7h+1aFlDyAXJkBVspP5m62AmHEaN\nJa00jDulaNq1Xp3bQI0DnNtoly0ihjskawSgKXsKI+E79eK7kPeYEZ4qN26v6rDg\nKCMF8357GjjP7QpI79GwhDyXUwFns3W5stgHaBprhjBAQKQNuqCjrYHpem4EZlNT\n5fwhCP/G9BcvHw4cT/vt+jG24W5JFGnLNxtsdJIPsqQJQymIqISEdQgGk5/ppgla\nVtFHIUtevjK72l8AAO0VRwrtAriILixPuTKM1nFj/lCG5hbFN+/xm1CXLyVCumkV\nImXgKS5UmJB53s9yiomen/n7cUXvrAk=\n-----END
PRIVATE KEY-----","tls_hostname":"example.com","token":"abcd1234","use_tls":"1","service_id":"7i6HN3TK9wS159v2gPAZ8A","version":"8","updated_at":"2020-01-03T15:40:39Z","response_condition":"","created_at":"2020-01-03T15:40:39Z","ipv4":null,"deleted_at":null,"public_key":null}'
headers:
Accept-Ranges:
- bytes
- bytes
Cache-Control:
- no-cache
Content-Type:
- application/json
Date:
- Fri, 03 Jan 2020 15:40:39 GMT
Fastly-Ratelimit-Remaining:
- "982"
Fastly-Ratelimit-Reset:
- "1578067200"
Status:
- 200 OK
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
- 1.1 varnish
X-Cache:
- MISS, MISS
X-Cache-Hits:
- 0, 0
X-Served-By:
- cache-control-slwdc9035-CONTROL-SLWDC, cache-lcy19270-LCY
X-Timer:
- S1578066039.269316,VS0,VE531
status: 200 OK
code: 200
duration: ""
| {
"pile_set_name": "Github"
} |
namespace Blamite.Blam.Resources.Models
{
/// <summary>
/// Interface for a class which handles data read from models.
/// </summary>
public interface IModelProcessor : IVertexProcessor
{
/// <summary>
/// Called when the data for a model is about to be read.
/// </summary>
/// <param name="model">The model which will be read.</param>
void BeginModel(IModel model);
/// <summary>
/// Called after the data for a model has been read.
/// </summary>
/// <param name="model">The model which was read.</param>
void EndModel(IModel model);
/// <summary>
/// Called when the vertices for a submesh are about to be read.
/// </summary>
/// <param name="submesh">The submesh whose vertices will be read.</param>
void BeginSubmeshVertices(IModelSubmesh submesh);
/// <summary>
/// Called after the vertices for a submesh have been read.
/// </summary>
/// <param name="submesh">The submesh whose vertices have been read.</param>
void EndSubmeshVertices(IModelSubmesh submesh);
/// <summary>
/// Called when the index buffer for a submesh has been read.
/// </summary>
/// <param name="submesh">The submesh whose index buffer was read.</param>
/// <param name="indices">The vertex indices for the submesh.</param>
/// <param name="baseIndex">The index of the first vertex in the submesh.</param>
void ProcessSubmeshIndices(IModelSubmesh submesh, ushort[] indices, int baseIndex);
}
} | {
"pile_set_name": "Github"
} |
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <stdio.h>
#include "db/dbformat.h"
#include "port/port.h"
#include "util/coding.h"
namespace leveldb {
static uint64_t PackSequenceAndType(uint64_t seq, ValueType t) {
assert(seq <= kMaxSequenceNumber);
assert(t <= kValueTypeForSeek);
return (seq << 8) | t;
}
void AppendInternalKey(std::string* result, const ParsedInternalKey& key) {
result->append(key.user_key.data(), key.user_key.size());
PutFixed64(result, PackSequenceAndType(key.sequence, key.type));
}
std::string ParsedInternalKey::DebugString() const {
char buf[50];
snprintf(buf, sizeof(buf), "' @ %llu : %d",
(unsigned long long) sequence,
int(type));
std::string result = "'";
result += EscapeString(user_key.ToString());
result += buf;
return result;
}
std::string InternalKey::DebugString() const {
std::string result;
ParsedInternalKey parsed;
if (ParseInternalKey(rep_, &parsed)) {
result = parsed.DebugString();
} else {
result = "(bad)";
result.append(EscapeString(rep_));
}
return result;
}
const char* InternalKeyComparator::Name() const {
return "leveldb.InternalKeyComparator";
}
int InternalKeyComparator::Compare(const Slice& akey, const Slice& bkey) const {
// Order by:
// increasing user key (according to user-supplied comparator)
// decreasing sequence number
// decreasing type (though sequence# should be enough to disambiguate)
int r = user_comparator_->Compare(ExtractUserKey(akey), ExtractUserKey(bkey));
if (r == 0) {
const uint64_t anum = DecodeFixed64(akey.data() + akey.size() - 8);
const uint64_t bnum = DecodeFixed64(bkey.data() + bkey.size() - 8);
if (anum > bnum) {
r = -1;
} else if (anum < bnum) {
r = +1;
}
}
return r;
}
void InternalKeyComparator::FindShortestSeparator(
std::string* start,
const Slice& limit) const {
// Attempt to shorten the user portion of the key
Slice user_start = ExtractUserKey(*start);
Slice user_limit = ExtractUserKey(limit);
std::string tmp(user_start.data(), user_start.size());
user_comparator_->FindShortestSeparator(&tmp, user_limit);
if (tmp.size() < user_start.size() &&
user_comparator_->Compare(user_start, tmp) < 0) {
// User key has become shorter physically, but larger logically.
// Tack on the earliest possible number to the shortened user key.
PutFixed64(&tmp, PackSequenceAndType(kMaxSequenceNumber,kValueTypeForSeek));
assert(this->Compare(*start, tmp) < 0);
assert(this->Compare(tmp, limit) < 0);
start->swap(tmp);
}
}
void InternalKeyComparator::FindShortSuccessor(std::string* key) const {
Slice user_key = ExtractUserKey(*key);
std::string tmp(user_key.data(), user_key.size());
user_comparator_->FindShortSuccessor(&tmp);
if (tmp.size() < user_key.size() &&
user_comparator_->Compare(user_key, tmp) < 0) {
// User key has become shorter physically, but larger logically.
// Tack on the earliest possible number to the shortened user key.
PutFixed64(&tmp, PackSequenceAndType(kMaxSequenceNumber,kValueTypeForSeek));
assert(this->Compare(*key, tmp) < 0);
key->swap(tmp);
}
}
const char* InternalFilterPolicy::Name() const {
return user_policy_->Name();
}
void InternalFilterPolicy::CreateFilter(const Slice* keys, int n,
std::string* dst) const {
// We rely on the fact that the code in table.cc does not mind us
// adjusting keys[].
Slice* mkey = const_cast<Slice*>(keys);
for (int i = 0; i < n; i++) {
mkey[i] = ExtractUserKey(keys[i]);
// TODO(sanjay): Suppress dups?
}
user_policy_->CreateFilter(keys, n, dst);
}
bool InternalFilterPolicy::KeyMayMatch(const Slice& key, const Slice& f) const {
return user_policy_->KeyMayMatch(ExtractUserKey(key), f);
}
LookupKey::LookupKey(const Slice& user_key, SequenceNumber s) {
size_t usize = user_key.size();
size_t needed = usize + 13; // A conservative estimate
char* dst;
if (needed <= sizeof(space_)) {
dst = space_;
} else {
dst = new char[needed];
}
start_ = dst;
dst = EncodeVarint32(dst, usize + 8);
kstart_ = dst;
memcpy(dst, user_key.data(), usize);
dst += usize;
EncodeFixed64(dst, PackSequenceAndType(s, kValueTypeForSeek));
dst += 8;
end_ = dst;
}
} // namespace leveldb
| {
"pile_set_name": "Github"
} |
package org.sculptor.simplecqrs.query.serviceapi;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sculptor.framework.accessimpl.mongodb.DbManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
/**
* Spring based test with MongoDB.
*/
@Ignore
@RunWith(org.springframework.test.context.junit4.SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext-test.xml" })
public class InventoryListViewTest extends AbstractJUnit4SpringContextTests implements InventoryListViewTestBase {
@Autowired
private DbManager dbManager;
@Autowired
private InventoryListView inventoryListView;
@Before
public void initTestData() {
}
@Before
public void initDbManagerThreadInstance() throws Exception {
// to be able to do lazy loading of associations inside test class
DbManager.setThreadInstance(dbManager);
}
@After
public void dropDatabase() {
Set<String> names = dbManager.getDB().getCollectionNames();
for (String each : names) {
if (!each.startsWith("system")) {
dbManager.getDB().getCollection(each).drop();
}
}
// dbManager.getDB().dropDatabase();
}
private int countRowsInDBCollection(String name) {
return (int) dbManager.getDBCollection(name).getCount();
}
@Test
@Override
public void testReceive() throws Exception {
}
}
| {
"pile_set_name": "Github"
} |
using System;
using CoreGraphics;
using System.IO;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using AVFoundation;
using Foundation;
using UIKit;
/*
* AVFoundation Reference: http://red-glasses.com/index.php/tutorials/ios4-take-photos-with-live-video-preview-using-avfoundation/
* Additional Camera Settings Reference: http://stackoverflow.com/questions/4550271/avfoundation-images-coming-in-unusably-dark
* Custom Renderers: http://blog.xamarin.com/using-custom-uiviewcontrollers-in-xamarin.forms-on-ios/
*/
[assembly:ExportRenderer(typeof(Moments.CameraPage), typeof(Moments.iOS.CameraPage))]
namespace Moments.iOS
{
public class CameraPage : PageRenderer
{
AVCaptureSession captureSession;
AVCaptureDeviceInput captureDeviceInput;
UIButton toggleCameraButton;
UIButton toggleFlashButton;
UIView liveCameraStream;
AVCaptureStillImageOutput stillImageOutput;
UIButton takePhotoButton;
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
SetupUserInterface ();
SetupEventHandlers ();
AuthorizeCameraUse ();
SetupLiveCameraStream ();
}
public override void ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
}
public async void AuthorizeCameraUse ()
{
var authorizationStatus = AVCaptureDevice.GetAuthorizationStatus (AVMediaType.Video);
if (authorizationStatus != AVAuthorizationStatus.Authorized) {
await AVCaptureDevice.RequestAccessForMediaTypeAsync (AVMediaType.Video);
}
}
public void SetupLiveCameraStream ()
{
captureSession = new AVCaptureSession ();
var viewLayer = liveCameraStream.Layer;
var videoPreviewLayer = new AVCaptureVideoPreviewLayer (captureSession) {
Frame = liveCameraStream.Bounds
};
liveCameraStream.Layer.AddSublayer (videoPreviewLayer);
var captureDevice = AVCaptureDevice.DefaultDeviceWithMediaType (AVMediaType.Video);
ConfigureCameraForDevice (captureDevice);
captureDeviceInput = AVCaptureDeviceInput.FromDevice (captureDevice);
var dictionary = new NSMutableDictionary();
dictionary[AVVideo.CodecKey] = new NSNumber((int) AVVideoCodec.JPEG);
stillImageOutput = new AVCaptureStillImageOutput () {
OutputSettings = new NSDictionary ()
};
captureSession.AddOutput (stillImageOutput);
captureSession.AddInput (captureDeviceInput);
captureSession.StartRunning ();
}
public async void CapturePhoto ()
{
var videoConnection = stillImageOutput.ConnectionFromMediaType (AVMediaType.Video);
var sampleBuffer = await stillImageOutput.CaptureStillImageTaskAsync (videoConnection);
// var jpegImageAsBytes = AVCaptureStillImageOutput.JpegStillToNSData (sampleBuffer).ToArray ();
var jpegImageAsNsData = AVCaptureStillImageOutput.JpegStillToNSData (sampleBuffer);
// var image = new UIImage (jpegImageAsNsData);
// var image2 = new UIImage (image.CGImage, image.CurrentScale, UIImageOrientation.UpMirrored);
// var data = image2.AsJPEG ().ToArray ();
// SendPhoto (data);
SendPhoto (jpegImageAsNsData.ToArray ());
}
public void ToggleFrontBackCamera ()
{
var devicePosition = captureDeviceInput.Device.Position;
if (devicePosition == AVCaptureDevicePosition.Front) {
devicePosition = AVCaptureDevicePosition.Back;
} else {
devicePosition = AVCaptureDevicePosition.Front;
}
var device = GetCameraForOrientation (devicePosition);
ConfigureCameraForDevice (device);
captureSession.BeginConfiguration ();
captureSession.RemoveInput (captureDeviceInput);
captureDeviceInput = AVCaptureDeviceInput.FromDevice (device);
captureSession.AddInput (captureDeviceInput);
captureSession.CommitConfiguration ();
}
public void ConfigureCameraForDevice (AVCaptureDevice device)
{
var error = new NSError ();
if (device.IsFocusModeSupported (AVCaptureFocusMode.ContinuousAutoFocus)) {
device.LockForConfiguration (out error);
device.FocusMode = AVCaptureFocusMode.ContinuousAutoFocus;
device.UnlockForConfiguration ();
} else if (device.IsExposureModeSupported (AVCaptureExposureMode.ContinuousAutoExposure)) {
device.LockForConfiguration (out error);
device.ExposureMode = AVCaptureExposureMode.ContinuousAutoExposure;
device.UnlockForConfiguration ();
} else if (device.IsWhiteBalanceModeSupported (AVCaptureWhiteBalanceMode.ContinuousAutoWhiteBalance)) {
device.LockForConfiguration (out error);
device.WhiteBalanceMode = AVCaptureWhiteBalanceMode.ContinuousAutoWhiteBalance;
device.UnlockForConfiguration ();
}
}
public void ToggleFlash ()
{
var device = captureDeviceInput.Device;
var error = new NSError ();
if (device.HasFlash) {
if (device.FlashMode == AVCaptureFlashMode.On) {
device.LockForConfiguration (out error);
device.FlashMode = AVCaptureFlashMode.Off;
device.UnlockForConfiguration ();
toggleFlashButton.SetBackgroundImage (UIImage.FromFile ("NoFlashButton.png"), UIControlState.Normal);
} else {
device.LockForConfiguration (out error);
device.FlashMode = AVCaptureFlashMode.On;
device.UnlockForConfiguration ();
toggleFlashButton.SetBackgroundImage (UIImage.FromFile ("FlashButton.png"), UIControlState.Normal);
}
}
}
public AVCaptureDevice GetCameraForOrientation (AVCaptureDevicePosition orientation)
{
var devices = AVCaptureDevice.DevicesWithMediaType (AVMediaType.Video);
foreach (var device in devices) {
if (device.Position == orientation) {
return device;
}
}
return null;
}
private void SetupUserInterface ()
{
var centerButtonX = View.Bounds.GetMidX () - 35f;
var topLeftX = View.Bounds.X + 25;
var topRightX = View.Bounds.Right - 65;
var bottomButtonY = View.Bounds.Bottom - 85;
var topButtonY = View.Bounds.Top + 15;
var buttonWidth = 70;
var buttonHeight = 70;
liveCameraStream = new UIView () {
Frame = new CGRect (0f, 0f, 320f, View.Bounds.Height)
};
takePhotoButton = new UIButton () {
Frame = new CGRect (centerButtonX, bottomButtonY, buttonWidth, buttonHeight)
};
takePhotoButton.SetBackgroundImage (UIImage.FromFile ("TakePhotoButton.png"), UIControlState.Normal);
toggleCameraButton = new UIButton () {
Frame = new CGRect (topRightX, topButtonY + 5, 35, 26)
};
toggleCameraButton.SetBackgroundImage (UIImage.FromFile ("ToggleCameraButton.png"), UIControlState.Normal);
toggleFlashButton = new UIButton () {
Frame = new CGRect (topLeftX, topButtonY, 37, 37)
};
toggleFlashButton.SetBackgroundImage (UIImage.FromFile ("NoFlashButton.png"), UIControlState.Normal);
View.Add (liveCameraStream);
View.Add (takePhotoButton);
View.Add (toggleCameraButton);
View.Add (toggleFlashButton);
}
private void SetupEventHandlers ()
{
takePhotoButton.TouchUpInside += (object sender, EventArgs e) => {
CapturePhoto ();
};
toggleCameraButton.TouchUpInside += (object sender, EventArgs e) => {
ToggleFrontBackCamera ();
};
toggleFlashButton.TouchUpInside += (object sender, EventArgs e) => {
ToggleFlash ();
};
}
public async void SendPhoto (byte[] image)
{
var navigationPage = new NavigationPage (new DrawMomentPage (image)) {
BarBackgroundColor = Colors.NavigationBarColor,
BarTextColor = Colors.NavigationBarTextColor
};
await App.Current.MainPage.Navigation.PushModalAsync (navigationPage, false);
}
}
} | {
"pile_set_name": "Github"
} |
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef @KWSYS_NAMESPACE@_Configure_hxx
#define @KWSYS_NAMESPACE@_Configure_hxx
/* Include C configuration. */
#include <@KWSYS_NAMESPACE@/Configure.h>
/* Whether ANSI C++ stream headers are to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
/* Whether ANSI C++ streams are in std namespace. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
/* Whether ANSI C++ <sstream> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_SSTREAM @KWSYS_IOS_USE_SSTREAM@
/* Whether old C++ <strstream.h> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H @KWSYS_IOS_USE_STRSTREAM_H@
/* Whether old C++ <strstrea.h> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@
/* Whether C++ streams support the ios::binary openmode. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@
/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@
/* Whether the STL string has operator<< for ostream. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM @KWSYS_STL_STRING_HAVE_OSTREAM@
/* Whether the STL string has operator>> for istream. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM @KWSYS_STL_STRING_HAVE_ISTREAM@
/* Whether the STL string has operator!= for char*. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR @KWSYS_STL_STRING_HAVE_NEQ_CHAR@
/* Define the stl namespace macro. */
#if @KWSYS_NAMESPACE@_STL_HAVE_STD
# define @KWSYS_NAMESPACE@_stl std
#else
# define @KWSYS_NAMESPACE@_stl
#endif
/* Define the ios namespace macro. */
#if @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define @KWSYS_NAMESPACE@_ios_namespace std
#else
# define @KWSYS_NAMESPACE@_ios_namespace
#endif
#if @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios_namespace
#else
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios
#endif
/* Define the ios::binary openmode macro. */
#if @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define @KWSYS_NAMESPACE@_ios_binary @KWSYS_NAMESPACE@_ios::ios::binary
#else
# define @KWSYS_NAMESPACE@_ios_binary 0
#endif
/* Whether the cstddef header is available. */
#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@
/* Whether the compiler supports null template arguments. */
#define @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@
/* Define the null template arguments macro. */
#if @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS
# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS <>
#else
# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
#endif
/* Whether the compiler supports member templates. */
#define @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES @KWSYS_CXX_HAS_MEMBER_TEMPLATES@
/* Whether the compiler supports argument dependent lookup. */
#define @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@
/* Whether the compiler supports standard full specialization syntax. */
#define @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION @KWSYS_CXX_HAS_FULL_SPECIALIZATION@
/* Define the specialization definition macro. */
#if @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
#else
# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
#endif
/* Define typename keyword macro for use in declarations. */
#if defined(_MSC_VER) && _MSC_VER < 1300
# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
#else
# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME typename
#endif
/* Whether the stl has iterator_traits. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS @KWSYS_STL_HAS_ITERATOR_TRAITS@
/* Whether the stl has iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY @KWSYS_STL_HAS_ITERATOR_CATEGORY@
/* Whether the stl has __iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY @KWSYS_STL_HAS___ITERATOR_CATEGORY@
/* Whether the stl allocator is the standard template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@
/* Whether the stl allocator is not a template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@
/* Whether the stl allocator has rebind. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
/* Whether the stl allocator has a size argument for max_size. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
/* Whether the stl containers support allocator objects. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_STL_HAS_ALLOCATOR_OBJECTS@
/* Whether struct stat has the st_mtim member for high resolution times. */
#define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
/* If building a C++ file in kwsys itself, give the source file
access to the macros without a configured namespace. */
#if defined(KWSYS_NAMESPACE)
# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
# define kwsys @KWSYS_NAMESPACE@
# define kwsys_ios_binary @KWSYS_NAMESPACE@_ios_binary
# endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# define KWSYS_IOS_HAVE_BINARY @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
# define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM
# define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR
# define KWSYS_CXX_NULL_TEMPLATE_ARGS @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
# define KWSYS_CXX_HAS_MEMBER_TEMPLATES @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
# define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
# define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
# define KWSYS_STL_HAS_ITERATOR_TRAITS @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
# define KWSYS_STL_HAS_ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
# define KWSYS_STL_HAS___ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
# define KWSYS_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
#endif
#endif
| {
"pile_set_name": "Github"
} |
package tech.linjiang.pandora.ui.item;
/**
* Created by linjiang on 05/06/2018.
*/
public class DBItem extends NameItem {
public int key;
public DBItem(String data, int key) {
super(data);
this.key = key;
}
}
| {
"pile_set_name": "Github"
} |
package matchers_test
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/matchers"
)
type kungFuActor interface {
DrunkenMaster() bool
}
type jackie struct {
name string
}
func (j *jackie) DrunkenMaster() bool {
return true
}
var _ = Describe("ReceiveMatcher", func() {
Context("with no argument", func() {
Context("for a buffered channel", func() {
It("should succeed", func() {
channel := make(chan bool, 1)
Ω(channel).ShouldNot(Receive())
channel <- true
Ω(channel).Should(Receive())
})
})
Context("for an unbuffered channel", func() {
It("should succeed (eventually)", func() {
channel := make(chan bool)
Ω(channel).ShouldNot(Receive())
go func() {
time.Sleep(10 * time.Millisecond)
channel <- true
}()
Eventually(channel).Should(Receive())
})
})
})
Context("with a pointer argument", func() {
Context("of the correct type", func() {
It("should write the value received on the channel to the pointer", func() {
channel := make(chan int, 1)
var value int
Ω(channel).ShouldNot(Receive(&value))
Ω(value).Should(BeZero())
channel <- 17
Ω(channel).Should(Receive(&value))
Ω(value).Should(Equal(17))
})
})
Context("to various types of objects", func() {
It("should work", func() {
//channels of strings
stringChan := make(chan string, 1)
stringChan <- "foo"
var s string
Ω(stringChan).Should(Receive(&s))
Ω(s).Should(Equal("foo"))
//channels of slices
sliceChan := make(chan []bool, 1)
sliceChan <- []bool{true, true, false}
var sl []bool
Ω(sliceChan).Should(Receive(&sl))
Ω(sl).Should(Equal([]bool{true, true, false}))
//channels of channels
chanChan := make(chan chan bool, 1)
c := make(chan bool)
chanChan <- c
var receivedC chan bool
Ω(chanChan).Should(Receive(&receivedC))
Ω(receivedC).Should(Equal(c))
//channels of interfaces
jackieChan := make(chan kungFuActor, 1)
aJackie := &jackie{name: "Jackie Chan"}
jackieChan <- aJackie
var theJackie kungFuActor
Ω(jackieChan).Should(Receive(&theJackie))
Ω(theJackie).Should(Equal(aJackie))
})
})
Context("of the wrong type", func() {
It("should error", func() {
channel := make(chan int)
var incorrectType bool
success, err := (&ReceiveMatcher{Arg: &incorrectType}).Match(channel)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
var notAPointer int
success, err = (&ReceiveMatcher{Arg: notAPointer}).Match(channel)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
})
})
})
Context("with a matcher", func() {
It("should defer to the underlying matcher", func() {
intChannel := make(chan int, 1)
intChannel <- 3
Ω(intChannel).Should(Receive(Equal(3)))
intChannel <- 2
Ω(intChannel).ShouldNot(Receive(Equal(3)))
stringChannel := make(chan []string, 1)
stringChannel <- []string{"foo", "bar", "baz"}
Ω(stringChannel).Should(Receive(ContainElement(ContainSubstring("fo"))))
stringChannel <- []string{"foo", "bar", "baz"}
Ω(stringChannel).ShouldNot(Receive(ContainElement(ContainSubstring("archipelago"))))
})
It("should defer to the underlying matcher for the message", func() {
matcher := Receive(Equal(3))
channel := make(chan int, 1)
channel <- 2
matcher.Match(channel)
Ω(matcher.FailureMessage(channel)).Should(MatchRegexp(`Expected\s+<int>: 2\s+to equal\s+<int>: 3`))
channel <- 3
matcher.Match(channel)
Ω(matcher.NegatedFailureMessage(channel)).Should(MatchRegexp(`Expected\s+<int>: 3\s+not to equal\s+<int>: 3`))
})
It("should work just fine with Eventually", func() {
stringChannel := make(chan string)
go func() {
time.Sleep(5 * time.Millisecond)
stringChannel <- "A"
time.Sleep(5 * time.Millisecond)
stringChannel <- "B"
}()
Eventually(stringChannel).Should(Receive(Equal("B")))
})
Context("if the matcher errors", func() {
It("should error", func() {
channel := make(chan int, 1)
channel <- 3
success, err := (&ReceiveMatcher{Arg: ContainSubstring("three")}).Match(channel)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
})
})
Context("if nothing is received", func() {
It("should fail", func() {
channel := make(chan int, 1)
success, err := (&ReceiveMatcher{Arg: Equal(1)}).Match(channel)
Ω(success).Should(BeFalse())
Ω(err).ShouldNot(HaveOccurred())
})
})
})
Context("When actual is a *closed* channel", func() {
Context("for a buffered channel", func() {
It("should work until it hits the end of the buffer", func() {
channel := make(chan bool, 1)
channel <- true
close(channel)
Ω(channel).Should(Receive())
Ω(channel).ShouldNot(Receive())
})
})
Context("for an unbuffered channel", func() {
It("should always fail", func() {
channel := make(chan bool)
close(channel)
Ω(channel).ShouldNot(Receive())
})
})
})
Context("When actual is a send-only channel", func() {
It("should error", func() {
channel := make(chan bool)
var writerChannel chan<- bool
writerChannel = channel
success, err := (&ReceiveMatcher{}).Match(writerChannel)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
})
})
Context("when acutal is a non-channel", func() {
It("should error", func() {
var nilChannel chan bool
success, err := (&ReceiveMatcher{}).Match(nilChannel)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
success, err = (&ReceiveMatcher{}).Match(nil)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
success, err = (&ReceiveMatcher{}).Match(3)
Ω(success).Should(BeFalse())
Ω(err).Should(HaveOccurred())
})
})
Describe("when used with eventually and a custom matcher", func() {
It("should return the matcher's error when a failing value is received on the channel, instead of the must receive something failure", func() {
failures := InterceptGomegaFailures(func() {
c := make(chan string, 0)
Eventually(c, 0.01).Should(Receive(Equal("hello")))
})
Ω(failures[0]).Should(ContainSubstring("When passed a matcher, ReceiveMatcher's channel *must* receive something."))
failures = InterceptGomegaFailures(func() {
c := make(chan string, 1)
c <- "hi"
Eventually(c, 0.01).Should(Receive(Equal("hello")))
})
Ω(failures[0]).Should(ContainSubstring("<string>: hello"))
})
})
Describe("Bailing early", func() {
It("should bail early when passed a closed channel", func() {
c := make(chan bool)
close(c)
t := time.Now()
failures := InterceptGomegaFailures(func() {
Eventually(c).Should(Receive())
})
Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
Ω(failures).Should(HaveLen(1))
})
It("should bail early when passed a non-channel", func() {
t := time.Now()
failures := InterceptGomegaFailures(func() {
Eventually(3).Should(Receive())
})
Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
Ω(failures).Should(HaveLen(1))
})
})
})
| {
"pile_set_name": "Github"
} |
import React, { FunctionComponent } from 'react';
import getClassName from '../../helpers/getClassName';
import classNames from '../../lib/classNames';
import Spinner24 from '@vkontakte/icons/dist/24/spinner';
import Spinner32 from '@vkontakte/icons/dist/32/spinner';
import Spinner44 from '@vkontakte/icons/dist/44/spinner';
import Spinner16 from '@vkontakte/icons/dist/16/spinner';
import usePlatform from '../../hooks/usePlatform';
export interface SpinnerProps extends React.HTMLAttributes<HTMLDivElement> {
size?: 'small' | 'regular' | 'large' | 'medium';
}
const svgSpinner = (size: SpinnerProps['size']): React.ReactElement => {
switch (size) {
case 'large':
return <Spinner44 className="Spinner__self" />;
case 'medium':
return <Spinner32 className="Spinner__self" />;
case 'small':
return <Spinner16 className="Spinner__self" />;
default:
return <Spinner24 className="Spinner__self" />;
}
};
const Spinner: FunctionComponent<SpinnerProps> = ({ className, size, ...restProps }: SpinnerProps) => {
const platform = usePlatform();
return (
<div {...restProps} className={classNames(getClassName('Spinner', platform), className)}>
{svgSpinner(size)}
</div>
);
};
Spinner.defaultProps = {
size: 'regular',
};
export default React.memo(Spinner);
| {
"pile_set_name": "Github"
} |
require 'test_helper'
class CategoriesControllerTest < ActionController::TestCase
def test_index
get :index
assert_template 'index'
end
def test_show
get :show, :id => Category.first
assert_template 'show'
end
def test_new
get :new
assert_template 'new'
end
def test_create_invalid
Category.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
def test_create_valid
Category.any_instance.stubs(:valid?).returns(true)
post :create
assert_redirected_to category_url(assigns(:category))
end
def test_edit
get :edit, :id => Category.first
assert_template 'edit'
end
def test_update_invalid
Category.any_instance.stubs(:valid?).returns(false)
put :update, :id => Category.first
assert_template 'edit'
end
def test_update_valid
Category.any_instance.stubs(:valid?).returns(true)
put :update, :id => Category.first
assert_redirected_to category_url(assigns(:category))
end
def test_destroy
category = Category.first
delete :destroy, :id => category
assert_redirected_to categories_url
assert !Category.exists?(category.id)
end
end
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "7.JPG",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
// Copyright 2020 Google LLC
//
// 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.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.13.0
// source: google/ads/googleads/v3/services/customer_client_link_service.proto
package services
import (
context "context"
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto"
resources "google.golang.org/genproto/googleapis/ads/googleads/v3/resources"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// Request message for [CustomerClientLinkService.GetCustomerClientLink][google.ads.googleads.v3.services.CustomerClientLinkService.GetCustomerClientLink].
type GetCustomerClientLinkRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required. The resource name of the customer client link to fetch.
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
}
func (x *GetCustomerClientLinkRequest) Reset() {
*x = GetCustomerClientLinkRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCustomerClientLinkRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCustomerClientLinkRequest) ProtoMessage() {}
func (x *GetCustomerClientLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCustomerClientLinkRequest.ProtoReflect.Descriptor instead.
func (*GetCustomerClientLinkRequest) Descriptor() ([]byte, []int) {
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP(), []int{0}
}
func (x *GetCustomerClientLinkRequest) GetResourceName() string {
if x != nil {
return x.ResourceName
}
return ""
}
// Request message for [CustomerClientLinkService.MutateCustomerClientLink][google.ads.googleads.v3.services.CustomerClientLinkService.MutateCustomerClientLink].
type MutateCustomerClientLinkRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required. The ID of the customer whose customer link are being modified.
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
// Required. The operation to perform on the individual CustomerClientLink.
Operation *CustomerClientLinkOperation `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"`
}
func (x *MutateCustomerClientLinkRequest) Reset() {
*x = MutateCustomerClientLinkRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MutateCustomerClientLinkRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MutateCustomerClientLinkRequest) ProtoMessage() {}
func (x *MutateCustomerClientLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MutateCustomerClientLinkRequest.ProtoReflect.Descriptor instead.
func (*MutateCustomerClientLinkRequest) Descriptor() ([]byte, []int) {
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP(), []int{1}
}
func (x *MutateCustomerClientLinkRequest) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *MutateCustomerClientLinkRequest) GetOperation() *CustomerClientLinkOperation {
if x != nil {
return x.Operation
}
return nil
}
// A single operation (create, update) on a CustomerClientLink.
type CustomerClientLinkOperation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// FieldMask that determines which resource fields are modified in an update.
UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,4,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
// The mutate operation.
//
// Types that are assignable to Operation:
// *CustomerClientLinkOperation_Create
// *CustomerClientLinkOperation_Update
Operation isCustomerClientLinkOperation_Operation `protobuf_oneof:"operation"`
}
func (x *CustomerClientLinkOperation) Reset() {
*x = CustomerClientLinkOperation{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CustomerClientLinkOperation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CustomerClientLinkOperation) ProtoMessage() {}
func (x *CustomerClientLinkOperation) ProtoReflect() protoreflect.Message {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CustomerClientLinkOperation.ProtoReflect.Descriptor instead.
func (*CustomerClientLinkOperation) Descriptor() ([]byte, []int) {
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP(), []int{2}
}
func (x *CustomerClientLinkOperation) GetUpdateMask() *fieldmaskpb.FieldMask {
if x != nil {
return x.UpdateMask
}
return nil
}
func (m *CustomerClientLinkOperation) GetOperation() isCustomerClientLinkOperation_Operation {
if m != nil {
return m.Operation
}
return nil
}
func (x *CustomerClientLinkOperation) GetCreate() *resources.CustomerClientLink {
if x, ok := x.GetOperation().(*CustomerClientLinkOperation_Create); ok {
return x.Create
}
return nil
}
func (x *CustomerClientLinkOperation) GetUpdate() *resources.CustomerClientLink {
if x, ok := x.GetOperation().(*CustomerClientLinkOperation_Update); ok {
return x.Update
}
return nil
}
type isCustomerClientLinkOperation_Operation interface {
isCustomerClientLinkOperation_Operation()
}
type CustomerClientLinkOperation_Create struct {
// Create operation: No resource name is expected for the new link.
Create *resources.CustomerClientLink `protobuf:"bytes,1,opt,name=create,proto3,oneof"`
}
type CustomerClientLinkOperation_Update struct {
// Update operation: The link is expected to have a valid resource name.
Update *resources.CustomerClientLink `protobuf:"bytes,2,opt,name=update,proto3,oneof"`
}
func (*CustomerClientLinkOperation_Create) isCustomerClientLinkOperation_Operation() {}
func (*CustomerClientLinkOperation_Update) isCustomerClientLinkOperation_Operation() {}
// Response message for a CustomerClientLink mutate.
type MutateCustomerClientLinkResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// A result that identifies the resource affected by the mutate request.
Result *MutateCustomerClientLinkResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *MutateCustomerClientLinkResponse) Reset() {
*x = MutateCustomerClientLinkResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MutateCustomerClientLinkResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MutateCustomerClientLinkResponse) ProtoMessage() {}
func (x *MutateCustomerClientLinkResponse) ProtoReflect() protoreflect.Message {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MutateCustomerClientLinkResponse.ProtoReflect.Descriptor instead.
func (*MutateCustomerClientLinkResponse) Descriptor() ([]byte, []int) {
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP(), []int{3}
}
func (x *MutateCustomerClientLinkResponse) GetResult() *MutateCustomerClientLinkResult {
if x != nil {
return x.Result
}
return nil
}
// The result for a single customer client link mutate.
type MutateCustomerClientLinkResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Returned for successful operations.
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
}
func (x *MutateCustomerClientLinkResult) Reset() {
*x = MutateCustomerClientLinkResult{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MutateCustomerClientLinkResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MutateCustomerClientLinkResult) ProtoMessage() {}
func (x *MutateCustomerClientLinkResult) ProtoReflect() protoreflect.Message {
mi := &file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MutateCustomerClientLinkResult.ProtoReflect.Descriptor instead.
func (*MutateCustomerClientLinkResult) Descriptor() ([]byte, []int) {
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP(), []int{4}
}
func (x *MutateCustomerClientLinkResult) GetResourceName() string {
if x != nil {
return x.ResourceName
}
return ""
}
var File_google_ads_googleads_v3_services_customer_client_link_service_proto protoreflect.FileDescriptor
var file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDesc = []byte{
0x0a, 0x43, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2f, 0x76, 0x33, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x69, 0x65,
0x6e, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64,
0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x3c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2f, 0x76, 0x33,
0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62,
0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x78, 0x0a, 0x1c, 0x47, 0x65,
0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c,
0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x58, 0x0a, 0x0d, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x33, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x2d, 0x0a, 0x2b, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65,
0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x1f, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43,
0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e,
0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74,
0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0,
0x41, 0x02, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x60,
0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x3d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x89, 0x02, 0x0a, 0x1b, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18,
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73,
0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x4f, 0x0a,
0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x73, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x4c, 0x69, 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x06, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x4f,
0x0a, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x73, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42,
0x0b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7c, 0x0a, 0x20,
0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x58, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x40, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x73, 0x2e, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x45, 0x0a, 0x1e, 0x4d, 0x75,
0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65,
0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x23, 0x0a, 0x0d,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d,
0x65, 0x32, 0x99, 0x04, 0x0a, 0x19, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0xdd, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x3e, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73,
0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74,
0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69,
0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73,
0x2e, 0x76, 0x33, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x43, 0x75,
0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b,
0x22, 0x4d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, 0x76, 0x33, 0x2f, 0x7b, 0x72,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x63, 0x75, 0x73,
0x74, 0x6f, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65,
0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0xda,
0x41, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0xfe, 0x01, 0x0a, 0x18, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x41, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e,
0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x42, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0x2e, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65,
0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x5b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3d, 0x22, 0x38, 0x2f, 0x76, 0x33,
0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x63, 0x75, 0x73, 0x74,
0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x3d, 0x2a, 0x7d, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x3a, 0x6d,
0x75, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0xda, 0x41, 0x15, 0x63, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x2c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x1a, 0x1b, 0xca, 0x41, 0x18, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x42, 0x85, 0x02,
0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x64, 0x73,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x76, 0x33, 0x2e, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0x1e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72,
0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x48, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x61, 0x64, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2f, 0x76, 0x33,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x73, 0xa2, 0x02, 0x03, 0x47, 0x41, 0x41, 0xaa, 0x02, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x41, 0x64, 0x73, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x41, 0x64, 0x73, 0x2e,
0x56, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0xca, 0x02, 0x20, 0x47, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x5c, 0x41, 0x64, 0x73, 0x5c, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x41,
0x64, 0x73, 0x5c, 0x56, 0x33, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0xea, 0x02,
0x24, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x3a, 0x3a, 0x41, 0x64, 0x73, 0x3a, 0x3a, 0x47, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x41, 0x64, 0x73, 0x3a, 0x3a, 0x56, 0x33, 0x3a, 0x3a, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescOnce sync.Once
file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescData = file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDesc
)
func file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescGZIP() []byte {
file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescOnce.Do(func() {
file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescData)
})
return file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDescData
}
var file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_google_ads_googleads_v3_services_customer_client_link_service_proto_goTypes = []interface{}{
(*GetCustomerClientLinkRequest)(nil), // 0: google.ads.googleads.v3.services.GetCustomerClientLinkRequest
(*MutateCustomerClientLinkRequest)(nil), // 1: google.ads.googleads.v3.services.MutateCustomerClientLinkRequest
(*CustomerClientLinkOperation)(nil), // 2: google.ads.googleads.v3.services.CustomerClientLinkOperation
(*MutateCustomerClientLinkResponse)(nil), // 3: google.ads.googleads.v3.services.MutateCustomerClientLinkResponse
(*MutateCustomerClientLinkResult)(nil), // 4: google.ads.googleads.v3.services.MutateCustomerClientLinkResult
(*fieldmaskpb.FieldMask)(nil), // 5: google.protobuf.FieldMask
(*resources.CustomerClientLink)(nil), // 6: google.ads.googleads.v3.resources.CustomerClientLink
}
var file_google_ads_googleads_v3_services_customer_client_link_service_proto_depIdxs = []int32{
2, // 0: google.ads.googleads.v3.services.MutateCustomerClientLinkRequest.operation:type_name -> google.ads.googleads.v3.services.CustomerClientLinkOperation
5, // 1: google.ads.googleads.v3.services.CustomerClientLinkOperation.update_mask:type_name -> google.protobuf.FieldMask
6, // 2: google.ads.googleads.v3.services.CustomerClientLinkOperation.create:type_name -> google.ads.googleads.v3.resources.CustomerClientLink
6, // 3: google.ads.googleads.v3.services.CustomerClientLinkOperation.update:type_name -> google.ads.googleads.v3.resources.CustomerClientLink
4, // 4: google.ads.googleads.v3.services.MutateCustomerClientLinkResponse.result:type_name -> google.ads.googleads.v3.services.MutateCustomerClientLinkResult
0, // 5: google.ads.googleads.v3.services.CustomerClientLinkService.GetCustomerClientLink:input_type -> google.ads.googleads.v3.services.GetCustomerClientLinkRequest
1, // 6: google.ads.googleads.v3.services.CustomerClientLinkService.MutateCustomerClientLink:input_type -> google.ads.googleads.v3.services.MutateCustomerClientLinkRequest
6, // 7: google.ads.googleads.v3.services.CustomerClientLinkService.GetCustomerClientLink:output_type -> google.ads.googleads.v3.resources.CustomerClientLink
3, // 8: google.ads.googleads.v3.services.CustomerClientLinkService.MutateCustomerClientLink:output_type -> google.ads.googleads.v3.services.MutateCustomerClientLinkResponse
7, // [7:9] is the sub-list for method output_type
5, // [5:7] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_google_ads_googleads_v3_services_customer_client_link_service_proto_init() }
func file_google_ads_googleads_v3_services_customer_client_link_service_proto_init() {
if File_google_ads_googleads_v3_services_customer_client_link_service_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCustomerClientLinkRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MutateCustomerClientLinkRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CustomerClientLinkOperation); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MutateCustomerClientLinkResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MutateCustomerClientLinkResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes[2].OneofWrappers = []interface{}{
(*CustomerClientLinkOperation_Create)(nil),
(*CustomerClientLinkOperation_Update)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_google_ads_googleads_v3_services_customer_client_link_service_proto_goTypes,
DependencyIndexes: file_google_ads_googleads_v3_services_customer_client_link_service_proto_depIdxs,
MessageInfos: file_google_ads_googleads_v3_services_customer_client_link_service_proto_msgTypes,
}.Build()
File_google_ads_googleads_v3_services_customer_client_link_service_proto = out.File
file_google_ads_googleads_v3_services_customer_client_link_service_proto_rawDesc = nil
file_google_ads_googleads_v3_services_customer_client_link_service_proto_goTypes = nil
file_google_ads_googleads_v3_services_customer_client_link_service_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// CustomerClientLinkServiceClient is the client API for CustomerClientLinkService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type CustomerClientLinkServiceClient interface {
// Returns the requested CustomerClientLink in full detail.
GetCustomerClientLink(ctx context.Context, in *GetCustomerClientLinkRequest, opts ...grpc.CallOption) (*resources.CustomerClientLink, error)
// Creates or updates a customer client link. Operation statuses are returned.
MutateCustomerClientLink(ctx context.Context, in *MutateCustomerClientLinkRequest, opts ...grpc.CallOption) (*MutateCustomerClientLinkResponse, error)
}
type customerClientLinkServiceClient struct {
cc grpc.ClientConnInterface
}
func NewCustomerClientLinkServiceClient(cc grpc.ClientConnInterface) CustomerClientLinkServiceClient {
return &customerClientLinkServiceClient{cc}
}
func (c *customerClientLinkServiceClient) GetCustomerClientLink(ctx context.Context, in *GetCustomerClientLinkRequest, opts ...grpc.CallOption) (*resources.CustomerClientLink, error) {
out := new(resources.CustomerClientLink)
err := c.cc.Invoke(ctx, "/google.ads.googleads.v3.services.CustomerClientLinkService/GetCustomerClientLink", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *customerClientLinkServiceClient) MutateCustomerClientLink(ctx context.Context, in *MutateCustomerClientLinkRequest, opts ...grpc.CallOption) (*MutateCustomerClientLinkResponse, error) {
out := new(MutateCustomerClientLinkResponse)
err := c.cc.Invoke(ctx, "/google.ads.googleads.v3.services.CustomerClientLinkService/MutateCustomerClientLink", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CustomerClientLinkServiceServer is the server API for CustomerClientLinkService service.
type CustomerClientLinkServiceServer interface {
// Returns the requested CustomerClientLink in full detail.
GetCustomerClientLink(context.Context, *GetCustomerClientLinkRequest) (*resources.CustomerClientLink, error)
// Creates or updates a customer client link. Operation statuses are returned.
MutateCustomerClientLink(context.Context, *MutateCustomerClientLinkRequest) (*MutateCustomerClientLinkResponse, error)
}
// UnimplementedCustomerClientLinkServiceServer can be embedded to have forward compatible implementations.
type UnimplementedCustomerClientLinkServiceServer struct {
}
func (*UnimplementedCustomerClientLinkServiceServer) GetCustomerClientLink(context.Context, *GetCustomerClientLinkRequest) (*resources.CustomerClientLink, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCustomerClientLink not implemented")
}
func (*UnimplementedCustomerClientLinkServiceServer) MutateCustomerClientLink(context.Context, *MutateCustomerClientLinkRequest) (*MutateCustomerClientLinkResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MutateCustomerClientLink not implemented")
}
func RegisterCustomerClientLinkServiceServer(s *grpc.Server, srv CustomerClientLinkServiceServer) {
s.RegisterService(&_CustomerClientLinkService_serviceDesc, srv)
}
func _CustomerClientLinkService_GetCustomerClientLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCustomerClientLinkRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CustomerClientLinkServiceServer).GetCustomerClientLink(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/google.ads.googleads.v3.services.CustomerClientLinkService/GetCustomerClientLink",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CustomerClientLinkServiceServer).GetCustomerClientLink(ctx, req.(*GetCustomerClientLinkRequest))
}
return interceptor(ctx, in, info, handler)
}
func _CustomerClientLinkService_MutateCustomerClientLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MutateCustomerClientLinkRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CustomerClientLinkServiceServer).MutateCustomerClientLink(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/google.ads.googleads.v3.services.CustomerClientLinkService/MutateCustomerClientLink",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CustomerClientLinkServiceServer).MutateCustomerClientLink(ctx, req.(*MutateCustomerClientLinkRequest))
}
return interceptor(ctx, in, info, handler)
}
var _CustomerClientLinkService_serviceDesc = grpc.ServiceDesc{
ServiceName: "google.ads.googleads.v3.services.CustomerClientLinkService",
HandlerType: (*CustomerClientLinkServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetCustomerClientLink",
Handler: _CustomerClientLinkService_GetCustomerClientLink_Handler,
},
{
MethodName: "MutateCustomerClientLink",
Handler: _CustomerClientLinkService_MutateCustomerClientLink_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "google/ads/googleads/v3/services/customer_client_link_service.proto",
}
| {
"pile_set_name": "Github"
} |
## warm welcome
Originally published: 2013-02-03 06:24:46
Last updated: 2013-02-03 06:24:46
Author: Ray
just a warm welcome. | {
"pile_set_name": "Github"
} |
[Desktop Entry]
Categories=Network;FileTransfer;P2P;Qt;
Exec=/opt/Point/PointDownload/PointDownload
Icon=/opt/Point/PointDownload/point.png
GenericName=Download client
Comment=Point
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Name=Point
Terminal=false
Type=Application
| {
"pile_set_name": "Github"
} |
<?php
/**
* Base include file for SimpleTest
* @package SimpleTest
* @subpackage WebTester
* @version $Id: user_agent.php 1787 2008-04-26 20:35:39Z pp11 $
*/
/**#@+
* include other SimpleTest class files
*/
require_once(dirname(__FILE__) . '/cookies.php');
require_once(dirname(__FILE__) . '/http.php');
require_once(dirname(__FILE__) . '/encoding.php');
require_once(dirname(__FILE__) . '/authentication.php');
/**#@-*/
if (! defined('DEFAULT_MAX_REDIRECTS')) {
define('DEFAULT_MAX_REDIRECTS', 3);
}
if (! defined('DEFAULT_CONNECTION_TIMEOUT')) {
define('DEFAULT_CONNECTION_TIMEOUT', 15);
}
/**
* Fetches web pages whilst keeping track of
* cookies and authentication.
* @package SimpleTest
* @subpackage WebTester
*/
class SimpleUserAgent {
private $cookie_jar;
private $cookies_enabled = true;
private $authenticator;
private $max_redirects = DEFAULT_MAX_REDIRECTS;
private $proxy = false;
private $proxy_username = false;
private $proxy_password = false;
private $connection_timeout = DEFAULT_CONNECTION_TIMEOUT;
private $additional_headers = array();
/**
* Starts with no cookies, realms or proxies.
* @access public
*/
function __construct() {
$this->cookie_jar = new SimpleCookieJar();
$this->authenticator = new SimpleAuthenticator();
}
/**
* Removes expired and temporary cookies as if
* the browser was closed and re-opened. Authorisation
* has to be obtained again as well.
* @param string/integer $date Time when session restarted.
* If omitted then all persistent
* cookies are kept.
* @access public
*/
function restart($date = false) {
$this->cookie_jar->restartSession($date);
$this->authenticator->restartSession();
}
/**
* Adds a header to every fetch.
* @param string $header Header line to add to every
* request until cleared.
* @access public
*/
function addHeader($header) {
$this->additional_headers[] = $header;
}
/**
* Ages the cookies by the specified time.
* @param integer $interval Amount in seconds.
* @access public
*/
function ageCookies($interval) {
$this->cookie_jar->agePrematurely($interval);
}
/**
* Sets an additional cookie. If a cookie has
* the same name and path it is replaced.
* @param string $name Cookie key.
* @param string $value Value of cookie.
* @param string $host Host upon which the cookie is valid.
* @param string $path Cookie path if not host wide.
* @param string $expiry Expiry date.
* @access public
*/
function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
$this->cookie_jar->setCookie($name, $value, $host, $path, $expiry);
}
/**
* Reads the most specific cookie value from the
* browser cookies.
* @param string $host Host to search.
* @param string $path Applicable path.
* @param string $name Name of cookie to read.
* @return string False if not present, else the
* value as a string.
* @access public
*/
function getCookieValue($host, $path, $name) {
return $this->cookie_jar->getCookieValue($host, $path, $name);
}
/**
* Reads the current cookies within the base URL.
* @param string $name Key of cookie to find.
* @param SimpleUrl $base Base URL to search from.
* @return string/boolean Null if there is no base URL, false
* if the cookie is not set.
* @access public
*/
function getBaseCookieValue($name, $base) {
if (! $base) {
return null;
}
return $this->getCookieValue($base->getHost(), $base->getPath(), $name);
}
/**
* Switches off cookie sending and recieving.
* @access public
*/
function ignoreCookies() {
$this->cookies_enabled = false;
}
/**
* Switches back on the cookie sending and recieving.
* @access public
*/
function useCookies() {
$this->cookies_enabled = true;
}
/**
* Sets the socket timeout for opening a connection.
* @param integer $timeout Maximum time in seconds.
* @access public
*/
function setConnectionTimeout($timeout) {
$this->connection_timeout = $timeout;
}
/**
* Sets the maximum number of redirects before
* a page will be loaded anyway.
* @param integer $max Most hops allowed.
* @access public
*/
function setMaximumRedirects($max) {
$this->max_redirects = $max;
}
/**
* Sets proxy to use on all requests for when
* testing from behind a firewall. Set URL
* to false to disable.
* @param string $proxy Proxy URL.
* @param string $username Proxy username for authentication.
* @param string $password Proxy password for authentication.
* @access public
*/
function useProxy($proxy, $username, $password) {
if (! $proxy) {
$this->proxy = false;
return;
}
if ((strncmp($proxy, 'http://', 7) != 0) && (strncmp($proxy, 'https://', 8) != 0)) {
$proxy = 'http://'. $proxy;
}
$this->proxy = new SimpleUrl($proxy);
$this->proxy_username = $username;
$this->proxy_password = $password;
}
/**
* Test to see if the redirect limit is passed.
* @param integer $redirects Count so far.
* @return boolean True if over.
* @access private
*/
protected function isTooManyRedirects($redirects) {
return ($redirects > $this->max_redirects);
}
/**
* Sets the identity for the current realm.
* @param string $host Host to which realm applies.
* @param string $realm Full name of realm.
* @param string $username Username for realm.
* @param string $password Password for realm.
* @access public
*/
function setIdentity($host, $realm, $username, $password) {
$this->authenticator->setIdentityForRealm($host, $realm, $username, $password);
}
/**
* Fetches a URL as a response object. Will keep trying if redirected.
* It will also collect authentication realm information.
* @param string/SimpleUrl $url Target to fetch.
* @param SimpleEncoding $encoding Additional parameters for request.
* @return SimpleHttpResponse Hopefully the target page.
* @access public
*/
function fetchResponse($url, $encoding) {
if ($encoding->getMethod() != 'POST') {
$url->addRequestParameters($encoding);
$encoding->clear();
}
$response = $this->fetchWhileRedirected($url, $encoding);
if ($headers = $response->getHeaders()) {
if ($headers->isChallenge()) {
$this->authenticator->addRealm(
$url,
$headers->getAuthentication(),
$headers->getRealm());
}
}
return $response;
}
/**
* Fetches the page until no longer redirected or
* until the redirect limit runs out.
* @param SimpleUrl $url Target to fetch.
* @param SimpelFormEncoding $encoding Additional parameters for request.
* @return SimpleHttpResponse Hopefully the target page.
* @access private
*/
protected function fetchWhileRedirected($url, $encoding) {
$redirects = 0;
do {
$response = $this->fetch($url, $encoding);
if ($response->isError()) {
return $response;
}
$headers = $response->getHeaders();
$location = new SimpleUrl($headers->getLocation());
$url = $location->makeAbsolute($url);
if ($this->cookies_enabled) {
$headers->writeCookiesToJar($this->cookie_jar, $url);
}
if (! $headers->isRedirect()) {
break;
}
$encoding = new SimpleGetEncoding();
} while (! $this->isTooManyRedirects(++$redirects));
return $response;
}
/**
* Actually make the web request.
* @param SimpleUrl $url Target to fetch.
* @param SimpleFormEncoding $encoding Additional parameters for request.
* @return SimpleHttpResponse Headers and hopefully content.
* @access protected
*/
protected function fetch($url, $encoding) {
$request = $this->createRequest($url, $encoding);
return $request->fetch($this->connection_timeout);
}
/**
* Creates a full page request.
* @param SimpleUrl $url Target to fetch as url object.
* @param SimpleFormEncoding $encoding POST/GET parameters.
* @return SimpleHttpRequest New request.
* @access private
*/
protected function createRequest($url, $encoding) {
$request = $this->createHttpRequest($url, $encoding);
$this->addAdditionalHeaders($request);
if ($this->cookies_enabled) {
$request->readCookiesFromJar($this->cookie_jar, $url);
}
$this->authenticator->addHeaders($request, $url);
return $request;
}
/**
* Builds the appropriate HTTP request object.
* @param SimpleUrl $url Target to fetch as url object.
* @param SimpleFormEncoding $parameters POST/GET parameters.
* @return SimpleHttpRequest New request object.
* @access protected
*/
protected function createHttpRequest($url, $encoding) {
return new SimpleHttpRequest($this->createRoute($url), $encoding);
}
/**
* Sets up either a direct route or via a proxy.
* @param SimpleUrl $url Target to fetch as url object.
* @return SimpleRoute Route to take to fetch URL.
* @access protected
*/
protected function createRoute($url) {
if ($this->proxy) {
return new SimpleProxyRoute(
$url,
$this->proxy,
$this->proxy_username,
$this->proxy_password);
}
return new SimpleRoute($url);
}
/**
* Adds additional manual headers.
* @param SimpleHttpRequest $request Outgoing request.
* @access private
*/
protected function addAdditionalHeaders(&$request) {
foreach ($this->additional_headers as $header) {
$request->addHeaderLine($header);
}
}
}
?> | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __BFA_DEFS_AEN_H__
#define __BFA_DEFS_AEN_H__
#include <defs/bfa_defs_types.h>
#include <defs/bfa_defs_ioc.h>
#include <defs/bfa_defs_adapter.h>
#include <defs/bfa_defs_port.h>
#include <defs/bfa_defs_lport.h>
#include <defs/bfa_defs_rport.h>
#include <defs/bfa_defs_itnim.h>
#include <defs/bfa_defs_tin.h>
#include <defs/bfa_defs_ipfc.h>
#include <defs/bfa_defs_audit.h>
#include <defs/bfa_defs_ethport.h>
#define BFA_AEN_MAX_APP 5
enum bfa_aen_app {
bfa_aen_app_bcu = 0, /* No thread for bcu */
bfa_aen_app_hcm = 1,
bfa_aen_app_cim = 2,
bfa_aen_app_snia = 3,
bfa_aen_app_test = 4, /* To be removed after unit test */
};
enum bfa_aen_category {
BFA_AEN_CAT_ADAPTER = 1,
BFA_AEN_CAT_PORT = 2,
BFA_AEN_CAT_LPORT = 3,
BFA_AEN_CAT_RPORT = 4,
BFA_AEN_CAT_ITNIM = 5,
BFA_AEN_CAT_TIN = 6,
BFA_AEN_CAT_IPFC = 7,
BFA_AEN_CAT_AUDIT = 8,
BFA_AEN_CAT_IOC = 9,
BFA_AEN_CAT_ETHPORT = 10,
BFA_AEN_MAX_CAT = 10
};
#pragma pack(1)
union bfa_aen_data_u {
struct bfa_adapter_aen_data_s adapter;
struct bfa_port_aen_data_s port;
struct bfa_lport_aen_data_s lport;
struct bfa_rport_aen_data_s rport;
struct bfa_itnim_aen_data_s itnim;
struct bfa_audit_aen_data_s audit;
struct bfa_ioc_aen_data_s ioc;
struct bfa_ethport_aen_data_s ethport;
};
struct bfa_aen_entry_s {
enum bfa_aen_category aen_category;
int aen_type;
union bfa_aen_data_u aen_data;
struct bfa_timeval_s aen_tv;
s32 seq_num;
s32 bfad_num;
s32 rsvd[1];
};
#pragma pack()
#define bfa_aen_event_t int
#endif /* __BFA_DEFS_AEN_H__ */
| {
"pile_set_name": "Github"
} |
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
#include "cmsis_os.h"
#include "lwip.h"
#include "wolfssl_example.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;
RNG_HandleTypeDef hrng;
RTC_HandleTypeDef hrtc;
UART_HandleTypeDef huart4;
osThreadId defaultTaskHandle;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
static void MX_CRC_Init(void);
static void MX_RNG_Init(void);
static void MX_UART4_Init(void);
static void MX_RTC_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE END PFP */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CRC_Init();
MX_RNG_Init();
MX_UART4_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, wolfCryptDemo, osPriorityNormal, 0, 24000);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
/** System Clock Configuration
*/
#define SysTick_IRQn -1
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 15;
RCC_OscInitStruct.PLL.PLLN = 144;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 5;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
}
/* CRC init function */
static void MX_CRC_Init(void)
{
hcrc.Instance = CRC;
if (HAL_CRC_Init(&hcrc) != HAL_OK)
{
Error_Handler();
}
}
/* RNG init function */
static void MX_RNG_Init(void)
{
hrng.Instance = RNG;
if (HAL_RNG_Init(&hrng) != HAL_OK)
{
Error_Handler();
}
}
/* RTC init function */
#define RTC_ASYNCH_PREDIV 0x7F /* LSE as RTC clock */
#define RTC_SYNCH_PREDIV 0x00FF /* LSE as RTC clock */
static void MX_RTC_Init(void)
{
RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate;
/**Initialize RTC and set the Time and Date
*/
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = RTC_ASYNCH_PREDIV;
hrtc.Init.SynchPrediv = RTC_SYNCH_PREDIV;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
Error_Handler();
}
sTime.Hours = 0x0;
sTime.Minutes = 0x0;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x1;
sDate.Year = 0x0;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
/**Enable the TimeStamp
*/
if (HAL_RTCEx_SetTimeStamp(&hrtc, RTC_TIMESTAMPEDGE_RISING, RTC_TIMESTAMPPIN_DEFAULT) != HAL_OK)
{
Error_Handler();
}
/**Enable the reference Clock input
*/
if (HAL_RTCEx_SetRefClock(&hrtc) != HAL_OK)
{
Error_Handler();
}
}
/* UART4 init function */
static void MX_UART4_Init(void)
{
huart4.Instance = UART4;
huart4.Init.BaudRate = 115200;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX_RX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart4) != HAL_OK)
{
Error_Handler();
}
// Turn off buffers, so I/O occurs immediately
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
}
int _write (int fd, char *ptr, int len)
{
(void)fd;
/* Write "len" of char from "ptr" to file id "fd"
* Return number of char written.
* Need implementing with UART here. */
HAL_UART_Transmit(&huart4, (uint8_t *)ptr, len, 0xFFFF);
return len;
}
int _read (int fd, char *ptr, int len)
{
/* Read "len" of char to "ptr" from file id "fd"
* Return number of char read.
* Need implementing with UART here. */
(void)fd;
return HAL_UART_Receive(&huart4, (uint8_t*)ptr, len, 0xFFFF);
}
void _ttywrch(int ch) {
/* Write one char "ch" to the default console
* Need implementing with UART here. */
_write(0, (char*)&ch, 1);
}
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
static void MX_GPIO_Init(void)
{
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
}
/* USER CODE BEGIN 4 */
/* USER CODE END 4 */
/**
* @brief Period elapsed callback in non blocking mode
* @note This function is called when TIM1 interrupt took place, inside
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
* a global variable "uwTick" used as application time base.
* @param htim : TIM handle
* @retval None
*/
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */
if (htim->Instance == TIM1) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
/* USER CODE END Callback 1 */
}
/**
* @brief This function is executed in case of error occurrence.
* @param None
* @retval None
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler */
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
/* USER CODE END Error_Handler */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.butterknife">
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:label="@string/app_name"
android:name=".SimpleApp"
tools:ignore="MissingApplicationIcon,UnusedAttribute,GoogleAppIndexingWarning">
<activity
android:label="@string/app_name"
android:name=".library.SimpleActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code">
<num>26-634</num>
<heading>Requirements for international banking corporation activities.</heading>
<para>
<num>(a)</num>
<text>An international banking corporation may transact a banking business, or maintain in the District of Columbia an office for carrying on such business, or any part thereof, if the corporation has:</text>
<para>
<num>(1)</num>
<text>Been authorized by its charter to carry on a banking business and has complied with the laws of the jurisdiction in which it is chartered;</text>
</para>
<para>
<num>(2)</num>
<text>Furnished to the Department such proof as to the nature and character of its business and as to its financial condition as the Department may require;</text>
</para>
<para>
<num>(3)</num>
<text>Filed with the Department a certified copy of any information required to be supplied to the District of Columbia by a foreign corporation under <cite path="§29-101.99" proof="true">§ 29-101.99</cite>; and</text>
</para>
<para>
<num>(4)</num>
<text>Been licensed by the Department.</text>
</para>
</para>
<para>
<num>(b)</num>
<text>An international banking corporation may engage in representational and other activities in the District of Columbia, other than those specified in <cite path="§26-635">§ 26-635</cite>, only as authorized in <cite path="§26-636">§ 26-636</cite>.</text>
</para>
<para>
<num>(c)</num>
<text>Any person who establishes or maintains an office or transacts business in the District of Columbia in violation of this section shall be subject to the penalties imposed by <cite path="§26-103|(g)">§ 26-103(g)</cite>.</text>
</para>
<annotations>
<annotation doc="D.C. Law 13-268" type="History" path="§5">Apr. 3, 2001, D.C. Law 13-268, § 5, 48 DCR 1251</annotation>
<annotation type="Section References">This section is referenced in <cite path="§26-635">§ 26-635</cite>.</annotation>
</annotations>
</section>
| {
"pile_set_name": "Github"
} |
---
build_from_template: false
cpu_hotadd: false
cpucount: 2
datastore: 'ELKStack (NAS01)'
disk1: 36
mem_hotadd: false
memory: 1536
multi: false
network: vSS-Green-Servers-VLAN101
| {
"pile_set_name": "Github"
} |
/*
; Project: Open Vehicle Monitor System
; Date: 14th March 2017
;
; Changes:
; 1.0 Initial release
;
; (C) 2011 Michael Stegen / Stegen Electronics
; (C) 2011-2017 Mark Webb-Johnson
; (C) 2011 Sonny Chen @ EPRO/DX
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.
*/
#include "ovms_log.h"
static const char *TAG = "test";
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "esp_sleep.h"
#include "test_framework.h"
#include "ovms_command.h"
#include "ovms_peripherals.h"
#include "ovms_script.h"
#include "metrics_standard.h"
#include "ovms_config.h"
#include "can.h"
#include "strverscmp.h"
void test_deepsleep(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int sleeptime = 60;
if (argc==1)
{
sleeptime = atoi(argv[0]);
}
writer->puts("Entering deep sleep...");
vTaskDelay(1000 / portTICK_PERIOD_MS);
esp_deep_sleep(1000000LL * sleeptime);
}
void test_javascript(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
#ifdef CONFIG_OVMS_SC_JAVASCRIPT_NONE
writer->puts("No javascript engine enabled");
#endif //#ifdef CONFIG_OVMS_SC_JAVASCRIPT_NONE
#ifdef CONFIG_OVMS_SC_JAVASCRIPT_DUKTAPE
writer->printf("Javascript 1+2=%d\n", MyScripts.DuktapeEvalIntResult("1+2"));
#endif //#ifdef CONFIG_OVMS_SC_JAVASCRIPT_DUKTAPE
}
#ifdef CONFIG_OVMS_COMP_SDCARD
void test_sdcard(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
sdcard *sd = MyPeripherals->m_sdcard;
if (!sd->isinserted())
{
writer->puts("Error: No SD CARD inserted");
return;
}
if (!sd->ismounted())
{
writer->puts("Error: SD CARD not mounted");
return;
}
unlink("/sd/ovmstest.txt");
char buffer[512];
memset(buffer,'A',sizeof(buffer));
FILE *fd = fopen("/sd/ovmstest.txt","w");
if (fd == NULL)
{
writer->puts("Error: /sd/ovmstest.txt could not be opened for writing");
return;
}
writer->puts("SD CARD test starts...");
for (int k=0;k<2048;k++)
{
fwrite(buffer, sizeof(buffer), 1, fd);
if ((k % 128)==0)
writer->printf("SD CARD written %d/%d\n",k,2048);
}
fclose(fd);
writer->puts("Cleaning up");
unlink("/sd/ovmstest.txt");
writer->puts("SD CARD test completes");
}
#endif // #ifdef CONFIG_OVMS_COMP_SDCARD
// Spew lines of the ASCII printable characters in the style of RFC 864.
void test_chargen(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int numlines = 1000;
int delay = 0;
if (argc>=1)
{
numlines = atoi(argv[0]);
}
if (argc>=2)
{
delay = atoi(argv[1]);
}
char buf[74];
buf[72] = '\n';
buf[73] = '\0';
char start = '!';
for (int line = 0; line < numlines; ++line)
{
char ch = start;
for (int col = 0; col < 72; ++col)
{
buf[col] = ch;
if (++ch == 0x7F)
ch = ' ';
}
if (writer->write(buf, 73) <= 0)
break;
if (delay)
vTaskDelay(delay/portTICK_PERIOD_MS);
if (++start == 0x7F)
start = ' ';
}
}
bool test_echo_insert(OvmsWriter* writer, void* ctx, char ch)
{
if (ch == '\n')
return false;
writer->write(&ch, 1);
return true;
}
void test_echo(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
writer->puts("Type characters to be echoed, end with newline.");
writer->RegisterInsertCallback(test_echo_insert, NULL);
}
void test_watchdog(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
writer->puts("Spinning now (watchdog should fire in a few minutes)");
for (;;) {}
writer->puts("Error: We should never get here");
}
void test_realloc(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
void* buf;
void *interfere = NULL;
writer->puts("First check heap integrity...");
heap_caps_check_integrity_all(true);
writer->puts("Now allocate 4KB RAM...");
buf = ExternalRamMalloc(4096);
writer->puts("Check heap integrity...");
heap_caps_check_integrity_all(true);
writer->puts("Now re-allocate bigger, 1,000 times...");
for (int k=1; k<1001; k++)
{
buf = ExternalRamRealloc(buf, 4096+k);
if (interfere == NULL)
{
interfere = ExternalRamMalloc(1024);
}
else
{
free(interfere);
interfere = NULL;
}
}
writer->puts("Check heap integrity...");
heap_caps_check_integrity_all(true);
writer->puts("Now re-allocate smaller, 1,000 times...");
for (int k=1001; k>0; k--)
{
buf = ExternalRamRealloc(buf, 4096+k);
if (interfere == NULL)
{
interfere = ExternalRamMalloc(1024);
}
else
{
free(interfere);
interfere = NULL;
}
}
writer->puts("Check heap integrity...");
heap_caps_check_integrity_all(true);
writer->puts("And free the buffer...");
free(buf);
if (interfere != NULL) free(interfere);
writer->puts("Final check of heap integrity...");
heap_caps_check_integrity_all(true);
}
void test_spiram(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
writer->printf("Metrics (%p) are in %s RAM (%d bytes for a base metric)\n",
StandardMetrics.ms_m_version,
(((unsigned int)StandardMetrics.ms_m_version >= 0x3f800000)&&
((unsigned int)StandardMetrics.ms_m_version <= 0x3fbfffff))?
"SPI":"INTERNAL",
sizeof(OvmsMetric));
}
void test_strverscmp(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int c = strverscmp(argv[0],argv[1]);
writer->printf("%s %s %s\n",
argv[0],
(c<0)?"<":((c==0)?"=":">"),
argv[1]
);
}
void test_can(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int64_t started = esp_timer_get_time();
int64_t elapsed;
bool tx = (strcmp(cmd->GetName(), "cantx")==0);
int frames = 1000;
if (argc>1) frames = atoi(argv[1]);
canbus *can;
if (argc>0)
can = (canbus*)MyPcpApp.FindDeviceByName(argv[0]);
else
can = (canbus*)MyPcpApp.FindDeviceByName("can1");
if (can == NULL)
{
writer->puts("Error: Cannot find specified can bus");
return;
}
writer->printf("Testing %d frames on %s\n",frames,can->GetName());
CAN_frame_t frame;
memset(&frame,0,sizeof(frame));
frame.origin = can;
frame.FIR.U = 0;
frame.FIR.B.DLC = 8;
frame.FIR.B.FF = CAN_frame_std;
for (int k=0;k<frames;k++)
{
frame.MsgID = (rand()%64)+256;
frame.data.u64 = k+1;
if (tx)
can->Write(&frame, pdMS_TO_TICKS(10));
else
MyCan.IncomingFrame(&frame);
}
elapsed = esp_timer_get_time() - started;
int uspt = elapsed / frames;
writer->printf("Transmitted %d frames in %lld.%06llds = %dus/frame\n",
frames, elapsed / 1000000, elapsed % 1000000, uspt);
}
void test_mkstemp(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int fd1, e1, fd2, e2;
char tn1[100], tn2[100];
snprintf(tn1, sizeof(tn1), "%s.XXXXXX", argv[0]);
snprintf(tn2, sizeof(tn2), "%s.XXXXXX", argv[0]);
errno = 0;
fd1 = mkstemp(tn1); e1 = errno;
fd2 = mkstemp(tn2); e2 = errno;
writer->printf("tempfile 1: '%s' => fd=%d error='%s'\n", tn1, fd1, (fd1<0) ? strerror(e1) : "-");
writer->printf("tempfile 2: '%s' => fd=%d error='%s'\n", tn2, fd2, (fd2<0) ? strerror(e2) : "-");
if (fd1 >= 0) { close(fd1); unlink(tn1); }
if (fd2 >= 0) { close(fd2); unlink(tn2); }
}
void test_string(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
int loopcnt = atoi(argv[0]);
int mode = (argc > 1) ? atoi(argv[1]) : 1;
int stdlen = 0, errcnt = 0;
size_t pos;
OvmsMetric* m;
const char* t5 = "0123456789-abcdefghijk-";
std::string t6(t5);
for (int j = 1; j <= loopcnt; j++)
{
std::string msg;
msg.reserve(2048);
for (m = MyMetrics.m_first; msg.size() < 1024; m = m->m_next ? m->m_next : MyMetrics.m_first)
{
if (mode == 1)
msg += m->AsJSON();
else if (mode == 2)
msg += m->AsString();
else if (mode == 3)
msg += m->m_name;
else if (mode == 4)
msg += MyConfig.GetParamValue("module", "cfgversion", m->m_name);
else if (mode == 5)
msg += t5;
else if (mode == 6)
msg += t6;
// check for NUL bytes:
if ((pos = msg.rfind('\0')) != std::string::npos)
{
writer->printf("loop #%d: corruption detected at pos=%u size=%u\n%s\n\n", j, pos, msg.size(), msg.c_str());
if (++errcnt == 20)
{
writer->puts("too many errors, abort");
return;
}
break;
}
}
// display reference:
if (msg.size() > stdlen)
{
stdlen = msg.size();
writer->printf("#%d: stdlen = %d\n%s\n\n", j, stdlen, msg.c_str());
}
}
writer->puts("finished");
}
class TestFrameworkInit
{
public: TestFrameworkInit();
} MyTestFrameworkInit __attribute__ ((init_priority (5000)));
TestFrameworkInit::TestFrameworkInit()
{
ESP_LOGI(TAG, "Initialising TEST (5000)");
OvmsCommand* cmd_test = MyCommandApp.RegisterCommand("test","Test framework");
cmd_test->RegisterCommand("sleep","Test Deep Sleep",test_deepsleep,"[<seconds>]",0,1);
#ifdef CONFIG_OVMS_COMP_SDCARD
cmd_test->RegisterCommand("sdcard","Test CD CARD",test_sdcard);
#endif // #ifdef CONFIG_OVMS_COMP_SDCARD
cmd_test->RegisterCommand("javascript","Test Javascript",test_javascript);
cmd_test->RegisterCommand("chargen","Character generator",test_chargen,"[<#lines>] [<delay_ms>]",0,2);
cmd_test->RegisterCommand("echo", "Test getchar", test_echo);
cmd_test->RegisterCommand("watchdog", "Test task spinning (and watchdog firing)", test_watchdog);
cmd_test->RegisterCommand("realloc", "Test memory re-allocations", test_realloc);
cmd_test->RegisterCommand("spiram", "Test SPI RAM memory usage", test_spiram);
cmd_test->RegisterCommand("strverscmp", "Test strverscmp function", test_strverscmp, "", 2, 2);
cmd_test->RegisterCommand("cantx", "Test CAN bus transmission", test_can, "[<port>] [<number>]", 0, 2);
cmd_test->RegisterCommand("canrx", "Test CAN bus reception", test_can, "[<port>] [<number>]", 0, 2);
cmd_test->RegisterCommand("mkstemp", "Test mkstemp function", test_mkstemp, "<file>", 1, 1);
cmd_test->RegisterCommand("string", "Test std::string memory corruption", test_string, "<loopcnt> <mode>\n"
"mode: 1=m.AsJSON, 2=m.AsString, 3=m.name, 4=const cfg string, 5=const local cstr, 6=const local string", 2, 2);
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Emtudo\Support\Domain\Repositories;
/**
* Class TenantRepository.
*/
class TenantRepository extends Repository
{
/**
* @var bool
*/
protected $tenantOnly = true;
}
| {
"pile_set_name": "Github"
} |
module.exports = {
PUT,
};
function PUT() {
return;
}
PUT.apiDoc = {
requestBody: {
$ref: '#/components/requestBodies/Foo',
},
responses: {
'200': {
description: 'return foo',
content: {
'application/json': {
schema: {},
},
},
},
},
tags: ['testing', 'example'],
};
| {
"pile_set_name": "Github"
} |
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
*
* 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.
* ========================================================= */
!function( $ ) {
function UTCDate(){
return new Date(Date.UTC.apply(Date, arguments));
}
function UTCToday(){
var today = new Date();
return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
}
// Picker object
var Datepicker = function(element, options) {
var that = this;
this.element = $(element);
this.language = options.language||this.element.data('date-language')||"en";
this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de"
this.language = this.language in dates ? this.language : "en";
this.isRTL = dates[this.language].rtl||false;
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||dates[this.language].format||'mm/dd/yyyy');
this.isInline = false;
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;
this.hasInput = this.component && this.element.find('input').length;
if(this.component && this.component.length === 0)
this.component = false;
this.forceParse = true;
if ('forceParse' in options) {
this.forceParse = options.forceParse;
} else if ('dateForceParse' in this.element.data()) {
this.forceParse = this.element.data('date-force-parse');
}
this.picker = $(DPGlobal.template);
this._buildEvents();
this._attachEvents();
if(this.isInline) {
this.picker.addClass('datepicker-inline').appendTo(this.element);
} else {
this.picker.addClass('datepicker-dropdown dropdown-menu');
}
if (this.isRTL){
this.picker.addClass('datepicker-rtl');
this.picker.find('.prev i, .next i')
.toggleClass('icon-arrow-left icon-arrow-right');
}
this.autoclose = false;
if ('autoclose' in options) {
this.autoclose = options.autoclose;
} else if ('dateAutoclose' in this.element.data()) {
this.autoclose = this.element.data('date-autoclose');
}
this.keyboardNavigation = true;
if ('keyboardNavigation' in options) {
this.keyboardNavigation = options.keyboardNavigation;
} else if ('dateKeyboardNavigation' in this.element.data()) {
this.keyboardNavigation = this.element.data('date-keyboard-navigation');
}
this.viewMode = this.startViewMode = 0;
switch(options.startView || this.element.data('date-start-view')){
case 2:
case 'decade':
this.viewMode = this.startViewMode = 2;
break;
case 1:
case 'year':
this.viewMode = this.startViewMode = 1;
break;
}
this.minViewMode = options.minViewMode||this.element.data('date-min-view-mode')||0;
if (typeof this.minViewMode === 'string') {
switch (this.minViewMode) {
case 'months':
this.minViewMode = 1;
break;
case 'years':
this.minViewMode = 2;
break;
default:
this.minViewMode = 0;
break;
}
}
this.viewMode = this.startViewMode = Math.max(this.startViewMode, this.minViewMode);
this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false);
this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false);
this.calendarWeeks = false;
if ('calendarWeeks' in options) {
this.calendarWeeks = options.calendarWeeks;
} else if ('dateCalendarWeeks' in this.element.data()) {
this.calendarWeeks = this.element.data('date-calendar-weeks');
}
if (this.calendarWeeks)
this.picker.find('tfoot th.today')
.attr('colspan', function(i, val){
return parseInt(val) + 1;
});
this._allow_update = false;
this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7);
this.weekEnd = ((this.weekStart + 6) % 7);
this.startDate = -Infinity;
this.endDate = Infinity;
this.daysOfWeekDisabled = [];
this.setStartDate(options.startDate||this.element.data('date-startdate'));
this.setEndDate(options.endDate||this.element.data('date-enddate'));
this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data('date-days-of-week-disabled'));
this.fillDow();
this.fillMonths();
this._allow_update = true;
this.update();
this.showMode();
if(this.isInline) {
this.show();
}
};
Datepicker.prototype = {
constructor: Datepicker,
_events: [],
_secondaryEvents: [],
_applyEvents: function(evs){
for (var i=0, el, ev; i<evs.length; i++){
el = evs[i][0];
ev = evs[i][1];
el.on(ev);
}
},
_unapplyEvents: function(evs){
for (var i=0, el, ev; i<evs.length; i++){
el = evs[i][0];
ev = evs[i][1];
el.off(ev);
}
},
_buildEvents: function(){
if (this.isInput) { // single input
this._events = [
[this.element, {
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
}]
];
}
else if (this.component && this.hasInput){ // component: input + button
this._events = [
// For components that are not readonly, allow keyboard nav
[this.element.find('input'), {
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
}],
[this.component, {
click: $.proxy(this.show, this)
}]
];
}
else if (this.element.is('div')) { // inline datepicker
this.isInline = true;
}
else {
this._events = [
[this.element, {
click: $.proxy(this.show, this)
}]
];
}
this._secondaryEvents = [
[this.picker, {
click: $.proxy(this.click, this)
}],
[$(window), {
resize: $.proxy(this.place, this)
}],
[$(document), {
mousedown: $.proxy(function (e) {
// Clicked outside the datepicker, hide it
if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) {
this.hide();
}
}, this)
}]
];
},
_attachEvents: function(){
this._detachEvents();
this._applyEvents(this._events);
},
_detachEvents: function(){
this._unapplyEvents(this._events);
},
_attachSecondaryEvents: function(){
this._detachSecondaryEvents();
this._applyEvents(this._secondaryEvents);
},
_detachSecondaryEvents: function(){
this._unapplyEvents(this._secondaryEvents);
},
show: function(e) {
if (!this.isInline)
this.picker.appendTo('body');
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.place();
this._attachSecondaryEvents();
if (e) {
e.preventDefault();
}
this.element.trigger({
type: 'show',
date: this.date
});
},
hide: function(e){
if(this.isInline) return;
if (!this.picker.is(':visible')) return;
this.picker.hide().detach();
this._detachSecondaryEvents();
this.viewMode = this.startViewMode;
this.showMode();
if (
this.forceParse &&
(
this.isInput && this.element.val() ||
this.hasInput && this.element.find('input').val()
)
)
this.setValue();
this.element.trigger({
type: 'hide',
date: this.date
});
},
remove: function() {
this.hide();
this._detachEvents();
this._detachSecondaryEvents();
this.picker.remove();
delete this.element.data().datepicker;
if (!this.isInput) {
delete this.element.data().date;
}
},
getDate: function() {
var d = this.getUTCDate();
return new Date(d.getTime() + (d.getTimezoneOffset()*60000));
},
getUTCDate: function() {
return this.date;
},
setDate: function(d) {
this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset()*60000)));
},
setUTCDate: function(d) {
this.date = d;
this.setValue();
},
setValue: function() {
var formatted = this.getFormattedDate();
if (!this.isInput) {
if (this.component){
this.element.find('input').val(formatted);
}
this.element.data('date', formatted);
} else {
this.element.val(formatted);
}
},
getFormattedDate: function(format) {
if (format === undefined)
format = this.format;
return DPGlobal.formatDate(this.date, format, this.language);
},
setStartDate: function(startDate){
this.startDate = startDate||-Infinity;
if (this.startDate !== -Infinity) {
this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language);
}
this.update();
this.updateNavArrows();
},
setEndDate: function(endDate){
this.endDate = endDate||Infinity;
if (this.endDate !== Infinity) {
this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language);
}
this.update();
this.updateNavArrows();
},
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
this.daysOfWeekDisabled = daysOfWeekDisabled||[];
if (!$.isArray(this.daysOfWeekDisabled)) {
this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
}
this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) {
return parseInt(d, 10);
});
this.update();
this.updateNavArrows();
},
place: function(){
if(this.isInline) return;
var zIndex = parseInt(this.element.parents().filter(function() {
return $(this).css('z-index') != 'auto';
}).first().css('z-index'))+10;
var offset = this.component ? this.component.parent().offset() : this.element.offset();
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
this.picker.css({
top: offset.top + height,
left: offset.left,
zIndex: zIndex
});
},
_allow_update: true,
update: function(){
if (!this._allow_update) return;
var date, fromArgs = false;
if(arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
date = arguments[0];
fromArgs = true;
} else {
date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
}
this.date = DPGlobal.parseDate(date, this.format, this.language);
if(fromArgs) this.setValue();
if (this.date < this.startDate) {
this.viewDate = new Date(this.startDate);
} else if (this.date > this.endDate) {
this.viewDate = new Date(this.endDate);
} else {
this.viewDate = new Date(this.date);
}
this.fill();
},
fillDow: function(){
var dowCnt = this.weekStart,
html = '<tr>';
if(this.calendarWeeks){
var cell = '<th class="cw"> </th>';
html += cell;
this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
}
while (dowCnt < this.weekStart + 7) {
html += '<th class="dow">'+dates[this.language].daysMin[(dowCnt++)%7]+'</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '',
i = 0;
while (i < 12) {
html += '<span class="month">'+dates[this.language].monthsShort[i++]+'</span>';
}
this.picker.find('.datepicker-months td').html(html);
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth(),
startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
currentDate = this.date && this.date.valueOf(),
today = new Date();
this.picker.find('.datepicker-days thead th.switch')
.text(dates[this.language].months[month]+' '+year);
this.picker.find('tfoot th.today')
.text(dates[this.language].today)
.toggle(this.todayBtn !== false);
this.updateNavArrows();
this.fillMonths();
var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
prevMonth.setUTCDate(day);
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
nextMonth = nextMonth.valueOf();
var html = [];
var clsName;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getUTCDay() == this.weekStart) {
html.push('<tr>');
if(this.calendarWeeks){
// ISO 8601: First week contains first thursday.
// ISO also states week starts on Monday, but we can be more abstract here.
var
// Start of current week: based on weekstart/current date
ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
// Thursday of this week
th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
// First Thursday of year, year from thursday
yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
// Calendar week: ms between thursdays, div ms per day, div 7 days
calWeek = (th - yth) / 864e5 / 7 + 1;
html.push('<td class="cw">'+ calWeek +'</td>');
}
}
clsName = '';
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
clsName += ' old';
} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
clsName += ' new';
}
// Compare internal UTC date with local today, not UTC today
if (this.todayHighlight &&
prevMonth.getUTCFullYear() == today.getFullYear() &&
prevMonth.getUTCMonth() == today.getMonth() &&
prevMonth.getUTCDate() == today.getDate()) {
clsName += ' today';
}
if (currentDate && prevMonth.valueOf() == currentDate) {
clsName += ' active';
}
if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
$.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) {
clsName += ' disabled';
}
html.push('<td class="day'+clsName+'">'+prevMonth.getUTCDate() + '</td>');
if (prevMonth.getUTCDay() == this.weekEnd) {
html.push('</tr>');
}
prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date && this.date.getUTCFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear && currentYear == year) {
months.eq(this.date.getUTCMonth()).addClass('active');
}
if (year < startYear || year > endYear) {
months.addClass('disabled');
}
if (year == startYear) {
months.slice(0, startMonth).addClass('disabled');
}
if (year == endYear) {
months.slice(endMonth+1).addClass('disabled');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
year += 1;
}
yearCont.html(html);
},
updateNavArrows: function() {
if (!this._allow_update) return;
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth();
switch (this.viewMode) {
case 0:
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
case 1:
case 2:
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
}
},
click: function(e) {
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length == 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'switch':
this.showMode(1);
break;
case 'prev':
case 'next':
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
switch(this.viewMode){
case 0:
this.viewDate = this.moveMonth(this.viewDate, dir);
break;
case 1:
case 2:
this.viewDate = this.moveYear(this.viewDate, dir);
break;
}
this.fill();
break;
case 'today':
var date = new Date();
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
this.showMode(-2);
var which = this.todayBtn == 'linked' ? null : 'view';
this._setDate(date, which);
break;
}
break;
case 'span':
if (!target.is('.disabled')) {
this.viewDate.setUTCDate(1);
if (target.is('.month')) {
var day = 1;
var month = target.parent().find('span').index(target);
var year = this.viewDate.getUTCFullYear();
this.viewDate.setUTCMonth(month);
this.element.trigger({
type: 'changeMonth',
date: this.viewDate
});
if ( this.minViewMode == 1 ) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
} else {
var year = parseInt(target.text(), 10)||0;
var day = 1;
var month = 0;
this.viewDate.setUTCFullYear(year);
this.element.trigger({
type: 'changeYear',
date: this.viewDate
});
if ( this.minViewMode == 2 ) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
}
this.showMode(-1);
this.fill();
}
break;
case 'td':
if (target.is('.day') && !target.is('.disabled')){
var day = parseInt(target.text(), 10)||1;
var year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth();
if (target.is('.old')) {
if (month === 0) {
month = 11;
year -= 1;
} else {
month -= 1;
}
} else if (target.is('.new')) {
if (month == 11) {
month = 0;
year += 1;
} else {
month += 1;
}
}
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
break;
}
}
},
_setDate: function(date, which){
if (!which || which == 'date')
this.date = date;
if (!which || which == 'view')
this.viewDate = date;
this.fill();
this.setValue();
this.element.trigger({
type: 'changeDate',
date: this.date
});
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
if (this.autoclose && (!which || which == 'date')) {
this.hide();
}
}
},
moveMonth: function(date, dir){
if (!dir) return date;
var new_date = new Date(date.valueOf()),
day = new_date.getUTCDate(),
month = new_date.getUTCMonth(),
mag = Math.abs(dir),
new_month, test;
dir = dir > 0 ? 1 : -1;
if (mag == 1){
test = dir == -1
// If going back one month, make sure month is not current month
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
? function(){ return new_date.getUTCMonth() == month; }
// If going forward one month, make sure month is as expected
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
: function(){ return new_date.getUTCMonth() != new_month; };
new_month = month + dir;
new_date.setUTCMonth(new_month);
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
if (new_month < 0 || new_month > 11)
new_month = (new_month + 12) % 12;
} else {
// For magnitudes >1, move one month at a time...
for (var i=0; i<mag; i++)
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
new_date = this.moveMonth(new_date, dir);
// ...then reset the day, keeping it in the new month
new_month = new_date.getUTCMonth();
new_date.setUTCDate(day);
test = function(){ return new_month != new_date.getUTCMonth(); };
}
// Common date-resetting loop -- if date is beyond end of month, make it
// end of month
while (test()){
new_date.setUTCDate(--day);
new_date.setUTCMonth(new_month);
}
return new_date;
},
moveYear: function(date, dir){
return this.moveMonth(date, dir*12);
},
dateWithinRange: function(date){
return date >= this.startDate && date <= this.endDate;
},
keydown: function(e){
if (this.picker.is(':not(:visible)')){
if (e.keyCode == 27) // allow escape to hide and re-show picker
this.show();
return;
}
var dateChanged = false,
dir, day, month,
newDate, newViewDate;
switch(e.keyCode){
case 27: // escape
this.hide();
e.preventDefault();
break;
case 37: // left
case 39: // right
if (!this.keyboardNavigation) break;
dir = e.keyCode == 37 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 38: // up
case 40: // down
if (!this.keyboardNavigation) break;
dir = e.keyCode == 38 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 13: // enter
this.hide();
e.preventDefault();
break;
case 9: // tab
this.hide();
break;
}
if (dateChanged){
this.element.trigger({
type: 'changeDate',
date: this.date
});
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
}
}
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
}
/*
vitalets: fixing bug of very special conditions:
jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
Method show() does not set display css correctly and datepicker is not shown.
Changed to .css('display', 'block') solve the problem.
See https://github.com/vitalets/x-editable/issues/37
In jquery 1.7.2+ everything works fine.
*/
//this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
this.updateNavArrows();
}
};
$.fn.datepicker = function ( option ) {
var args = Array.apply(null, arguments);
args.shift();
return this.each(function () {
var $this = $(this),
data = $this.data('datepicker'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
}
if (typeof option == 'string' && typeof data[option] == 'function') {
data[option].apply(data, args);
}
});
};
$.fn.datepicker.defaults = {
};
$.fn.datepicker.Constructor = Datepicker;
var dates = $.fn.datepicker.dates = {
en: {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
today: "Today"
}
};
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
},
validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
parseFormat: function(format){
// IE treats \0 as a string end in inputs (truncating the value),
// so it's a bad format delimiter, anyway
var separators = format.replace(this.validParts, '\0').split('\0'),
parts = format.match(this.validParts);
if (!separators || !separators.length || !parts || parts.length === 0){
throw new Error("Invalid date format.");
}
return {separators: separators, parts: parts};
},
parseDate: function(date, format, language) {
if (date instanceof Date) return date;
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
var part_re = /([\-+]\d+)([dmwy])/,
parts = date.match(/([\-+]\d+)([dmwy])/g),
part, dir;
date = new Date();
for (var i=0; i<parts.length; i++) {
part = part_re.exec(parts[i]);
dir = parseInt(part[1]);
switch(part[2]){
case 'd':
date.setUTCDate(date.getUTCDate() + dir);
break;
case 'm':
date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
break;
case 'w':
date.setUTCDate(date.getUTCDate() + dir * 7);
break;
case 'y':
date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
break;
}
}
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
}
var parts = date && date.match(this.nonpunctuation) || [],
date = new Date(),
parsed = {},
setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
setters_map = {
yyyy: function(d,v){ return d.setUTCFullYear(v); },
yy: function(d,v){ return d.setUTCFullYear(2000+v); },
m: function(d,v){
v -= 1;
while (v<0) v += 12;
v %= 12;
d.setUTCMonth(v);
while (d.getUTCMonth() != v)
d.setUTCDate(d.getUTCDate()-1);
return d;
},
d: function(d,v){ return d.setUTCDate(v); }
},
val, filtered, part;
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
setters_map['dd'] = setters_map['d'];
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
var fparts = format.parts.slice();
// Remove noop parts
if (parts.length != fparts.length) {
fparts = $(fparts).filter(function(i,p){
return $.inArray(p, setters_order) !== -1;
}).toArray();
}
// Process remainder
if (parts.length == fparts.length) {
for (var i=0, cnt = fparts.length; i < cnt; i++) {
val = parseInt(parts[i], 10);
part = fparts[i];
if (isNaN(val)) {
switch(part) {
case 'MM':
filtered = $(dates[language].months).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates[language].months) + 1;
break;
case 'M':
filtered = $(dates[language].monthsShort).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
break;
}
}
parsed[part] = val;
}
for (var i=0, s; i<setters_order.length; i++){
s = setters_order[i];
if (s in parsed && !isNaN(parsed[s]))
setters_map[s](date, parsed[s]);
}
}
return date;
},
formatDate: function(date, format, language){
var val = {
d: date.getUTCDate(),
D: dates[language].daysShort[date.getUTCDay()],
DD: dates[language].days[date.getUTCDay()],
m: date.getUTCMonth() + 1,
M: dates[language].monthsShort[date.getUTCMonth()],
MM: dates[language].months[date.getUTCMonth()],
yy: date.getUTCFullYear().toString().substring(2),
yyyy: date.getUTCFullYear()
};
val.dd = (val.d < 10 ? '0' : '') + val.d;
val.mm = (val.m < 10 ? '0' : '') + val.m;
var date = [],
seps = $.extend([], format.separators);
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
if (seps.length)
date.push(seps.shift());
date.push(val[format.parts[i]]);
}
return date.join('');
},
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev"><i class="icon-arrow-left"/></th>'+
'<th colspan="5" class="switch"></th>'+
'<th class="next"><i class="icon-arrow-right"/></th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'
};
DPGlobal.template = '<div class="datepicker">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'</div>';
$.fn.datepicker.DPGlobal = DPGlobal;
}( window.jQuery );
| {
"pile_set_name": "Github"
} |
# Event 505 - task_0
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|Message1|UnicodeString|None|`None`|
## Tags
* etw_level_Informational
* etw_task_task_0 | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
package org.apache.spark.sql.types
import scala.collection.mutable
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.apache.spark.annotation.InterfaceStability
/**
* Metadata is a wrapper over Map[String, Any] that limits the value type to simple ones: Boolean,
* Long, Double, String, Metadata, Array[Boolean], Array[Long], Array[Double], Array[String], and
* Array[Metadata]. JSON is used for serialization.
*
* The default constructor is private. User should use either [[MetadataBuilder]] or
* `Metadata.fromJson()` to create Metadata instances.
*
* @param map an immutable map that stores the data
*
* @since 1.3.0
*/
@InterfaceStability.Stable
sealed class Metadata private[types] (private[types] val map: Map[String, Any])
extends Serializable {
/** No-arg constructor for kryo. */
protected def this() = this(null)
/** Tests whether this Metadata contains a binding for a key. */
def contains(key: String): Boolean = map.contains(key)
/** Gets a Long. */
def getLong(key: String): Long = get(key)
/** Gets a Double. */
def getDouble(key: String): Double = get(key)
/** Gets a Boolean. */
def getBoolean(key: String): Boolean = get(key)
/** Gets a String. */
def getString(key: String): String = get(key)
/** Gets a Metadata. */
def getMetadata(key: String): Metadata = get(key)
/** Gets a Long array. */
def getLongArray(key: String): Array[Long] = get(key)
/** Gets a Double array. */
def getDoubleArray(key: String): Array[Double] = get(key)
/** Gets a Boolean array. */
def getBooleanArray(key: String): Array[Boolean] = get(key)
/** Gets a String array. */
def getStringArray(key: String): Array[String] = get(key)
/** Gets a Metadata array. */
def getMetadataArray(key: String): Array[Metadata] = get(key)
/** Converts to its JSON representation. */
def json: String = compact(render(jsonValue))
override def toString: String = json
override def equals(obj: Any): Boolean = {
obj match {
case that: Metadata if map.size == that.map.size =>
map.keysIterator.forall { key =>
that.map.get(key) match {
case Some(otherValue) =>
val ourValue = map.get(key).get
(ourValue, otherValue) match {
case (v0: Array[Long], v1: Array[Long]) => java.util.Arrays.equals(v0, v1)
case (v0: Array[Double], v1: Array[Double]) => java.util.Arrays.equals(v0, v1)
case (v0: Array[Boolean], v1: Array[Boolean]) => java.util.Arrays.equals(v0, v1)
case (v0: Array[AnyRef], v1: Array[AnyRef]) => java.util.Arrays.equals(v0, v1)
case (v0, v1) => v0 == v1
}
case None => false
}
}
case other =>
false
}
}
private lazy val _hashCode: Int = Metadata.hash(this)
override def hashCode: Int = _hashCode
private def get[T](key: String): T = {
map(key).asInstanceOf[T]
}
private[sql] def jsonValue: JValue = Metadata.toJsonValue(this)
}
/**
* @since 1.3.0
*/
@InterfaceStability.Stable
object Metadata {
private[this] val _empty = new Metadata(Map.empty)
/** Returns an empty Metadata. */
def empty: Metadata = _empty
/** Creates a Metadata instance from JSON. */
def fromJson(json: String): Metadata = {
fromJObject(parse(json).asInstanceOf[JObject])
}
/** Creates a Metadata instance from JSON AST. */
private[sql] def fromJObject(jObj: JObject): Metadata = {
val builder = new MetadataBuilder
jObj.obj.foreach {
case (key, JInt(value)) =>
builder.putLong(key, value.toLong)
case (key, JDouble(value)) =>
builder.putDouble(key, value)
case (key, JBool(value)) =>
builder.putBoolean(key, value)
case (key, JString(value)) =>
builder.putString(key, value)
case (key, o: JObject) =>
builder.putMetadata(key, fromJObject(o))
case (key, JArray(value)) =>
if (value.isEmpty) {
// If it is an empty array, we cannot infer its element type. We put an empty Array[Long].
builder.putLongArray(key, Array.empty)
} else {
value.head match {
case _: JInt =>
builder.putLongArray(key, value.asInstanceOf[List[JInt]].map(_.num.toLong).toArray)
case _: JDouble =>
builder.putDoubleArray(key, value.asInstanceOf[List[JDouble]].map(_.num).toArray)
case _: JBool =>
builder.putBooleanArray(key, value.asInstanceOf[List[JBool]].map(_.value).toArray)
case _: JString =>
builder.putStringArray(key, value.asInstanceOf[List[JString]].map(_.s).toArray)
case _: JObject =>
builder.putMetadataArray(
key, value.asInstanceOf[List[JObject]].map(fromJObject).toArray)
case other =>
throw new RuntimeException(s"Do not support array of type ${other.getClass}.")
}
}
case (key, JNull) =>
builder.putNull(key)
case (key, other) =>
throw new RuntimeException(s"Do not support type ${other.getClass}.")
}
builder.build()
}
/** Converts to JSON AST. */
private def toJsonValue(obj: Any): JValue = {
obj match {
case map: Map[_, _] =>
val fields = map.toList.map { case (k, v) => (k.toString, toJsonValue(v)) }
JObject(fields)
case arr: Array[_] =>
val values = arr.toList.map(toJsonValue)
JArray(values)
case x: Long =>
JInt(x)
case x: Double =>
JDouble(x)
case x: Boolean =>
JBool(x)
case x: String =>
JString(x)
case x: Metadata =>
toJsonValue(x.map)
case other =>
throw new RuntimeException(s"Do not support type ${other.getClass}.")
}
}
/** Computes the hash code for the types we support. */
private def hash(obj: Any): Int = {
obj match {
case map: Map[_, _] =>
map.mapValues(hash).##
case arr: Array[_] =>
// Seq.empty[T] has the same hashCode regardless of T.
arr.toSeq.map(hash).##
case x: Long =>
x.##
case x: Double =>
x.##
case x: Boolean =>
x.##
case x: String =>
x.##
case x: Metadata =>
hash(x.map)
case other =>
throw new RuntimeException(s"Do not support type ${other.getClass}.")
}
}
}
/**
* Builder for [[Metadata]]. If there is a key collision, the latter will overwrite the former.
*
* @since 1.3.0
*/
@InterfaceStability.Stable
class MetadataBuilder {
private val map: mutable.Map[String, Any] = mutable.Map.empty
/** Returns the immutable version of this map. Used for java interop. */
protected def getMap = map.toMap
/** Include the content of an existing [[Metadata]] instance. */
def withMetadata(metadata: Metadata): this.type = {
map ++= metadata.map
this
}
/** Puts a null. */
def putNull(key: String): this.type = put(key, null)
/** Puts a Long. */
def putLong(key: String, value: Long): this.type = put(key, value)
/** Puts a Double. */
def putDouble(key: String, value: Double): this.type = put(key, value)
/** Puts a Boolean. */
def putBoolean(key: String, value: Boolean): this.type = put(key, value)
/** Puts a String. */
def putString(key: String, value: String): this.type = put(key, value)
/** Puts a [[Metadata]]. */
def putMetadata(key: String, value: Metadata): this.type = put(key, value)
/** Puts a Long array. */
def putLongArray(key: String, value: Array[Long]): this.type = put(key, value)
/** Puts a Double array. */
def putDoubleArray(key: String, value: Array[Double]): this.type = put(key, value)
/** Puts a Boolean array. */
def putBooleanArray(key: String, value: Array[Boolean]): this.type = put(key, value)
/** Puts a String array. */
def putStringArray(key: String, value: Array[String]): this.type = put(key, value)
/** Puts a [[Metadata]] array. */
def putMetadataArray(key: String, value: Array[Metadata]): this.type = put(key, value)
/** Builds the [[Metadata]] instance. */
def build(): Metadata = {
new Metadata(map.toMap)
}
private def put(key: String, value: Any): this.type = {
map.put(key, value)
this
}
def remove(key: String): this.type = {
map.remove(key)
this
}
}
| {
"pile_set_name": "Github"
} |
// go run mksyscall.go -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build openbsd,386
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setgroups(ngid int, gid *_Gid_t) (err error) {
_, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
wpid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socket(domain int, typ int, proto int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Shutdown(s int, how int) (err error) {
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
_, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) {
r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
var _p0 unsafe.Pointer
if len(mib) > 0 {
_p0 = unsafe.Pointer(&mib[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimes(path string, timeval *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func futimes(fd int, timeval *[2]Timeval) (err error) {
_, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlockall(flags int) (err error) {
_, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mprotect(b []byte, prot int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Msync(b []byte, flags int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlockall() (err error) {
_, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe(p *[2]_C_int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getcwd(buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
_, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chflags(path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chmod(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chroot(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
nfd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(from int, to int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Exit(code int) {
Syscall(SYS_EXIT, uintptr(code), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchflags(fd int, flags int) (err error) {
_, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmod(fd int, mode uint32) (err error) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fpathconf(fd int, name int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, stat *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgid(pid int) (pgid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
pgid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgrp() (pgrp int) {
r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
pgrp = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpriority(which int, who int) (prio int, err error) {
r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
prio = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrtable() (rtable int, err error) {
r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0)
rtable = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getsid(pid int) (sid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
sid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Issetugid() (tainted bool) {
r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
tainted = bool(r0 != 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, signum syscall.Signal) (err error) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kqueue() (fd int, err error) {
r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lchown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Link(path string, link string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listen(s int, backlog int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdir(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkfifo(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknod(path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Open(path string, mode int, perm uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pathconf(path string, name int) (val int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func read(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Readlink(path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Rename(from string, to string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(from)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(to)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Renameat(fromfd int, from string, tofd int, to string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(from)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(to)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Revoke(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Rmdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0)
newoffset = int64(int64(r1)<<32 | int64(r0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) {
_, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setegid(egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seteuid(euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setgid(gid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setlogin(name string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(name)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpgid(pid int, pgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpriority(which int, who int, prio int) (err error) {
_, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setreuid(ruid int, euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresuid(ruid int, euid int, suid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrtable(rtable int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setsid() (pid int, err error) {
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
pid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Settimeofday(tp *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setuid(uid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, stat *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlink(path string, link string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sync() (err error) {
_, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Truncate(path string, length int64) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(newmask int) (oldmask int) {
r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
oldmask = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlink(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlinkat(dirfd int, path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func write(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0)
ret = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func munmap(addr uintptr, length uintptr) (err error) {
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
| {
"pile_set_name": "Github"
} |
{
"action": {
"hacking": {
"variety": [
"Unknown"
],
"vector": [
"Web application"
]
},
"malware": {
"variety": [
"Capture app data"
],
"vector": [
"Direct install"
]
}
},
"actor": {
"external": {
"country": [
"Unknown"
],
"motive": [
"Financial"
],
"region": [
"000000"
],
"variety": [
"Unknown"
]
}
},
"asset": {
"assets": [
{
"variety": "S - Web application"
}
],
"cloud": [
"Unknown"
],
"notes": "Following enumerations present before veris 1.3.3 removed: asset.governance.Unknown."
},
"attribute": {
"confidentiality": {
"data": [
{
"variety": "Payment"
}
],
"data_disclosure": "Potentially",
"data_victim": [
"Customer"
],
"state": [
"Unknown"
]
},
"integrity": {
"variety": [
"Software installation"
]
}
},
"discovery_method": {
"external": {
"variety": [
"Unknown"
]
}
},
"discovery_notes": "Ext - Unrelated third party. Discovered by security researcher who made the notifications.",
"impact": {
"overall_rating": "Unknown"
},
"incident_id": "7847ED3F-74C4-43A8-9D6D-070B8EEEC0D9",
"plus": {
"analysis_status": "Finalized",
"analyst": "swidup",
"attribute": {
"confidentiality": {
"credit_monitoring": "Unknown",
"data_misuse": "Y"
}
},
"created": "2016-10-25T01:05:00Z",
"dbir_year": 2017,
"github": "8631",
"master_id": "7847ED3F-74C4-43A8-9D6D-070B8EEEC0D9",
"modified": "2016-10-25T01:10:00Z",
"sub_source": "gwillem",
"timeline": {
"notification": {
"year": 2016
}
}
},
"reference": "http://www.pcworld.com/article/3131040/security/thousands-of-online-shops-compromised-for-credit-card-theft.html; https://gwillem.github.io/2016/10/11/5900-online-stores-found-skimming/; https://gitlab.com/gwillem/public-snippets/snippets/28813",
"schema_version": "1.3.4",
"security_incident": "Confirmed",
"source_id": "vcdb",
"summary": "Online skimmers are installed on vulnerable storefronts to compromise credit card data. This was found by researcher G. Willem and published in a blog post as well as numerous news articles. This one GitHub issue is expanded to one incident per storefront listed in his dataset.",
"timeline": {
"incident": {
"year": 2016
}
},
"victim": {
"country": [
"Unknown"
],
"employee_count": "Unknown",
"industry": "44",
"region": [
"000000"
],
"victim_id": "cheesecloth.ca"
}
} | {
"pile_set_name": "Github"
} |
3
2
0
4
3
0
2
1
3
0
2
2
2
2
0
0
0
2
3
2
4
4
2
0
0
4
2
2
2
3
0
2
2
0
2
2
2
17
9
0
2
2
2
3
0
9
3
0
0
2
4
0
0
2
2
0
2
2
0
2
2
2
2
0
0
2
0
10
0
21
2
3
3
2
5
0
13
1
2
2
2
3
3
0
2
0
0
0
2
3
2
3
0
0
2
15
18
15
2
5
2
2
3
3
0
2
0
2
2
2
4
2
0
5
2
2
0
2
0
2
2
2
2
2
0
2
12
3
0
0
14
0
2
7
2
0
2
2
3
2
2
2
0
0
3
14
2
2
0
2
1
2
2
0
2
0
0
3
0
0
2
0
0
2
0
2
3
0
0
2
0
2
0
2
0
0
2
0
2
0
0
2
2
0
0
2
17
0
1
0
2
2
0
2
2
9
0
2
0
2
2
2
3
2
2
1
1
0
2
5
0
2
2
0
0
2
2
3
0
3
1
3
2
2
3
2
3
0
2
3
2
0
3
0
27
0
2
0
2
2
2
2
0
2
0
0
2
0
2
0
2
0
0
0
0
0
3
2
2
2
2
2
2
2
0
0
3
5
3
0
2
2
2
2
0
0
5
2
8
0
3
2
2
3
2
2
2
1
| {
"pile_set_name": "Github"
} |
$OpenBSD$
--- indra/newview/Makefile.orig Sat Mar 24 22:27:05 2007
+++ indra/newview/Makefile Sun Mar 25 13:04:17 2007
@@ -0,0 +1,201 @@
+#
+
+PROG= secondlife
+NOMAN=
+
+SRCS!= sed 's/newview\///g' files.lst
+
+#SRCS= head.cpp llagent.cpp llagentdata.cpp llagentpilot.cpp
+#SRCS+= llanimalcontrols.cpp llassetuploadresponders.cpp
+#SRCS+= llasynchostbyname.cpp llaudiosourcevo.cpp llaudiostatus.cpp
+#SRCS+= llbbox.cpp llbox.cpp llcallbacklist.cpp llcallingcard.cpp
+#SRCS+= llcameraview.cpp llcape.cpp llchatbar.cpp llclassifiedinfo.cpp
+#SRCS+= llcloud.cpp llcolorscheme.cpp llcolorswatch.cpp llcompass.cpp
+#SRCS+= llcompilequeue.cpp llconfirmationmanager.cpp llconsole.cpp
+#SRCS+= llcontainerview.cpp llcontroldef.cpp llcountdown.cpp
+#SRCS+= llcubemap.cpp llcurrencyuimanager.cpp llcylinder.cpp
+#SRCS+= lldebugmessagebox.cpp lldebugview.cpp lldirpicker.cpp
+#SRCS+= lldrawable.cpp lldrawpool.cpp lldrawpoolalpha.cpp lldrawpoolavatar.cpp
+#SRCS+= lldrawpoolbump.cpp
+#SRCS+= lldrawpoolground.cpp lldrawpoolsimple.cpp
+#SRCS+= lldrawpoolsky.cpp lldrawpoolstars.cpp lldrawpoolterrain.cpp
+#SRCS+= lldrawpooltree.cpp lldrawpoolwater.cpp
+#SRCS+= lldriverparam.cpp lldynamictexture.cpp llemote.cpp
+#SRCS+= lleventinfo.cpp lleventnotifier.cpp lleventpoll.cpp
+#SRCS+= llface.cpp llfasttimerview.cpp llfeaturemanager.cpp
+#SRCS+= llfft.cpp llfilepicker.cpp llfirstuse.cpp llflexibleobject.cpp
+#SRCS+= llfloaterabout.cpp llfloateraccounthistory.cpp
+#SRCS+= llfloateranimpreview.cpp llfloaterauction.cpp
+#SRCS+= llfloateravatarinfo.cpp llfloateravatarpicker.cpp
+#SRCS+= llfloateravatartextures.cpp llfloaterbuildoptions.cpp
+#SRCS+= llfloaterbump.cpp llfloaterbuycontents.cpp
+#SRCS+= llfloaterbuy.cpp llfloaterbuycurrency.cpp
+#SRCS+= llfloaterbuyland.cpp llfloaterchat.cpp
+#SRCS+= llfloaterclothing.cpp llfloatercolorpicker.cpp
+#SRCS+= llfloatercustomize.cpp llfloaterdirectory.cpp
+#SRCS+= llfloatereditui.cpp llfloaterfriends.cpp
+#SRCS+= llfloatergesture.cpp llfloatergodtools.cpp
+#SRCS+= llfloatergroupinfo.cpp llfloatergroupinvite.cpp
+#SRCS+= llfloatergroups.cpp llfloaterhtml.cpp
+#SRCS+= llfloaterhtmlfind.cpp llfloaterhtmlhelp.cpp
+#SRCS+= llfloaterimagepreview.cpp llfloaterimport.cpp
+#SRCS+= llfloaterinspect.cpp llfloaterland.cpp
+#SRCS+= llfloaterlandholdings.cpp llfloatermap.cpp
+#SRCS+= llfloatermute.cpp llfloaternamedesc.cpp
+#SRCS+= llfloaternewim.cpp llfloateropenobject.cpp
+#SRCS+= llfloaterpermissionsmgr.cpp llfloaterpostcard.cpp
+#SRCS+= llfloaterpreference.cpp llfloaterproperties.cpp
+#SRCS+= llfloaterrate.cpp llfloaterregioninfo.cpp
+#SRCS+= llfloaterreporter.cpp llfloatersaveavatar.cpp
+#SRCS+= llfloaterscriptdebug.cpp llfloatersellland.cpp
+#SRCS+= llfloatersnapshot.cpp llfloatertelehub.cpp
+#SRCS+= llfloatertest.cpp llfloatertools.cpp
+#SRCS+= llfloatertopobjects.cpp llfloatertos.cpp
+#SRCS+= llfloaterworldmap.cpp llfolderview.cpp
+#SRCS+= llfollowcam.cpp llframestats.cpp
+#SRCS+= llframestatview.cpp llgenepool.cpp
+#SRCS+= llgesturemgr.cpp llgivemoney.cpp
+#SRCS+= llglsandbox.cpp llgroupmgr.cpp
+#SRCS+= llgroupnotify.cpp llhippo.cpp
+#SRCS+= llhoverview.cpp llhudconnector.cpp
+#SRCS+= llhudeffectbeam.cpp llhudeffect.cpp
+#SRCS+= llhudeffectlookat.cpp llhudeffectpointat.cpp
+#SRCS+= llhudeffecttrail.cpp llhudicon.cpp
+#SRCS+= llhudmanager.cpp llhudobject.cpp
+#SRCS+= llhudrender.cpp llhudtext.cpp
+#SRCS+= llhudview.cpp llimpanel.cpp
+#SRCS+= llimview.cpp llinventoryactions.cpp
+#SRCS+= llinventorybridge.cpp llinventoryclipboard.cpp
+#SRCS+= llinventorymodel.cpp llinventoryview.cpp
+#SRCS+= lljoystickbutton.cpp lllandmarklist.cpp
+#SRCS+= lllocalanimationobject.cpp lllogchat.cpp
+#SRCS+= llmanip.cpp llmaniprotate.cpp
+#SRCS+= llmanipscale.cpp llmaniptranslate.cpp
+#SRCS+= llmapresponders.cpp llmediaremotectrl.cpp
+#SRCS+= llmemoryview.cpp llmenucommands.cpp
+#SRCS+= llmorphview.cpp llmoveview.cpp
+#SRCS+= llmutelist.cpp llnamebox.cpp
+#SRCS+= llnameeditor.cpp llnamelistctrl.cpp
+#SRCS+= llnetmap.cpp llnotify.cpp
+#SRCS+= lloverlaybar.cpp llpanelaudioprefs.cpp
+#SRCS+= llpanelavatar.cpp llpanelclassified.cpp
+#SRCS+= llpanelcontents.cpp llpaneldebug.cpp
+#SRCS+= llpaneldirbrowser.cpp llpaneldirclassified.cpp
+#SRCS+= llpaneldirevents.cpp llpaneldirfind.cpp
+#SRCS+= llpaneldirgroups.cpp llpaneldirland.cpp
+#SRCS+= llpaneldirpeople.cpp llpaneldirplaces.cpp
+#SRCS+= llpaneldirpopular.cpp llpaneldisplay.cpp
+#SRCS+= llpanelevent.cpp llpanelface.cpp
+#SRCS+= llpanelgeneral.cpp llpanelgroup.cpp
+#SRCS+= llpanelgroupgeneral.cpp llpanelgroupinvite.cpp
+#SRCS+= llpanelgrouplandmoney.cpp llpanelgroupnotices.cpp
+#SRCS+= llpanelgrouproles.cpp llpanelgroupvoting.cpp
+#SRCS+= llpanelinput.cpp llpanelinventory.cpp
+#SRCS+= llpanelland.cpp llpanellandobjects.cpp
+#SRCS+= llpanellandoptions.cpp llpanellogin.cpp
+#SRCS+= llpanelmoney.cpp llpanelmorph.cpp
+#SRCS+= llpanelmsgs.cpp llpanelnetwork.cpp
+#SRCS+= llpanelobject.cpp llpanelpermissions.cpp
+#SRCS+= llpanelpick.cpp llpanelplace.cpp
+#SRCS+= llpanelvolume.cpp llpanelweb.cpp
+#SRCS+= llpatchvertexarray.cpp llpolymesh.cpp
+#SRCS+= llpolymorph.cpp llprefschat.cpp
+#SRCS+= llprefsim.cpp llpreviewanim.cpp
+#SRCS+= llpreview.cpp llpreviewgesture.cpp
+#SRCS+= llpreviewlandmark.cpp llpreviewnotecard.cpp
+#SRCS+= llpreviewscript.cpp llpreviewsound.cpp
+#SRCS+= llpreviewtexture.cpp llprogressview.cpp
+#SRCS+= llregionposition.cpp llroam.cpp
+#SRCS+= llsavedsettingsglue.cpp llselectmgr.cpp
+#SRCS+= llsky.cpp llspatialpartition.cpp
+#SRCS+= llsphere.cpp llsprite.cpp
+#SRCS+= llstartup.cpp llstatbar.cpp
+#SRCS+= llstatgraph.cpp llstatusbar.cpp
+#SRCS+= llstatview.cpp llsurface.cpp
+#SRCS+= llsurfacepatch.cpp lltexlayer.cpp lltexturefetch.cpp
+#SRCS+= lltexturecache.cpp lltexturectrl.cpp
+#SRCS+= lltexturetable.cpp lltextureview.cpp
+#SRCS+= lltoolbar.cpp lltoolbrush.cpp
+#SRCS+= lltoolcomp.cpp lltool.cpp
+#SRCS+= lltooldraganddrop.cpp lltoolface.cpp
+#SRCS+= lltoolfocus.cpp lltoolgrab.cpp
+#SRCS+= lltoolgun.cpp lltoolindividual.cpp
+#SRCS+= lltoolmgr.cpp lltoolmorph.cpp
+#SRCS+= lltoolobjpicker.cpp lltoolpie.cpp
+#SRCS+= lltoolpipette.cpp lltoolplacer.cpp
+#SRCS+= lltoolselect.cpp lltoolselectland.cpp
+#SRCS+= lltoolselectrect.cpp lltoolview.cpp
+#SRCS+= lltracker.cpp lluploaddialog.cpp
+#SRCS+= llurl.cpp llurlwhitelist.cpp
+#SRCS+= lluserauth.cpp llvelocitybar.cpp
+#SRCS+= llviewchildren.cpp llviewerassetstorage.cpp
+#SRCS+= llviewercamera.cpp llviewercontrol.cpp
+#SRCS+= llviewerdisplay.cpp llviewergesture.cpp
+#SRCS+= llviewerimage.cpp llviewerimagelist.cpp
+#SRCS+= llviewerinventory.cpp llviewerjointattachment.cpp
+#SRCS+= llviewerjoint.cpp llviewerjointmesh.cpp
+#SRCS+= llviewerjointshape.cpp llviewerkeyboard.cpp
+#SRCS+= llviewerlayer.cpp llviewermenu.cpp
+#SRCS+= llviewermessage.cpp llviewernetwork.cpp
+#SRCS+= llviewerobject.cpp llviewerobjectlist.cpp
+#SRCS+= llviewerparcelmgr.cpp llviewerparceloverlay.cpp
+#SRCS+= llviewerpartsim.cpp llviewerpartsource.cpp
+#SRCS+= llviewerprecompiledheaders.cpp llviewerregion.cpp
+#SRCS+= llviewerreputation.cpp llviewerstats.cpp
+#SRCS+= llviewertexteditor.cpp llviewertextureanim.cpp
+#SRCS+= llviewerthrottle.cpp llvieweruictrlfactory.cpp
+#SRCS+= llviewervisualparam.cpp llviewerwindow.cpp
+#SRCS+= llvlcomposition.cpp llvlmanager.cpp
+#SRCS+= llvoavatar.cpp llvocache.cpp
+#SRCS+= llvoclouds.cpp llvograss.cpp
+#SRCS+= llvoground.cpp llvoinventorylistener.cpp
+#SRCS+= llvolumesliderctrl.cpp llvopart.cpp
+#SRCS+= llvopartgroup.cpp llvosky.cpp
+#SRCS+= llvostars.cpp llvosurfacepatch.cpp
+#SRCS+= llvotextbubble.cpp llvotree.cpp
+#SRCS+= llvovolume.cpp
+#SRCS+= llvowater.cpp llwaterpatch.cpp
+#SRCS+= llwearable.cpp llwearablelist.cpp
+#SRCS+= llweb.cpp llwebbrowserctrl.cpp
+#SRCS+= llwind.cpp llwindebug.cpp
+#SRCS+= llworld.cpp llworldmap.cpp
+#SRCS+= llworldmapview.cpp llxmlrpctransaction.cpp
+#SRCS+= moviemaker.cpp noise.cpp
+#SRCS+= pipeline.cpp viewer.cpp
+
+INCDIRS+= llprimitive llcharacter llinventory llui lscript
+INCDIRS+= llmedia
+
+LDDIRS+= llaudio
+LDDIRS+= llcharacter
+LDDIRS+= llimage
+LDDIRS+= llimagej2coj
+LDDIRS+= llinventory
+LDDIRS+= llmath
+LDDIRS+= llmedia
+LDDIRS+= llmessage
+LDDIRS+= llprimitive
+LDDIRS+= llrender
+LDDIRS+= llui
+LDDIRS+= llvfs
+LDDIRS+= llwindow
+LDDIRS+= llxml
+LDDIRS+= lscript
+LDDIRS+= llcommon
+.for _d in ${LDDIRS}
+. if exists(${.CURDIR}/../${_d}/obj)
+LDADD+= -L${.CURDIR}/../${_d}/obj -l${_d}
+DPADD+= ${.CURDIR}/../${_d}/obj/lib${_d}.a
+. else
+LDADD+= -L${.CURDIR}/../${_d} -l${_d}
+DPADD+= ${.CURDIR}/../${_d}/lib${_d}.a
+. endif
+.endfor
+LDADD+= -L/usr/X11R6/lib -L/usr/local/lib
+LDADD+= -lgtk-x11-2.0
+LDADD+= -lcurl -lssl -lcrypto
+LDADD+= -laprutil-1-mt -lapr-1-mt -lxmlrpc-epi -lexpat -lz -lfreetype -ljpeg
+LDADD+= -lSDL -lGL -lGLU -logg -lvorbisenc -lvorbisfile -lvorbis -ldb
+LDADD+= -lopenjpeg -lfontconfig
+
+.include <bsd.prog.mk>
| {
"pile_set_name": "Github"
} |
/*
* layout.h - All NTFS associated on-disk structures. Part of the Linux-NTFS
* project.
*
* Copyright (c) 2001-2005 Anton Altaparmakov
* Copyright (c) 2002 Richard Russon
*
* This program/include file 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/include file 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 (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LINUX_NTFS_LAYOUT_H
#define _LINUX_NTFS_LAYOUT_H
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/list.h>
#include <asm/byteorder.h>
#include "types.h"
/* The NTFS oem_id "NTFS " */
#define magicNTFS cpu_to_le64(0x202020205346544eULL)
/*
* Location of bootsector on partition:
* The standard NTFS_BOOT_SECTOR is on sector 0 of the partition.
* On NT4 and above there is one backup copy of the boot sector to
* be found on the last sector of the partition (not normally accessible
* from within Windows as the bootsector contained number of sectors
* value is one less than the actual value!).
* On versions of NT 3.51 and earlier, the backup copy was located at
* number of sectors/2 (integer divide), i.e. in the middle of the volume.
*/
/*
* BIOS parameter block (bpb) structure.
*/
typedef struct {
le16 bytes_per_sector; /* Size of a sector in bytes. */
u8 sectors_per_cluster; /* Size of a cluster in sectors. */
le16 reserved_sectors; /* zero */
u8 fats; /* zero */
le16 root_entries; /* zero */
le16 sectors; /* zero */
u8 media_type; /* 0xf8 = hard disk */
le16 sectors_per_fat; /* zero */
le16 sectors_per_track; /* irrelevant */
le16 heads; /* irrelevant */
le32 hidden_sectors; /* zero */
le32 large_sectors; /* zero */
} __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK;
/*
* NTFS boot sector structure.
*/
typedef struct {
u8 jump[3]; /* Irrelevant (jump to boot up code).*/
le64 oem_id; /* Magic "NTFS ". */
BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */
u8 unused[4]; /* zero, NTFS diskedit.exe states that
this is actually:
__u8 physical_drive; // 0x80
__u8 current_head; // zero
__u8 extended_boot_signature;
// 0x80
__u8 unused; // zero
*/
/*0x28*/sle64 number_of_sectors; /* Number of sectors in volume. Gives
maximum volume size of 2^63 sectors.
Assuming standard sector size of 512
bytes, the maximum byte size is
approx. 4.7x10^21 bytes. (-; */
sle64 mft_lcn; /* Cluster location of mft data. */
sle64 mftmirr_lcn; /* Cluster location of copy of mft. */
s8 clusters_per_mft_record; /* Mft record size in clusters. */
u8 reserved0[3]; /* zero */
s8 clusters_per_index_record; /* Index block size in clusters. */
u8 reserved1[3]; /* zero */
le64 volume_serial_number; /* Irrelevant (serial number). */
le32 checksum; /* Boot sector checksum. */
/*0x54*/u8 bootstrap[426]; /* Irrelevant (boot up code). */
le16 end_of_sector_marker; /* End of bootsector magic. Always is
0xaa55 in little endian. */
/* sizeof() = 512 (0x200) bytes */
} __attribute__ ((__packed__)) NTFS_BOOT_SECTOR;
/*
* Magic identifiers present at the beginning of all ntfs record containing
* records (like mft records for example).
*/
enum {
/* Found in $MFT/$DATA. */
magic_FILE = cpu_to_le32(0x454c4946), /* Mft entry. */
magic_INDX = cpu_to_le32(0x58444e49), /* Index buffer. */
magic_HOLE = cpu_to_le32(0x454c4f48), /* ? (NTFS 3.0+?) */
/* Found in $LogFile/$DATA. */
magic_RSTR = cpu_to_le32(0x52545352), /* Restart page. */
magic_RCRD = cpu_to_le32(0x44524352), /* Log record page. */
/* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */
magic_CHKD = cpu_to_le32(0x444b4843), /* Modified by chkdsk. */
/* Found in all ntfs record containing records. */
magic_BAAD = cpu_to_le32(0x44414142), /* Failed multi sector
transfer was detected. */
/*
* Found in $LogFile/$DATA when a page is full of 0xff bytes and is
* thus not initialized. Page must be initialized before using it.
*/
magic_empty = cpu_to_le32(0xffffffff) /* Record is empty. */
};
typedef le32 NTFS_RECORD_TYPE;
/*
* Generic magic comparison macros. Finally found a use for the ## preprocessor
* operator! (-8
*/
static inline bool __ntfs_is_magic(le32 x, NTFS_RECORD_TYPE r)
{
return (x == r);
}
#define ntfs_is_magic(x, m) __ntfs_is_magic(x, magic_##m)
static inline bool __ntfs_is_magicp(le32 *p, NTFS_RECORD_TYPE r)
{
return (*p == r);
}
#define ntfs_is_magicp(p, m) __ntfs_is_magicp(p, magic_##m)
/*
* Specialised magic comparison macros for the NTFS_RECORD_TYPEs defined above.
*/
#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) )
#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) )
#define ntfs_is_mft_record(x) ( ntfs_is_file_record (x) )
#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) )
#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) )
#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) )
#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) )
#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) )
#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) )
#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) )
#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) )
#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) )
#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) )
#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) )
#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) )
#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) )
#define ntfs_is_empty_record(x) ( ntfs_is_magic (x, empty) )
#define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) )
/*
* The Update Sequence Array (usa) is an array of the le16 values which belong
* to the end of each sector protected by the update sequence record in which
* this array is contained. Note that the first entry is the Update Sequence
* Number (usn), a cyclic counter of how many times the protected record has
* been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All
* last le16's of each sector have to be equal to the usn (during reading) or
* are set to it (during writing). If they are not, an incomplete multi sector
* transfer has occurred when the data was written.
* The maximum size for the update sequence array is fixed to:
* maximum size = usa_ofs + (usa_count * 2) = 510 bytes
* The 510 bytes comes from the fact that the last le16 in the array has to
* (obviously) finish before the last le16 of the first 512-byte sector.
* This formula can be used as a consistency check in that usa_ofs +
* (usa_count * 2) has to be less than or equal to 510.
*/
typedef struct {
NTFS_RECORD_TYPE magic; /* A four-byte magic identifying the record
type and/or status. */
le16 usa_ofs; /* Offset to the Update Sequence Array (usa)
from the start of the ntfs record. */
le16 usa_count; /* Number of le16 sized entries in the usa
including the Update Sequence Number (usn),
thus the number of fixups is the usa_count
minus 1. */
} __attribute__ ((__packed__)) NTFS_RECORD;
/*
* System files mft record numbers. All these files are always marked as used
* in the bitmap attribute of the mft; presumably in order to avoid accidental
* allocation for random other mft records. Also, the sequence number for each
* of the system files is always equal to their mft record number and it is
* never modified.
*/
typedef enum {
FILE_MFT = 0, /* Master file table (mft). Data attribute
contains the entries and bitmap attribute
records which ones are in use (bit==1). */
FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records
in data attribute. If cluster size > 4kiB,
copy of first N mft records, with
N = cluster_size / mft_record_size. */
FILE_LogFile = 2, /* Journalling log in data attribute. */
FILE_Volume = 3, /* Volume name attribute and volume information
attribute (flags and ntfs version). Windows
refers to this file as volume DASD (Direct
Access Storage Device). */
FILE_AttrDef = 4, /* Array of attribute definitions in data
attribute. */
FILE_root = 5, /* Root directory. */
FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in
data attribute. */
FILE_Boot = 7, /* Boot sector (always at cluster 0) in data
attribute. */
FILE_BadClus = 8, /* Contains all bad clusters in the non-resident
data attribute. */
FILE_Secure = 9, /* Shared security descriptors in data attribute
and two indexes into the descriptors.
Appeared in Windows 2000. Before that, this
file was named $Quota but was unused. */
FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode
characters in data attribute. */
FILE_Extend = 11, /* Directory containing other system files (eg.
$ObjId, $Quota, $Reparse and $UsnJrnl). This
is new to NTFS3.0. */
FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */
FILE_reserved13 = 13,
FILE_reserved14 = 14,
FILE_reserved15 = 15,
FILE_first_user = 16, /* First user file, used as test limit for
whether to allow opening a file or not. */
} NTFS_SYSTEM_FILES;
/*
* These are the so far known MFT_RECORD_* flags (16-bit) which contain
* information about the mft record in which they are present.
*/
enum {
MFT_RECORD_IN_USE = cpu_to_le16(0x0001),
MFT_RECORD_IS_DIRECTORY = cpu_to_le16(0x0002),
} __attribute__ ((__packed__));
typedef le16 MFT_RECORD_FLAGS;
/*
* Typedef the MFT_REF as a 64-bit value for easier handling.
* Also define two unpacking macros to get to the reference (MREF) and
* sequence number (MSEQNO) respectively.
* The _LE versions are to be applied on little endian MFT_REFs.
* Note: The _LE versions will return a CPU endian formatted value!
*/
#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL
#define MFT_REF_MASK_LE cpu_to_le64(MFT_REF_MASK_CPU)
typedef u64 MFT_REF;
typedef le64 leMFT_REF;
#define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \
((MFT_REF)(m) & MFT_REF_MASK_CPU)))
#define MK_LE_MREF(m, s) cpu_to_le64(MK_MREF(m, s))
#define MREF(x) ((unsigned long)((x) & MFT_REF_MASK_CPU))
#define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff))
#define MREF_LE(x) ((unsigned long)(le64_to_cpu(x) & MFT_REF_MASK_CPU))
#define MSEQNO_LE(x) ((u16)((le64_to_cpu(x) >> 48) & 0xffff))
#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? true : false)
#define ERR_MREF(x) ((u64)((s64)(x)))
#define MREF_ERR(x) ((int)((s64)(x)))
/*
* The mft record header present at the beginning of every record in the mft.
* This is followed by a sequence of variable length attribute records which
* is terminated by an attribute of type AT_END which is a truncated attribute
* in that it only consists of the attribute type code AT_END and none of the
* other members of the attribute structure are present.
*/
typedef struct {
/*Ofs*/
/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */
NTFS_RECORD_TYPE magic; /* Usually the magic is "FILE". */
le16 usa_ofs; /* See NTFS_RECORD definition above. */
le16 usa_count; /* See NTFS_RECORD definition above. */
/* 8*/ le64 lsn; /* $LogFile sequence number for this record.
Changed every time the record is modified. */
/* 16*/ le16 sequence_number; /* Number of times this mft record has been
reused. (See description for MFT_REF
above.) NOTE: The increment (skipping zero)
is done when the file is deleted. NOTE: If
this is zero it is left zero. */
/* 18*/ le16 link_count;
/* 20*/ le16 attrs_offset; /* Byte offset to the first attribute in this
mft record from the start of the mft record.
NOTE: Must be aligned to 8-byte boundary. */
/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file
is deleted, the MFT_RECORD_IN_USE flag is
set to zero. */
/* 24*/ le32 bytes_in_use; /* Number of bytes used in this mft record.
NOTE: Must be aligned to 8-byte boundary. */
/* 28*/ le32 bytes_allocated; /* Number of bytes allocated for this mft
record. This should be equal to the mft
record size. */
/* 32*/ leMFT_REF base_mft_record;/* This is zero for base mft records.
When it is not zero it is a mft reference
pointing to the base mft record to which
this record belongs (this is then used to
locate the attribute list attribute present
in the base record which describes this
extension record and hence might need
modification when the extension record
itself is modified, also locating the
attribute list also means finding the other
potential extents, belonging to the non-base
mft record). */
/* 40*/ le16 next_attr_instance;/* The instance number that will be assigned to
the next attribute added to this mft record.
NOTE: Incremented each time after it is used.
NOTE: Every time the mft record is reused
this number is set to zero. NOTE: The first
instance number is always 0. */
/* The below fields are specific to NTFS 3.1+ (Windows XP and above): */
/* 42*/ le16 reserved; /* Reserved/alignment. */
/* 44*/ le32 mft_record_number; /* Number of this mft record. */
/* sizeof() = 48 bytes */
/*
* When (re)using the mft record, we place the update sequence array at this
* offset, i.e. before we start with the attributes. This also makes sense,
* otherwise we could run into problems with the update sequence array
* containing in itself the last two bytes of a sector which would mean that
* multi sector transfer protection wouldn't work. As you can't protect data
* by overwriting it since you then can't get it back...
* When reading we obviously use the data from the ntfs record header.
*/
} __attribute__ ((__packed__)) MFT_RECORD;
/* This is the version without the NTFS 3.1+ specific fields. */
typedef struct {
/*Ofs*/
/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */
NTFS_RECORD_TYPE magic; /* Usually the magic is "FILE". */
le16 usa_ofs; /* See NTFS_RECORD definition above. */
le16 usa_count; /* See NTFS_RECORD definition above. */
/* 8*/ le64 lsn; /* $LogFile sequence number for this record.
Changed every time the record is modified. */
/* 16*/ le16 sequence_number; /* Number of times this mft record has been
reused. (See description for MFT_REF
above.) NOTE: The increment (skipping zero)
is done when the file is deleted. NOTE: If
this is zero it is left zero. */
/* 18*/ le16 link_count;
/* 20*/ le16 attrs_offset; /* Byte offset to the first attribute in this
mft record from the start of the mft record.
NOTE: Must be aligned to 8-byte boundary. */
/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file
is deleted, the MFT_RECORD_IN_USE flag is
set to zero. */
/* 24*/ le32 bytes_in_use; /* Number of bytes used in this mft record.
NOTE: Must be aligned to 8-byte boundary. */
/* 28*/ le32 bytes_allocated; /* Number of bytes allocated for this mft
record. This should be equal to the mft
record size. */
/* 32*/ leMFT_REF base_mft_record;/* This is zero for base mft records.
When it is not zero it is a mft reference
pointing to the base mft record to which
this record belongs (this is then used to
locate the attribute list attribute present
in the base record which describes this
extension record and hence might need
modification when the extension record
itself is modified, also locating the
attribute list also means finding the other
potential extents, belonging to the non-base
mft record). */
/* 40*/ le16 next_attr_instance;/* The instance number that will be assigned to
the next attribute added to this mft record.
NOTE: Incremented each time after it is used.
NOTE: Every time the mft record is reused
this number is set to zero. NOTE: The first
instance number is always 0. */
/* sizeof() = 42 bytes */
/*
* When (re)using the mft record, we place the update sequence array at this
* offset, i.e. before we start with the attributes. This also makes sense,
* otherwise we could run into problems with the update sequence array
* containing in itself the last two bytes of a sector which would mean that
* multi sector transfer protection wouldn't work. As you can't protect data
* by overwriting it since you then can't get it back...
* When reading we obviously use the data from the ntfs record header.
*/
} __attribute__ ((__packed__)) MFT_RECORD_OLD;
/*
* System defined attributes (32-bit). Each attribute type has a corresponding
* attribute name (Unicode string of maximum 64 character length) as described
* by the attribute definitions present in the data attribute of the $AttrDef
* system file. On NTFS 3.0 volumes the names are just as the types are named
* in the below defines exchanging AT_ for the dollar sign ($). If that is not
* a revealing choice of symbol I do not know what is... (-;
*/
enum {
AT_UNUSED = cpu_to_le32( 0),
AT_STANDARD_INFORMATION = cpu_to_le32( 0x10),
AT_ATTRIBUTE_LIST = cpu_to_le32( 0x20),
AT_FILE_NAME = cpu_to_le32( 0x30),
AT_OBJECT_ID = cpu_to_le32( 0x40),
AT_SECURITY_DESCRIPTOR = cpu_to_le32( 0x50),
AT_VOLUME_NAME = cpu_to_le32( 0x60),
AT_VOLUME_INFORMATION = cpu_to_le32( 0x70),
AT_DATA = cpu_to_le32( 0x80),
AT_INDEX_ROOT = cpu_to_le32( 0x90),
AT_INDEX_ALLOCATION = cpu_to_le32( 0xa0),
AT_BITMAP = cpu_to_le32( 0xb0),
AT_REPARSE_POINT = cpu_to_le32( 0xc0),
AT_EA_INFORMATION = cpu_to_le32( 0xd0),
AT_EA = cpu_to_le32( 0xe0),
AT_PROPERTY_SET = cpu_to_le32( 0xf0),
AT_LOGGED_UTILITY_STREAM = cpu_to_le32( 0x100),
AT_FIRST_USER_DEFINED_ATTRIBUTE = cpu_to_le32( 0x1000),
AT_END = cpu_to_le32(0xffffffff)
};
typedef le32 ATTR_TYPE;
/*
* The collation rules for sorting views/indexes/etc (32-bit).
*
* COLLATION_BINARY - Collate by binary compare where the first byte is most
* significant.
* COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary
* Unicode values, except that when a character can be uppercased, the
* upper case value collates before the lower case one.
* COLLATION_FILE_NAME - Collate file names as Unicode strings. The collation
* is done very much like COLLATION_UNICODE_STRING. In fact I have no idea
* what the difference is. Perhaps the difference is that file names
* would treat some special characters in an odd way (see
* unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[]
* for what I mean but COLLATION_UNICODE_STRING would not give any special
* treatment to any characters at all, but this is speculation.
* COLLATION_NTOFS_ULONG - Sorting is done according to ascending le32 key
* values. E.g. used for $SII index in FILE_Secure, which sorts by
* security_id (le32).
* COLLATION_NTOFS_SID - Sorting is done according to ascending SID values.
* E.g. used for $O index in FILE_Extend/$Quota.
* COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash
* values and second by ascending security_id values. E.g. used for $SDH
* index in FILE_Secure.
* COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending
* le32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which
* sorts by object_id (16-byte), by splitting up the object_id in four
* le32 values and using them as individual keys. E.g. take the following
* two security_ids, stored as follows on disk:
* 1st: a1 61 65 b7 65 7b d4 11 9e 3d 00 e0 81 10 42 59
* 2nd: 38 14 37 d2 d2 f3 d4 11 a5 21 c8 6b 79 b1 97 45
* To compare them, they are split into four le32 values each, like so:
* 1st: 0xb76561a1 0x11d47b65 0xe0003d9e 0x59421081
* 2nd: 0xd2371438 0x11d4f3d2 0x6bc821a5 0x4597b179
* Now, it is apparent why the 2nd object_id collates after the 1st: the
* first le32 value of the 1st object_id is less than the first le32 of
* the 2nd object_id. If the first le32 values of both object_ids were
* equal then the second le32 values would be compared, etc.
*/
enum {
COLLATION_BINARY = cpu_to_le32(0x00),
COLLATION_FILE_NAME = cpu_to_le32(0x01),
COLLATION_UNICODE_STRING = cpu_to_le32(0x02),
COLLATION_NTOFS_ULONG = cpu_to_le32(0x10),
COLLATION_NTOFS_SID = cpu_to_le32(0x11),
COLLATION_NTOFS_SECURITY_HASH = cpu_to_le32(0x12),
COLLATION_NTOFS_ULONGS = cpu_to_le32(0x13),
};
typedef le32 COLLATION_RULE;
enum {
ATTR_DEF_INDEXABLE = cpu_to_le32(0x02), /* Attribute can be
indexed. */
ATTR_DEF_MULTIPLE = cpu_to_le32(0x04), /* Attribute type
can be present multiple times in the
mft records of an inode. */
ATTR_DEF_NOT_ZERO = cpu_to_le32(0x08), /* Attribute value
must contain at least one non-zero
byte. */
ATTR_DEF_INDEXED_UNIQUE = cpu_to_le32(0x10), /* Attribute must be
indexed and the attribute value must be
unique for the attribute type in all of
the mft records of an inode. */
ATTR_DEF_NAMED_UNIQUE = cpu_to_le32(0x20), /* Attribute must be
named and the name must be unique for
the attribute type in all of the mft
records of an inode. */
ATTR_DEF_RESIDENT = cpu_to_le32(0x40), /* Attribute must be
resident. */
ATTR_DEF_ALWAYS_LOG = cpu_to_le32(0x80), /* Always log
modifications to this attribute,
regardless of whether it is resident or
non-resident. Without this, only log
modifications if the attribute is
resident. */
};
typedef le32 ATTR_DEF_FLAGS;
/*
* The data attribute of FILE_AttrDef contains a sequence of attribute
* definitions for the NTFS volume. With this, it is supposed to be safe for an
* older NTFS driver to mount a volume containing a newer NTFS version without
* damaging it (that's the theory. In practice it's: not damaging it too much).
* Entries are sorted by attribute type. The flags describe whether the
* attribute can be resident/non-resident and possibly other things, but the
* actual bits are unknown.
*/
typedef struct {
/*hex ofs*/
/* 0*/ ntfschar name[0x40]; /* Unicode name of the attribute. Zero
terminated. */
/* 80*/ ATTR_TYPE type; /* Type of the attribute. */
/* 84*/ le32 display_rule;
/* 88*/ COLLATION_RULE collation_rule; /* Default collation rule. */
/* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */
/* 90*/ sle64 min_size; /* Optional minimum attribute size. */
/* 98*/ sle64 max_size; /* Maximum size of attribute. */
/* sizeof() = 0xa0 or 160 bytes */
} __attribute__ ((__packed__)) ATTR_DEF;
/*
* Attribute flags (16-bit).
*/
enum {
ATTR_IS_COMPRESSED = cpu_to_le16(0x0001),
ATTR_COMPRESSION_MASK = cpu_to_le16(0x00ff), /* Compression method
mask. Also, first
illegal value. */
ATTR_IS_ENCRYPTED = cpu_to_le16(0x4000),
ATTR_IS_SPARSE = cpu_to_le16(0x8000),
} __attribute__ ((__packed__));
typedef le16 ATTR_FLAGS;
/*
* Attribute compression.
*
* Only the data attribute is ever compressed in the current ntfs driver in
* Windows. Further, compression is only applied when the data attribute is
* non-resident. Finally, to use compression, the maximum allowed cluster size
* on a volume is 4kib.
*
* The compression method is based on independently compressing blocks of X
* clusters, where X is determined from the compression_unit value found in the
* non-resident attribute record header (more precisely: X = 2^compression_unit
* clusters). On Windows NT/2k, X always is 16 clusters (compression_unit = 4).
*
* There are three different cases of how a compression block of X clusters
* can be stored:
*
* 1) The data in the block is all zero (a sparse block):
* This is stored as a sparse block in the runlist, i.e. the runlist
* entry has length = X and lcn = -1. The mapping pairs array actually
* uses a delta_lcn value length of 0, i.e. delta_lcn is not present at
* all, which is then interpreted by the driver as lcn = -1.
* NOTE: Even uncompressed files can be sparse on NTFS 3.0 volumes, then
* the same principles apply as above, except that the length is not
* restricted to being any particular value.
*
* 2) The data in the block is not compressed:
* This happens when compression doesn't reduce the size of the block
* in clusters. I.e. if compression has a small effect so that the
* compressed data still occupies X clusters, then the uncompressed data
* is stored in the block.
* This case is recognised by the fact that the runlist entry has
* length = X and lcn >= 0. The mapping pairs array stores this as
* normal with a run length of X and some specific delta_lcn, i.e.
* delta_lcn has to be present.
*
* 3) The data in the block is compressed:
* The common case. This case is recognised by the fact that the run
* list entry has length L < X and lcn >= 0. The mapping pairs array
* stores this as normal with a run length of X and some specific
* delta_lcn, i.e. delta_lcn has to be present. This runlist entry is
* immediately followed by a sparse entry with length = X - L and
* lcn = -1. The latter entry is to make up the vcn counting to the
* full compression block size X.
*
* In fact, life is more complicated because adjacent entries of the same type
* can be coalesced. This means that one has to keep track of the number of
* clusters handled and work on a basis of X clusters at a time being one
* block. An example: if length L > X this means that this particular runlist
* entry contains a block of length X and part of one or more blocks of length
* L - X. Another example: if length L < X, this does not necessarily mean that
* the block is compressed as it might be that the lcn changes inside the block
* and hence the following runlist entry describes the continuation of the
* potentially compressed block. The block would be compressed if the
* following runlist entry describes at least X - L sparse clusters, thus
* making up the compression block length as described in point 3 above. (Of
* course, there can be several runlist entries with small lengths so that the
* sparse entry does not follow the first data containing entry with
* length < X.)
*
* NOTE: At the end of the compressed attribute value, there most likely is not
* just the right amount of data to make up a compression block, thus this data
* is not even attempted to be compressed. It is just stored as is, unless
* the number of clusters it occupies is reduced when compressed in which case
* it is stored as a compressed compression block, complete with sparse
* clusters at the end.
*/
/*
* Flags of resident attributes (8-bit).
*/
enum {
RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index
(has implications for deleting and
modifying the attribute). */
} __attribute__ ((__packed__));
typedef u8 RESIDENT_ATTR_FLAGS;
/*
* Attribute record header. Always aligned to 8-byte boundary.
*/
typedef struct {
/*Ofs*/
/* 0*/ ATTR_TYPE type; /* The (32-bit) type of the attribute. */
/* 4*/ le32 length; /* Byte size of the resident part of the
attribute (aligned to 8-byte boundary).
Used to get to the next attribute. */
/* 8*/ u8 non_resident; /* If 0, attribute is resident.
If 1, attribute is non-resident. */
/* 9*/ u8 name_length; /* Unicode character size of name of attribute.
0 if unnamed. */
/* 10*/ le16 name_offset; /* If name_length != 0, the byte offset to the
beginning of the name from the attribute
record. Note that the name is stored as a
Unicode string. When creating, place offset
just at the end of the record header. Then,
follow with attribute value or mapping pairs
array, resident and non-resident attributes
respectively, aligning to an 8-byte
boundary. */
/* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */
/* 14*/ le16 instance; /* The instance of this attribute record. This
number is unique within this mft record (see
MFT_RECORD/next_attribute_instance notes in
in mft.h for more details). */
/* 16*/ union {
/* Resident attributes. */
struct {
/* 16 */ le32 value_length;/* Byte size of attribute value. */
/* 20 */ le16 value_offset;/* Byte offset of the attribute
value from the start of the
attribute record. When creating,
align to 8-byte boundary if we
have a name present as this might
not have a length of a multiple
of 8-bytes. */
/* 22 */ RESIDENT_ATTR_FLAGS flags; /* See above. */
/* 23 */ s8 reserved; /* Reserved/alignment to 8-byte
boundary. */
} __attribute__ ((__packed__)) resident;
/* Non-resident attributes. */
struct {
/* 16*/ leVCN lowest_vcn;/* Lowest valid virtual cluster number
for this portion of the attribute value or
0 if this is the only extent (usually the
case). - Only when an attribute list is used
does lowest_vcn != 0 ever occur. */
/* 24*/ leVCN highest_vcn;/* Highest valid vcn of this extent of
the attribute value. - Usually there is only one
portion, so this usually equals the attribute
value size in clusters minus 1. Can be -1 for
zero length files. Can be 0 for "single extent"
attributes. */
/* 32*/ le16 mapping_pairs_offset; /* Byte offset from the
beginning of the structure to the mapping pairs
array which contains the mappings between the
vcns and the logical cluster numbers (lcns).
When creating, place this at the end of this
record header aligned to 8-byte boundary. */
/* 34*/ u8 compression_unit; /* The compression unit expressed
as the log to the base 2 of the number of
clusters in a compression unit. 0 means not
compressed. (This effectively limits the
compression unit size to be a power of two
clusters.) WinNT4 only uses a value of 4.
Sparse files have this set to 0 on XPSP2. */
/* 35*/ u8 reserved[5]; /* Align to 8-byte boundary. */
/* The sizes below are only used when lowest_vcn is zero, as otherwise it would
be difficult to keep them up-to-date.*/
/* 40*/ sle64 allocated_size; /* Byte size of disk space
allocated to hold the attribute value. Always
is a multiple of the cluster size. When a file
is compressed, this field is a multiple of the
compression block size (2^compression_unit) and
it represents the logically allocated space
rather than the actual on disk usage. For this
use the compressed_size (see below). */
/* 48*/ sle64 data_size; /* Byte size of the attribute
value. Can be larger than allocated_size if
attribute value is compressed or sparse. */
/* 56*/ sle64 initialized_size; /* Byte size of initialized
portion of the attribute value. Usually equals
data_size. */
/* sizeof(uncompressed attr) = 64*/
/* 64*/ sle64 compressed_size; /* Byte size of the attribute
value after compression. Only present when
compressed or sparse. Always is a multiple of
the cluster size. Represents the actual amount
of disk space being used on the disk. */
/* sizeof(compressed attr) = 72*/
} __attribute__ ((__packed__)) non_resident;
} __attribute__ ((__packed__)) data;
} __attribute__ ((__packed__)) ATTR_RECORD;
typedef ATTR_RECORD ATTR_REC;
/*
* File attribute flags (32-bit) appearing in the file_attributes fields of the
* STANDARD_INFORMATION attribute of MFT_RECORDs and the FILENAME_ATTR
* attributes of MFT_RECORDs and directory index entries.
*
* All of the below flags appear in the directory index entries but only some
* appear in the STANDARD_INFORMATION attribute whilst only some others appear
* in the FILENAME_ATTR attribute of MFT_RECORDs. Unless otherwise stated the
* flags appear in all of the above.
*/
enum {
FILE_ATTR_READONLY = cpu_to_le32(0x00000001),
FILE_ATTR_HIDDEN = cpu_to_le32(0x00000002),
FILE_ATTR_SYSTEM = cpu_to_le32(0x00000004),
/* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */
FILE_ATTR_DIRECTORY = cpu_to_le32(0x00000010),
/* Note, FILE_ATTR_DIRECTORY is not considered valid in NT. It is
reserved for the DOS SUBDIRECTORY flag. */
FILE_ATTR_ARCHIVE = cpu_to_le32(0x00000020),
FILE_ATTR_DEVICE = cpu_to_le32(0x00000040),
FILE_ATTR_NORMAL = cpu_to_le32(0x00000080),
FILE_ATTR_TEMPORARY = cpu_to_le32(0x00000100),
FILE_ATTR_SPARSE_FILE = cpu_to_le32(0x00000200),
FILE_ATTR_REPARSE_POINT = cpu_to_le32(0x00000400),
FILE_ATTR_COMPRESSED = cpu_to_le32(0x00000800),
FILE_ATTR_OFFLINE = cpu_to_le32(0x00001000),
FILE_ATTR_NOT_CONTENT_INDEXED = cpu_to_le32(0x00002000),
FILE_ATTR_ENCRYPTED = cpu_to_le32(0x00004000),
FILE_ATTR_VALID_FLAGS = cpu_to_le32(0x00007fb7),
/* Note, FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the
FILE_ATTR_DEVICE and preserves everything else. This mask is used
to obtain all flags that are valid for reading. */
FILE_ATTR_VALID_SET_FLAGS = cpu_to_le32(0x000031a7),
/* Note, FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the
F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT,
F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest. This mask
is used to obtain all flags that are valid for setting. */
/*
* The flag FILE_ATTR_DUP_FILENAME_INDEX_PRESENT is present in all
* FILENAME_ATTR attributes but not in the STANDARD_INFORMATION
* attribute of an mft record.
*/
FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = cpu_to_le32(0x10000000),
/* Note, this is a copy of the corresponding bit from the mft record,
telling us whether this is a directory or not, i.e. whether it has
an index root attribute or not. */
FILE_ATTR_DUP_VIEW_INDEX_PRESENT = cpu_to_le32(0x20000000),
/* Note, this is a copy of the corresponding bit from the mft record,
telling us whether this file has a view index present (eg. object id
index, quota index, one of the security indexes or the encrypting
filesystem related indexes). */
};
typedef le32 FILE_ATTR_FLAGS;
/*
* NOTE on times in NTFS: All times are in MS standard time format, i.e. they
* are the number of 100-nanosecond intervals since 1st January 1601, 00:00:00
* universal coordinated time (UTC). (In Linux time starts 1st January 1970,
* 00:00:00 UTC and is stored as the number of 1-second intervals since then.)
*/
/*
* Attribute: Standard information (0x10).
*
* NOTE: Always resident.
* NOTE: Present in all base file records on a volume.
* NOTE: There is conflicting information about the meaning of each of the time
* fields but the meaning as defined below has been verified to be
* correct by practical experimentation on Windows NT4 SP6a and is hence
* assumed to be the one and only correct interpretation.
*/
typedef struct {
/*Ofs*/
/* 0*/ sle64 creation_time; /* Time file was created. Updated when
a filename is changed(?). */
/* 8*/ sle64 last_data_change_time; /* Time the data attribute was last
modified. */
/* 16*/ sle64 last_mft_change_time; /* Time this mft record was last
modified. */
/* 24*/ sle64 last_access_time; /* Approximate time when the file was
last accessed (obviously this is not
updated on read-only volumes). In
Windows this is only updated when
accessed if some time delta has
passed since the last update. Also,
last access time updates can be
disabled altogether for speed. */
/* 32*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */
/* 36*/ union {
/* NTFS 1.2 */
struct {
/* 36*/ u8 reserved12[12]; /* Reserved/alignment to 8-byte
boundary. */
} __attribute__ ((__packed__)) v1;
/* sizeof() = 48 bytes */
/* NTFS 3.x */
struct {
/*
* If a volume has been upgraded from a previous NTFS version, then these
* fields are present only if the file has been accessed since the upgrade.
* Recognize the difference by comparing the length of the resident attribute
* value. If it is 48, then the following fields are missing. If it is 72 then
* the fields are present. Maybe just check like this:
* if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) {
* Assume NTFS 1.2- format.
* If (volume version is 3.x)
* Upgrade attribute to NTFS 3.x format.
* else
* Use NTFS 1.2- format for access.
* } else
* Use NTFS 3.x format for access.
* Only problem is that it might be legal to set the length of the value to
* arbitrarily large values thus spoiling this check. - But chkdsk probably
* views that as a corruption, assuming that it behaves like this for all
* attributes.
*/
/* 36*/ le32 maximum_versions; /* Maximum allowed versions for
file. Zero if version numbering is disabled. */
/* 40*/ le32 version_number; /* This file's version (if any).
Set to zero if maximum_versions is zero. */
/* 44*/ le32 class_id; /* Class id from bidirectional
class id index (?). */
/* 48*/ le32 owner_id; /* Owner_id of the user owning
the file. Translate via $Q index in FILE_Extend
/$Quota to the quota control entry for the user
owning the file. Zero if quotas are disabled. */
/* 52*/ le32 security_id; /* Security_id for the file.
Translate via $SII index and $SDS data stream
in FILE_Secure to the security descriptor. */
/* 56*/ le64 quota_charged; /* Byte size of the charge to
the quota for all streams of the file. Note: Is
zero if quotas are disabled. */
/* 64*/ leUSN usn; /* Last update sequence number
of the file. This is a direct index into the
transaction log file ($UsnJrnl). It is zero if
the usn journal is disabled or this file has
not been subject to logging yet. See usnjrnl.h
for details. */
} __attribute__ ((__packed__)) v3;
/* sizeof() = 72 bytes (NTFS 3.x) */
} __attribute__ ((__packed__)) ver;
} __attribute__ ((__packed__)) STANDARD_INFORMATION;
/*
* Attribute: Attribute list (0x20).
*
* - Can be either resident or non-resident.
* - Value consists of a sequence of variable length, 8-byte aligned,
* ATTR_LIST_ENTRY records.
* - The list is not terminated by anything at all! The only way to know when
* the end is reached is to keep track of the current offset and compare it to
* the attribute value size.
* - The attribute list attribute contains one entry for each attribute of
* the file in which the list is located, except for the list attribute
* itself. The list is sorted: first by attribute type, second by attribute
* name (if present), third by instance number. The extents of one
* non-resident attribute (if present) immediately follow after the initial
* extent. They are ordered by lowest_vcn and have their instace set to zero.
* It is not allowed to have two attributes with all sorting keys equal.
* - Further restrictions:
* - If not resident, the vcn to lcn mapping array has to fit inside the
* base mft record.
* - The attribute list attribute value has a maximum size of 256kb. This
* is imposed by the Windows cache manager.
* - Attribute lists are only used when the attributes of mft record do not
* fit inside the mft record despite all attributes (that can be made
* non-resident) having been made non-resident. This can happen e.g. when:
* - File has a large number of hard links (lots of file name
* attributes present).
* - The mapping pairs array of some non-resident attribute becomes so
* large due to fragmentation that it overflows the mft record.
* - The security descriptor is very complex (not applicable to
* NTFS 3.0 volumes).
* - There are many named streams.
*/
typedef struct {
/*Ofs*/
/* 0*/ ATTR_TYPE type; /* Type of referenced attribute. */
/* 4*/ le16 length; /* Byte size of this entry (8-byte aligned). */
/* 6*/ u8 name_length; /* Size in Unicode chars of the name of the
attribute or 0 if unnamed. */
/* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name
(always set this to where the name would
start even if unnamed). */
/* 8*/ leVCN lowest_vcn; /* Lowest virtual cluster number of this portion
of the attribute value. This is usually 0. It
is non-zero for the case where one attribute
does not fit into one mft record and thus
several mft records are allocated to hold
this attribute. In the latter case, each mft
record holds one extent of the attribute and
there is one attribute list entry for each
extent. NOTE: This is DEFINITELY a signed
value! The windows driver uses cmp, followed
by jg when comparing this, thus it treats it
as signed. */
/* 16*/ leMFT_REF mft_reference;/* The reference of the mft record holding
the ATTR_RECORD for this portion of the
attribute value. */
/* 24*/ le16 instance; /* If lowest_vcn = 0, the instance of the
attribute being referenced; otherwise 0. */
/* 26*/ ntfschar name[0]; /* Use when creating only. When reading use
name_offset to determine the location of the
name. */
/* sizeof() = 26 + (attribute_name_length * 2) bytes */
} __attribute__ ((__packed__)) ATTR_LIST_ENTRY;
/*
* The maximum allowed length for a file name.
*/
#define MAXIMUM_FILE_NAME_LENGTH 255
/*
* Possible namespaces for filenames in ntfs (8-bit).
*/
enum {
FILE_NAME_POSIX = 0x00,
/* This is the largest namespace. It is case sensitive and allows all
Unicode characters except for: '\0' and '/'. Beware that in
WinNT/2k/2003 by default files which eg have the same name except
for their case will not be distinguished by the standard utilities
and thus a "del filename" will delete both "filename" and "fileName"
without warning. However if for example Services For Unix (SFU) are
installed and the case sensitive option was enabled at installation
time, then you can create/access/delete such files.
Note that even SFU places restrictions on the filenames beyond the
'\0' and '/' and in particular the following set of characters is
not allowed: '"', '/', '<', '>', '\'. All other characters,
including the ones no allowed in WIN32 namespace are allowed.
Tested with SFU 3.5 (this is now free) running on Windows XP. */
FILE_NAME_WIN32 = 0x01,
/* The standard WinNT/2k NTFS long filenames. Case insensitive. All
Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\',
and '|'. Further, names cannot end with a '.' or a space. */
FILE_NAME_DOS = 0x02,
/* The standard DOS filenames (8.3 format). Uppercase only. All 8-bit
characters greater space, except: '"', '*', '+', ',', '/', ':', ';',
'<', '=', '>', '?', and '\'. */
FILE_NAME_WIN32_AND_DOS = 0x03,
/* 3 means that both the Win32 and the DOS filenames are identical and
hence have been saved in this single filename record. */
} __attribute__ ((__packed__));
typedef u8 FILE_NAME_TYPE_FLAGS;
/*
* Attribute: Filename (0x30).
*
* NOTE: Always resident.
* NOTE: All fields, except the parent_directory, are only updated when the
* filename is changed. Until then, they just become out of sync with
* reality and the more up to date values are present in the standard
* information attribute.
* NOTE: There is conflicting information about the meaning of each of the time
* fields but the meaning as defined below has been verified to be
* correct by practical experimentation on Windows NT4 SP6a and is hence
* assumed to be the one and only correct interpretation.
*/
typedef struct {
/*hex ofs*/
/* 0*/ leMFT_REF parent_directory; /* Directory this filename is
referenced from. */
/* 8*/ sle64 creation_time; /* Time file was created. */
/* 10*/ sle64 last_data_change_time; /* Time the data attribute was last
modified. */
/* 18*/ sle64 last_mft_change_time; /* Time this mft record was last
modified. */
/* 20*/ sle64 last_access_time; /* Time this mft record was last
accessed. */
/* 28*/ sle64 allocated_size; /* Byte size of on-disk allocated space
for the unnamed data attribute. So
for normal $DATA, this is the
allocated_size from the unnamed
$DATA attribute and for compressed
and/or sparse $DATA, this is the
compressed_size from the unnamed
$DATA attribute. For a directory or
other inode without an unnamed $DATA
attribute, this is always 0. NOTE:
This is a multiple of the cluster
size. */
/* 30*/ sle64 data_size; /* Byte size of actual data in unnamed
data attribute. For a directory or
other inode without an unnamed $DATA
attribute, this is always 0. */
/* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */
/* 3c*/ union {
/* 3c*/ struct {
/* 3c*/ le16 packed_ea_size; /* Size of the buffer needed to
pack the extended attributes
(EAs), if such are present.*/
/* 3e*/ le16 reserved; /* Reserved for alignment. */
} __attribute__ ((__packed__)) ea;
/* 3c*/ struct {
/* 3c*/ le32 reparse_point_tag; /* Type of reparse point,
present only in reparse
points and only if there are
no EAs. */
} __attribute__ ((__packed__)) rp;
} __attribute__ ((__packed__)) type;
/* 40*/ u8 file_name_length; /* Length of file name in
(Unicode) characters. */
/* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/
/* 42*/ ntfschar file_name[0]; /* File name in Unicode. */
} __attribute__ ((__packed__)) FILE_NAME_ATTR;
/*
* GUID structures store globally unique identifiers (GUID). A GUID is a
* 128-bit value consisting of one group of eight hexadecimal digits, followed
* by three groups of four hexadecimal digits each, followed by one group of
* twelve hexadecimal digits. GUIDs are Microsoft's implementation of the
* distributed computing environment (DCE) universally unique identifier (UUID).
* Example of a GUID:
* 1F010768-5A73-BC91-0010A52216A7
*/
typedef struct {
le32 data1; /* The first eight hexadecimal digits of the GUID. */
le16 data2; /* The first group of four hexadecimal digits. */
le16 data3; /* The second group of four hexadecimal digits. */
u8 data4[8]; /* The first two bytes are the third group of four
hexadecimal digits. The remaining six bytes are the
final 12 hexadecimal digits. */
} __attribute__ ((__packed__)) GUID;
/*
* FILE_Extend/$ObjId contains an index named $O. This index contains all
* object_ids present on the volume as the index keys and the corresponding
* mft_record numbers as the index entry data parts. The data part (defined
* below) also contains three other object_ids:
* birth_volume_id - object_id of FILE_Volume on which the file was first
* created. Optional (i.e. can be zero).
* birth_object_id - object_id of file when it was first created. Usually
* equals the object_id. Optional (i.e. can be zero).
* domain_id - Reserved (always zero).
*/
typedef struct {
leMFT_REF mft_reference;/* Mft record containing the object_id in
the index entry key. */
union {
struct {
GUID birth_volume_id;
GUID birth_object_id;
GUID domain_id;
} __attribute__ ((__packed__)) origin;
u8 extended_info[48];
} __attribute__ ((__packed__)) opt;
} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA;
/*
* Attribute: Object id (NTFS 3.0+) (0x40).
*
* NOTE: Always resident.
*/
typedef struct {
GUID object_id; /* Unique id assigned to the
file.*/
/* The following fields are optional. The attribute value size is 16
bytes, i.e. sizeof(GUID), if these are not present at all. Note,
the entries can be present but one or more (or all) can be zero
meaning that that particular value(s) is(are) not defined. */
union {
struct {
GUID birth_volume_id; /* Unique id of volume on which
the file was first created.*/
GUID birth_object_id; /* Unique id of file when it was
first created. */
GUID domain_id; /* Reserved, zero. */
} __attribute__ ((__packed__)) origin;
u8 extended_info[48];
} __attribute__ ((__packed__)) opt;
} __attribute__ ((__packed__)) OBJECT_ID_ATTR;
/*
* The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in
* the SID structure (see below).
*/
//typedef enum { /* SID string prefix. */
// SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */
// SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */
// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */
// SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */
// SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */
// SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */
//} IDENTIFIER_AUTHORITIES;
/*
* These relative identifiers (RIDs) are used with the above identifier
* authorities to make up universal well-known SIDs.
*
* Note: The relative identifier (RID) refers to the portion of a SID, which
* identifies a user or group in relation to the authority that issued the SID.
* For example, the universal well-known SID Creator Owner ID (S-1-3-0) is
* made up of the identifier authority SECURITY_CREATOR_SID_AUTHORITY (3) and
* the relative identifier SECURITY_CREATOR_OWNER_RID (0).
*/
typedef enum { /* Identifier authority. */
SECURITY_NULL_RID = 0, /* S-1-0 */
SECURITY_WORLD_RID = 0, /* S-1-1 */
SECURITY_LOCAL_RID = 0, /* S-1-2 */
SECURITY_CREATOR_OWNER_RID = 0, /* S-1-3 */
SECURITY_CREATOR_GROUP_RID = 1, /* S-1-3 */
SECURITY_CREATOR_OWNER_SERVER_RID = 2, /* S-1-3 */
SECURITY_CREATOR_GROUP_SERVER_RID = 3, /* S-1-3 */
SECURITY_DIALUP_RID = 1,
SECURITY_NETWORK_RID = 2,
SECURITY_BATCH_RID = 3,
SECURITY_INTERACTIVE_RID = 4,
SECURITY_SERVICE_RID = 6,
SECURITY_ANONYMOUS_LOGON_RID = 7,
SECURITY_PROXY_RID = 8,
SECURITY_ENTERPRISE_CONTROLLERS_RID=9,
SECURITY_SERVER_LOGON_RID = 9,
SECURITY_PRINCIPAL_SELF_RID = 0xa,
SECURITY_AUTHENTICATED_USER_RID = 0xb,
SECURITY_RESTRICTED_CODE_RID = 0xc,
SECURITY_TERMINAL_SERVER_RID = 0xd,
SECURITY_LOGON_IDS_RID = 5,
SECURITY_LOGON_IDS_RID_COUNT = 3,
SECURITY_LOCAL_SYSTEM_RID = 0x12,
SECURITY_NT_NON_UNIQUE = 0x15,
SECURITY_BUILTIN_DOMAIN_RID = 0x20,
/*
* Well-known domain relative sub-authority values (RIDs).
*/
/* Users. */
DOMAIN_USER_RID_ADMIN = 0x1f4,
DOMAIN_USER_RID_GUEST = 0x1f5,
DOMAIN_USER_RID_KRBTGT = 0x1f6,
/* Groups. */
DOMAIN_GROUP_RID_ADMINS = 0x200,
DOMAIN_GROUP_RID_USERS = 0x201,
DOMAIN_GROUP_RID_GUESTS = 0x202,
DOMAIN_GROUP_RID_COMPUTERS = 0x203,
DOMAIN_GROUP_RID_CONTROLLERS = 0x204,
DOMAIN_GROUP_RID_CERT_ADMINS = 0x205,
DOMAIN_GROUP_RID_SCHEMA_ADMINS = 0x206,
DOMAIN_GROUP_RID_ENTERPRISE_ADMINS= 0x207,
DOMAIN_GROUP_RID_POLICY_ADMINS = 0x208,
/* Aliases. */
DOMAIN_ALIAS_RID_ADMINS = 0x220,
DOMAIN_ALIAS_RID_USERS = 0x221,
DOMAIN_ALIAS_RID_GUESTS = 0x222,
DOMAIN_ALIAS_RID_POWER_USERS = 0x223,
DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224,
DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225,
DOMAIN_ALIAS_RID_PRINT_OPS = 0x226,
DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227,
DOMAIN_ALIAS_RID_REPLICATOR = 0x228,
DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229,
DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a,
} RELATIVE_IDENTIFIERS;
/*
* The universal well-known SIDs:
*
* NULL_SID S-1-0-0
* WORLD_SID S-1-1-0
* LOCAL_SID S-1-2-0
* CREATOR_OWNER_SID S-1-3-0
* CREATOR_GROUP_SID S-1-3-1
* CREATOR_OWNER_SERVER_SID S-1-3-2
* CREATOR_GROUP_SERVER_SID S-1-3-3
*
* (Non-unique IDs) S-1-4
*
* NT well-known SIDs:
*
* NT_AUTHORITY_SID S-1-5
* DIALUP_SID S-1-5-1
*
* NETWORD_SID S-1-5-2
* BATCH_SID S-1-5-3
* INTERACTIVE_SID S-1-5-4
* SERVICE_SID S-1-5-6
* ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session)
* PROXY_SID S-1-5-8
* SERVER_LOGON_SID S-1-5-9 (aka domain controller account)
* SELF_SID S-1-5-10 (self RID)
* AUTHENTICATED_USER_SID S-1-5-11
* RESTRICTED_CODE_SID S-1-5-12 (running restricted code)
* TERMINAL_SERVER_SID S-1-5-13 (running on terminal server)
*
* (Logon IDs) S-1-5-5-X-Y
*
* (NT non-unique IDs) S-1-5-0x15-...
*
* (Built-in domain) S-1-5-0x20
*/
/*
* The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure.
*
* NOTE: This is stored as a big endian number, hence the high_part comes
* before the low_part.
*/
typedef union {
struct {
u16 high_part; /* High 16-bits. */
u32 low_part; /* Low 32-bits. */
} __attribute__ ((__packed__)) parts;
u8 value[6]; /* Value as individual bytes. */
} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY;
/*
* The SID structure is a variable-length structure used to uniquely identify
* users or groups. SID stands for security identifier.
*
* The standard textual representation of the SID is of the form:
* S-R-I-S-S...
* Where:
* - The first "S" is the literal character 'S' identifying the following
* digits as a SID.
* - R is the revision level of the SID expressed as a sequence of digits
* either in decimal or hexadecimal (if the later, prefixed by "0x").
* - I is the 48-bit identifier_authority, expressed as digits as R above.
* - S... is one or more sub_authority values, expressed as digits as above.
*
* Example SID; the domain-relative SID of the local Administrators group on
* Windows NT/2k:
* S-1-5-32-544
* This translates to a SID with:
* revision = 1,
* sub_authority_count = 2,
* identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY
* sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID
* sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS
*/
typedef struct {
u8 revision;
u8 sub_authority_count;
SID_IDENTIFIER_AUTHORITY identifier_authority;
le32 sub_authority[1]; /* At least one sub_authority. */
} __attribute__ ((__packed__)) SID;
/*
* Current constants for SIDs.
*/
typedef enum {
SID_REVISION = 1, /* Current revision level. */
SID_MAX_SUB_AUTHORITIES = 15, /* Maximum number of those. */
SID_RECOMMENDED_SUB_AUTHORITIES = 1, /* Will change to around 6 in
a future revision. */
} SID_CONSTANTS;
/*
* The predefined ACE types (8-bit, see below).
*/
enum {
ACCESS_MIN_MS_ACE_TYPE = 0,
ACCESS_ALLOWED_ACE_TYPE = 0,
ACCESS_DENIED_ACE_TYPE = 1,
SYSTEM_AUDIT_ACE_TYPE = 2,
SYSTEM_ALARM_ACE_TYPE = 3, /* Not implemented as of Win2k. */
ACCESS_MAX_MS_V2_ACE_TYPE = 3,
ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4,
ACCESS_MAX_MS_V3_ACE_TYPE = 4,
/* The following are Win2k only. */
ACCESS_MIN_MS_OBJECT_ACE_TYPE = 5,
ACCESS_ALLOWED_OBJECT_ACE_TYPE = 5,
ACCESS_DENIED_OBJECT_ACE_TYPE = 6,
SYSTEM_AUDIT_OBJECT_ACE_TYPE = 7,
SYSTEM_ALARM_OBJECT_ACE_TYPE = 8,
ACCESS_MAX_MS_OBJECT_ACE_TYPE = 8,
ACCESS_MAX_MS_V4_ACE_TYPE = 8,
/* This one is for WinNT/2k. */
ACCESS_MAX_MS_ACE_TYPE = 8,
} __attribute__ ((__packed__));
typedef u8 ACE_TYPES;
/*
* The ACE flags (8-bit) for audit and inheritance (see below).
*
* SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE
* types to indicate that a message is generated (in Windows!) for successful
* accesses.
*
* FAILED_ACCESS_ACE_FLAG is only used with system audit and alarm ACE types
* to indicate that a message is generated (in Windows!) for failed accesses.
*/
enum {
/* The inheritance flags. */
OBJECT_INHERIT_ACE = 0x01,
CONTAINER_INHERIT_ACE = 0x02,
NO_PROPAGATE_INHERIT_ACE = 0x04,
INHERIT_ONLY_ACE = 0x08,
INHERITED_ACE = 0x10, /* Win2k only. */
VALID_INHERIT_FLAGS = 0x1f,
/* The audit flags. */
SUCCESSFUL_ACCESS_ACE_FLAG = 0x40,
FAILED_ACCESS_ACE_FLAG = 0x80,
} __attribute__ ((__packed__));
typedef u8 ACE_FLAGS;
/*
* An ACE is an access-control entry in an access-control list (ACL).
* An ACE defines access to an object for a specific user or group or defines
* the types of access that generate system-administration messages or alarms
* for a specific user or group. The user or group is identified by a security
* identifier (SID).
*
* Each ACE starts with an ACE_HEADER structure (aligned on 4-byte boundary),
* which specifies the type and size of the ACE. The format of the subsequent
* data depends on the ACE type.
*/
typedef struct {
/*Ofs*/
/* 0*/ ACE_TYPES type; /* Type of the ACE. */
/* 1*/ ACE_FLAGS flags; /* Flags describing the ACE. */
/* 2*/ le16 size; /* Size in bytes of the ACE. */
} __attribute__ ((__packed__)) ACE_HEADER;
/*
* The access mask (32-bit). Defines the access rights.
*
* The specific rights (bits 0 to 15). These depend on the type of the object
* being secured by the ACE.
*/
enum {
/* Specific rights for files and directories are as follows: */
/* Right to read data from the file. (FILE) */
FILE_READ_DATA = cpu_to_le32(0x00000001),
/* Right to list contents of a directory. (DIRECTORY) */
FILE_LIST_DIRECTORY = cpu_to_le32(0x00000001),
/* Right to write data to the file. (FILE) */
FILE_WRITE_DATA = cpu_to_le32(0x00000002),
/* Right to create a file in the directory. (DIRECTORY) */
FILE_ADD_FILE = cpu_to_le32(0x00000002),
/* Right to append data to the file. (FILE) */
FILE_APPEND_DATA = cpu_to_le32(0x00000004),
/* Right to create a subdirectory. (DIRECTORY) */
FILE_ADD_SUBDIRECTORY = cpu_to_le32(0x00000004),
/* Right to read extended attributes. (FILE/DIRECTORY) */
FILE_READ_EA = cpu_to_le32(0x00000008),
/* Right to write extended attributes. (FILE/DIRECTORY) */
FILE_WRITE_EA = cpu_to_le32(0x00000010),
/* Right to execute a file. (FILE) */
FILE_EXECUTE = cpu_to_le32(0x00000020),
/* Right to traverse the directory. (DIRECTORY) */
FILE_TRAVERSE = cpu_to_le32(0x00000020),
/*
* Right to delete a directory and all the files it contains (its
* children), even if the files are read-only. (DIRECTORY)
*/
FILE_DELETE_CHILD = cpu_to_le32(0x00000040),
/* Right to read file attributes. (FILE/DIRECTORY) */
FILE_READ_ATTRIBUTES = cpu_to_le32(0x00000080),
/* Right to change file attributes. (FILE/DIRECTORY) */
FILE_WRITE_ATTRIBUTES = cpu_to_le32(0x00000100),
/*
* The standard rights (bits 16 to 23). These are independent of the
* type of object being secured.
*/
/* Right to delete the object. */
DELETE = cpu_to_le32(0x00010000),
/*
* Right to read the information in the object's security descriptor,
* not including the information in the SACL, i.e. right to read the
* security descriptor and owner.
*/
READ_CONTROL = cpu_to_le32(0x00020000),
/* Right to modify the DACL in the object's security descriptor. */
WRITE_DAC = cpu_to_le32(0x00040000),
/* Right to change the owner in the object's security descriptor. */
WRITE_OWNER = cpu_to_le32(0x00080000),
/*
* Right to use the object for synchronization. Enables a process to
* wait until the object is in the signalled state. Some object types
* do not support this access right.
*/
SYNCHRONIZE = cpu_to_le32(0x00100000),
/*
* The following STANDARD_RIGHTS_* are combinations of the above for
* convenience and are defined by the Win32 API.
*/
/* These are currently defined to READ_CONTROL. */
STANDARD_RIGHTS_READ = cpu_to_le32(0x00020000),
STANDARD_RIGHTS_WRITE = cpu_to_le32(0x00020000),
STANDARD_RIGHTS_EXECUTE = cpu_to_le32(0x00020000),
/* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */
STANDARD_RIGHTS_REQUIRED = cpu_to_le32(0x000f0000),
/*
* Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and
* SYNCHRONIZE access.
*/
STANDARD_RIGHTS_ALL = cpu_to_le32(0x001f0000),
/*
* The access system ACL and maximum allowed access types (bits 24 to
* 25, bits 26 to 27 are reserved).
*/
ACCESS_SYSTEM_SECURITY = cpu_to_le32(0x01000000),
MAXIMUM_ALLOWED = cpu_to_le32(0x02000000),
/*
* The generic rights (bits 28 to 31). These map onto the standard and
* specific rights.
*/
/* Read, write, and execute access. */
GENERIC_ALL = cpu_to_le32(0x10000000),
/* Execute access. */
GENERIC_EXECUTE = cpu_to_le32(0x20000000),
/*
* Write access. For files, this maps onto:
* FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA |
* FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE
* For directories, the mapping has the same numerical value. See
* above for the descriptions of the rights granted.
*/
GENERIC_WRITE = cpu_to_le32(0x40000000),
/*
* Read access. For files, this maps onto:
* FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA |
* STANDARD_RIGHTS_READ | SYNCHRONIZE
* For directories, the mapping has the same numberical value. See
* above for the descriptions of the rights granted.
*/
GENERIC_READ = cpu_to_le32(0x80000000),
};
typedef le32 ACCESS_MASK;
typedef struct {
ACCESS_MASK generic_read;
ACCESS_MASK generic_write;
ACCESS_MASK generic_execute;
ACCESS_MASK generic_all;
} __attribute__ ((__packed__)) GENERIC_MAPPING;
/*
* The predefined ACE type structures are as defined below.
*/
/*
* ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE
*/
typedef struct {
/* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */
ACE_TYPES type; /* Type of the ACE. */
ACE_FLAGS flags; /* Flags describing the ACE. */
le16 size; /* Size in bytes of the ACE. */
/* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */
/* 8*/ SID sid; /* The SID associated with the ACE. */
} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE,
SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE;
/*
* The object ACE flags (32-bit).
*/
enum {
ACE_OBJECT_TYPE_PRESENT = cpu_to_le32(1),
ACE_INHERITED_OBJECT_TYPE_PRESENT = cpu_to_le32(2),
};
typedef le32 OBJECT_ACE_FLAGS;
typedef struct {
/* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */
ACE_TYPES type; /* Type of the ACE. */
ACE_FLAGS flags; /* Flags describing the ACE. */
le16 size; /* Size in bytes of the ACE. */
/* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */
/* 8*/ OBJECT_ACE_FLAGS object_flags; /* Flags describing the object ACE. */
/* 12*/ GUID object_type;
/* 28*/ GUID inherited_object_type;
/* 44*/ SID sid; /* The SID associated with the ACE. */
} __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE,
ACCESS_DENIED_OBJECT_ACE,
SYSTEM_AUDIT_OBJECT_ACE,
SYSTEM_ALARM_OBJECT_ACE;
/*
* An ACL is an access-control list (ACL).
* An ACL starts with an ACL header structure, which specifies the size of
* the ACL and the number of ACEs it contains. The ACL header is followed by
* zero or more access control entries (ACEs). The ACL as well as each ACE
* are aligned on 4-byte boundaries.
*/
typedef struct {
u8 revision; /* Revision of this ACL. */
u8 alignment1;
le16 size; /* Allocated space in bytes for ACL. Includes this
header, the ACEs and the remaining free space. */
le16 ace_count; /* Number of ACEs in the ACL. */
le16 alignment2;
/* sizeof() = 8 bytes */
} __attribute__ ((__packed__)) ACL;
/*
* Current constants for ACLs.
*/
typedef enum {
/* Current revision. */
ACL_REVISION = 2,
ACL_REVISION_DS = 4,
/* History of revisions. */
ACL_REVISION1 = 1,
MIN_ACL_REVISION = 2,
ACL_REVISION2 = 2,
ACL_REVISION3 = 3,
ACL_REVISION4 = 4,
MAX_ACL_REVISION = 4,
} ACL_CONSTANTS;
/*
* The security descriptor control flags (16-bit).
*
* SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the SID
* pointed to by the Owner field was provided by a defaulting mechanism
* rather than explicitly provided by the original provider of the
* security descriptor. This may affect the treatment of the SID with
* respect to inheritence of an owner.
*
* SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the SID in
* the Group field was provided by a defaulting mechanism rather than
* explicitly provided by the original provider of the security
* descriptor. This may affect the treatment of the SID with respect to
* inheritence of a primary group.
*
* SE_DACL_PRESENT - This boolean flag, when set, indicates that the security
* descriptor contains a discretionary ACL. If this flag is set and the
* Dacl field of the SECURITY_DESCRIPTOR is null, then a null ACL is
* explicitly being specified.
*
* SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the ACL
* pointed to by the Dacl field was provided by a defaulting mechanism
* rather than explicitly provided by the original provider of the
* security descriptor. This may affect the treatment of the ACL with
* respect to inheritence of an ACL. This flag is ignored if the
* DaclPresent flag is not set.
*
* SE_SACL_PRESENT - This boolean flag, when set, indicates that the security
* descriptor contains a system ACL pointed to by the Sacl field. If this
* flag is set and the Sacl field of the SECURITY_DESCRIPTOR is null, then
* an empty (but present) ACL is being specified.
*
* SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the ACL
* pointed to by the Sacl field was provided by a defaulting mechanism
* rather than explicitly provided by the original provider of the
* security descriptor. This may affect the treatment of the ACL with
* respect to inheritence of an ACL. This flag is ignored if the
* SaclPresent flag is not set.
*
* SE_SELF_RELATIVE - This boolean flag, when set, indicates that the security
* descriptor is in self-relative form. In this form, all fields of the
* security descriptor are contiguous in memory and all pointer fields are
* expressed as offsets from the beginning of the security descriptor.
*/
enum {
SE_OWNER_DEFAULTED = cpu_to_le16(0x0001),
SE_GROUP_DEFAULTED = cpu_to_le16(0x0002),
SE_DACL_PRESENT = cpu_to_le16(0x0004),
SE_DACL_DEFAULTED = cpu_to_le16(0x0008),
SE_SACL_PRESENT = cpu_to_le16(0x0010),
SE_SACL_DEFAULTED = cpu_to_le16(0x0020),
SE_DACL_AUTO_INHERIT_REQ = cpu_to_le16(0x0100),
SE_SACL_AUTO_INHERIT_REQ = cpu_to_le16(0x0200),
SE_DACL_AUTO_INHERITED = cpu_to_le16(0x0400),
SE_SACL_AUTO_INHERITED = cpu_to_le16(0x0800),
SE_DACL_PROTECTED = cpu_to_le16(0x1000),
SE_SACL_PROTECTED = cpu_to_le16(0x2000),
SE_RM_CONTROL_VALID = cpu_to_le16(0x4000),
SE_SELF_RELATIVE = cpu_to_le16(0x8000)
} __attribute__ ((__packed__));
typedef le16 SECURITY_DESCRIPTOR_CONTROL;
/*
* Self-relative security descriptor. Contains the owner and group SIDs as well
* as the sacl and dacl ACLs inside the security descriptor itself.
*/
typedef struct {
u8 revision; /* Revision level of the security descriptor. */
u8 alignment;
SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of
the descriptor as well as the following fields. */
le32 owner; /* Byte offset to a SID representing an object's
owner. If this is NULL, no owner SID is present in
the descriptor. */
le32 group; /* Byte offset to a SID representing an object's
primary group. If this is NULL, no primary group
SID is present in the descriptor. */
le32 sacl; /* Byte offset to a system ACL. Only valid, if
SE_SACL_PRESENT is set in the control field. If
SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL
is specified. */
le32 dacl; /* Byte offset to a discretionary ACL. Only valid, if
SE_DACL_PRESENT is set in the control field. If
SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL
(unconditionally granting access) is specified. */
/* sizeof() = 0x14 bytes */
} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_RELATIVE;
/*
* Absolute security descriptor. Does not contain the owner and group SIDs, nor
* the sacl and dacl ACLs inside the security descriptor. Instead, it contains
* pointers to these structures in memory. Obviously, absolute security
* descriptors are only useful for in memory representations of security
* descriptors. On disk, a self-relative security descriptor is used.
*/
typedef struct {
u8 revision; /* Revision level of the security descriptor. */
u8 alignment;
SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of
the descriptor as well as the following fields. */
SID *owner; /* Points to a SID representing an object's owner. If
this is NULL, no owner SID is present in the
descriptor. */
SID *group; /* Points to a SID representing an object's primary
group. If this is NULL, no primary group SID is
present in the descriptor. */
ACL *sacl; /* Points to a system ACL. Only valid, if
SE_SACL_PRESENT is set in the control field. If
SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL
is specified. */
ACL *dacl; /* Points to a discretionary ACL. Only valid, if
SE_DACL_PRESENT is set in the control field. If
SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL
(unconditionally granting access) is specified. */
} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR;
/*
* Current constants for security descriptors.
*/
typedef enum {
/* Current revision. */
SECURITY_DESCRIPTOR_REVISION = 1,
SECURITY_DESCRIPTOR_REVISION1 = 1,
/* The sizes of both the absolute and relative security descriptors is
the same as pointers, at least on ia32 architecture are 32-bit. */
SECURITY_DESCRIPTOR_MIN_LENGTH = sizeof(SECURITY_DESCRIPTOR),
} SECURITY_DESCRIPTOR_CONSTANTS;
/*
* Attribute: Security descriptor (0x50). A standard self-relative security
* descriptor.
*
* NOTE: Can be resident or non-resident.
* NOTE: Not used in NTFS 3.0+, as security descriptors are stored centrally
* in FILE_Secure and the correct descriptor is found using the security_id
* from the standard information attribute.
*/
typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR;
/*
* On NTFS 3.0+, all security descriptors are stored in FILE_Secure. Only one
* referenced instance of each unique security descriptor is stored.
*
* FILE_Secure contains no unnamed data attribute, i.e. it has zero length. It
* does, however, contain two indexes ($SDH and $SII) as well as a named data
* stream ($SDS).
*
* Every unique security descriptor is assigned a unique security identifier
* (security_id, not to be confused with a SID). The security_id is unique for
* the NTFS volume and is used as an index into the $SII index, which maps
* security_ids to the security descriptor's storage location within the $SDS
* data attribute. The $SII index is sorted by ascending security_id.
*
* A simple hash is computed from each security descriptor. This hash is used
* as an index into the $SDH index, which maps security descriptor hashes to
* the security descriptor's storage location within the $SDS data attribute.
* The $SDH index is sorted by security descriptor hash and is stored in a B+
* tree. When searching $SDH (with the intent of determining whether or not a
* new security descriptor is already present in the $SDS data stream), if a
* matching hash is found, but the security descriptors do not match, the
* search in the $SDH index is continued, searching for a next matching hash.
*
* When a precise match is found, the security_id coresponding to the security
* descriptor in the $SDS attribute is read from the found $SDH index entry and
* is stored in the $STANDARD_INFORMATION attribute of the file/directory to
* which the security descriptor is being applied. The $STANDARD_INFORMATION
* attribute is present in all base mft records (i.e. in all files and
* directories).
*
* If a match is not found, the security descriptor is assigned a new unique
* security_id and is added to the $SDS data attribute. Then, entries
* referencing the this security descriptor in the $SDS data attribute are
* added to the $SDH and $SII indexes.
*
* Note: Entries are never deleted from FILE_Secure, even if nothing
* references an entry any more.
*/
/*
* This header precedes each security descriptor in the $SDS data stream.
* This is also the index entry data part of both the $SII and $SDH indexes.
*/
typedef struct {
le32 hash; /* Hash of the security descriptor. */
le32 security_id; /* The security_id assigned to the descriptor. */
le64 offset; /* Byte offset of this entry in the $SDS stream. */
le32 length; /* Size in bytes of this entry in $SDS stream. */
} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER;
/*
* The $SDS data stream contains the security descriptors, aligned on 16-byte
* boundaries, sorted by security_id in a B+ tree. Security descriptors cannot
* cross 256kib boundaries (this restriction is imposed by the Windows cache
* manager). Each security descriptor is contained in a SDS_ENTRY structure.
* Also, each security descriptor is stored twice in the $SDS stream with a
* fixed offset of 0x40000 bytes (256kib, the Windows cache manager's max size)
* between them; i.e. if a SDS_ENTRY specifies an offset of 0x51d0, then the
* the first copy of the security descriptor will be at offset 0x51d0 in the
* $SDS data stream and the second copy will be at offset 0x451d0.
*/
typedef struct {
/*Ofs*/
/* 0 SECURITY_DESCRIPTOR_HEADER; -- Unfolded here as gcc doesn't like
unnamed structs. */
le32 hash; /* Hash of the security descriptor. */
le32 security_id; /* The security_id assigned to the descriptor. */
le64 offset; /* Byte offset of this entry in the $SDS stream. */
le32 length; /* Size in bytes of this entry in $SDS stream. */
/* 20*/ SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security
descriptor. */
} __attribute__ ((__packed__)) SDS_ENTRY;
/*
* The index entry key used in the $SII index. The collation type is
* COLLATION_NTOFS_ULONG.
*/
typedef struct {
le32 security_id; /* The security_id assigned to the descriptor. */
} __attribute__ ((__packed__)) SII_INDEX_KEY;
/*
* The index entry key used in the $SDH index. The keys are sorted first by
* hash and then by security_id. The collation rule is
* COLLATION_NTOFS_SECURITY_HASH.
*/
typedef struct {
le32 hash; /* Hash of the security descriptor. */
le32 security_id; /* The security_id assigned to the descriptor. */
} __attribute__ ((__packed__)) SDH_INDEX_KEY;
/*
* Attribute: Volume name (0x60).
*
* NOTE: Always resident.
* NOTE: Present only in FILE_Volume.
*/
typedef struct {
ntfschar name[0]; /* The name of the volume in Unicode. */
} __attribute__ ((__packed__)) VOLUME_NAME;
/*
* Possible flags for the volume (16-bit).
*/
enum {
VOLUME_IS_DIRTY = cpu_to_le16(0x0001),
VOLUME_RESIZE_LOG_FILE = cpu_to_le16(0x0002),
VOLUME_UPGRADE_ON_MOUNT = cpu_to_le16(0x0004),
VOLUME_MOUNTED_ON_NT4 = cpu_to_le16(0x0008),
VOLUME_DELETE_USN_UNDERWAY = cpu_to_le16(0x0010),
VOLUME_REPAIR_OBJECT_ID = cpu_to_le16(0x0020),
VOLUME_CHKDSK_UNDERWAY = cpu_to_le16(0x4000),
VOLUME_MODIFIED_BY_CHKDSK = cpu_to_le16(0x8000),
VOLUME_FLAGS_MASK = cpu_to_le16(0xc03f),
/* To make our life easier when checking if we must mount read-only. */
VOLUME_MUST_MOUNT_RO_MASK = cpu_to_le16(0xc027),
} __attribute__ ((__packed__));
typedef le16 VOLUME_FLAGS;
/*
* Attribute: Volume information (0x70).
*
* NOTE: Always resident.
* NOTE: Present only in FILE_Volume.
* NOTE: Windows 2000 uses NTFS 3.0 while Windows NT4 service pack 6a uses
* NTFS 1.2. I haven't personally seen other values yet.
*/
typedef struct {
le64 reserved; /* Not used (yet?). */
u8 major_ver; /* Major version of the ntfs format. */
u8 minor_ver; /* Minor version of the ntfs format. */
VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */
} __attribute__ ((__packed__)) VOLUME_INFORMATION;
/*
* Attribute: Data attribute (0x80).
*
* NOTE: Can be resident or non-resident.
*
* Data contents of a file (i.e. the unnamed stream) or of a named stream.
*/
typedef struct {
u8 data[0]; /* The file's data contents. */
} __attribute__ ((__packed__)) DATA_ATTR;
/*
* Index header flags (8-bit).
*/
enum {
/*
* When index header is in an index root attribute:
*/
SMALL_INDEX = 0, /* The index is small enough to fit inside the index
root attribute and there is no index allocation
attribute present. */
LARGE_INDEX = 1, /* The index is too large to fit in the index root
attribute and/or an index allocation attribute is
present. */
/*
* When index header is in an index block, i.e. is part of index
* allocation attribute:
*/
LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more nodes
branching off it. */
INDEX_NODE = 1, /* This node indexes other nodes, i.e. it is not a leaf
node. */
NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */
} __attribute__ ((__packed__));
typedef u8 INDEX_HEADER_FLAGS;
/*
* This is the header for indexes, describing the INDEX_ENTRY records, which
* follow the INDEX_HEADER. Together the index header and the index entries
* make up a complete index.
*
* IMPORTANT NOTE: The offset, length and size structure members are counted
* relative to the start of the index header structure and not relative to the
* start of the index root or index allocation structures themselves.
*/
typedef struct {
le32 entries_offset; /* Byte offset to first INDEX_ENTRY
aligned to 8-byte boundary. */
le32 index_length; /* Data size of the index in bytes,
i.e. bytes used from allocated
size, aligned to 8-byte boundary. */
le32 allocated_size; /* Byte size of this index (block),
multiple of 8 bytes. */
/* NOTE: For the index root attribute, the above two numbers are always
equal, as the attribute is resident and it is resized as needed. In
the case of the index allocation attribute the attribute is not
resident and hence the allocated_size is a fixed value and must
equal the index_block_size specified by the INDEX_ROOT attribute
corresponding to the INDEX_ALLOCATION attribute this INDEX_BLOCK
belongs to. */
INDEX_HEADER_FLAGS flags; /* Bit field of INDEX_HEADER_FLAGS. */
u8 reserved[3]; /* Reserved/align to 8-byte boundary. */
} __attribute__ ((__packed__)) INDEX_HEADER;
/*
* Attribute: Index root (0x90).
*
* NOTE: Always resident.
*
* This is followed by a sequence of index entries (INDEX_ENTRY structures)
* as described by the index header.
*
* When a directory is small enough to fit inside the index root then this
* is the only attribute describing the directory. When the directory is too
* large to fit in the index root, on the other hand, two aditional attributes
* are present: an index allocation attribute, containing sub-nodes of the B+
* directory tree (see below), and a bitmap attribute, describing which virtual
* cluster numbers (vcns) in the index allocation attribute are in use by an
* index block.
*
* NOTE: The root directory (FILE_root) contains an entry for itself. Other
* dircetories do not contain entries for themselves, though.
*/
typedef struct {
ATTR_TYPE type; /* Type of the indexed attribute. Is
$FILE_NAME for directories, zero
for view indexes. No other values
allowed. */
COLLATION_RULE collation_rule; /* Collation rule used to sort the
index entries. If type is $FILE_NAME,
this must be COLLATION_FILE_NAME. */
le32 index_block_size; /* Size of each index block in bytes (in
the index allocation attribute). */
u8 clusters_per_index_block; /* Cluster size of each index block (in
the index allocation attribute), when
an index block is >= than a cluster,
otherwise this will be the log of
the size (like how the encoding of
the mft record size and the index
record size found in the boot sector
work). Has to be a power of 2. */
u8 reserved[3]; /* Reserved/align to 8-byte boundary. */
INDEX_HEADER index; /* Index header describing the
following index entries. */
} __attribute__ ((__packed__)) INDEX_ROOT;
/*
* Attribute: Index allocation (0xa0).
*
* NOTE: Always non-resident (doesn't make sense to be resident anyway!).
*
* This is an array of index blocks. Each index block starts with an
* INDEX_BLOCK structure containing an index header, followed by a sequence of
* index entries (INDEX_ENTRY structures), as described by the INDEX_HEADER.
*/
typedef struct {
/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */
NTFS_RECORD_TYPE magic; /* Magic is "INDX". */
le16 usa_ofs; /* See NTFS_RECORD definition. */
le16 usa_count; /* See NTFS_RECORD definition. */
/* 8*/ sle64 lsn; /* $LogFile sequence number of the last
modification of this index block. */
/* 16*/ leVCN index_block_vcn; /* Virtual cluster number of the index block.
If the cluster_size on the volume is <= the
index_block_size of the directory,
index_block_vcn counts in units of clusters,
and in units of sectors otherwise. */
/* 24*/ INDEX_HEADER index; /* Describes the following index entries. */
/* sizeof()= 40 (0x28) bytes */
/*
* When creating the index block, we place the update sequence array at this
* offset, i.e. before we start with the index entries. This also makes sense,
* otherwise we could run into problems with the update sequence array
* containing in itself the last two bytes of a sector which would mean that
* multi sector transfer protection wouldn't work. As you can't protect data
* by overwriting it since you then can't get it back...
* When reading use the data from the ntfs record header.
*/
} __attribute__ ((__packed__)) INDEX_BLOCK;
typedef INDEX_BLOCK INDEX_ALLOCATION;
typedef struct {
le32 reparse_tag; /* Reparse point type (inc. flags). */
leMFT_REF file_id; /* Mft record of the file containing the
reparse point attribute. */
} __attribute__ ((__packed__)) REPARSE_INDEX_KEY;
/*
* Quota flags (32-bit).
*
* The user quota flags. Names explain meaning.
*/
enum {
QUOTA_FLAG_DEFAULT_LIMITS = cpu_to_le32(0x00000001),
QUOTA_FLAG_LIMIT_REACHED = cpu_to_le32(0x00000002),
QUOTA_FLAG_ID_DELETED = cpu_to_le32(0x00000004),
QUOTA_FLAG_USER_MASK = cpu_to_le32(0x00000007),
/* This is a bit mask for the user quota flags. */
/*
* These flags are only present in the quota defaults index entry, i.e.
* in the entry where owner_id = QUOTA_DEFAULTS_ID.
*/
QUOTA_FLAG_TRACKING_ENABLED = cpu_to_le32(0x00000010),
QUOTA_FLAG_ENFORCEMENT_ENABLED = cpu_to_le32(0x00000020),
QUOTA_FLAG_TRACKING_REQUESTED = cpu_to_le32(0x00000040),
QUOTA_FLAG_LOG_THRESHOLD = cpu_to_le32(0x00000080),
QUOTA_FLAG_LOG_LIMIT = cpu_to_le32(0x00000100),
QUOTA_FLAG_OUT_OF_DATE = cpu_to_le32(0x00000200),
QUOTA_FLAG_CORRUPT = cpu_to_le32(0x00000400),
QUOTA_FLAG_PENDING_DELETES = cpu_to_le32(0x00000800),
};
typedef le32 QUOTA_FLAGS;
/*
* The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas
* are on a per volume and per user basis.
*
* The $Q index contains one entry for each existing user_id on the volume. The
* index key is the user_id of the user/group owning this quota control entry,
* i.e. the key is the owner_id. The user_id of the owner of a file, i.e. the
* owner_id, is found in the standard information attribute. The collation rule
* for $Q is COLLATION_NTOFS_ULONG.
*
* The $O index contains one entry for each user/group who has been assigned
* a quota on that volume. The index key holds the SID of the user_id the
* entry belongs to, i.e. the owner_id. The collation rule for $O is
* COLLATION_NTOFS_SID.
*
* The $O index entry data is the user_id of the user corresponding to the SID.
* This user_id is used as an index into $Q to find the quota control entry
* associated with the SID.
*
* The $Q index entry data is the quota control entry and is defined below.
*/
typedef struct {
le32 version; /* Currently equals 2. */
QUOTA_FLAGS flags; /* Flags describing this quota entry. */
le64 bytes_used; /* How many bytes of the quota are in use. */
sle64 change_time; /* Last time this quota entry was changed. */
sle64 threshold; /* Soft quota (-1 if not limited). */
sle64 limit; /* Hard quota (-1 if not limited). */
sle64 exceeded_time; /* How long the soft quota has been exceeded. */
SID sid; /* The SID of the user/object associated with
this quota entry. Equals zero for the quota
defaults entry (and in fact on a WinXP
volume, it is not present at all). */
} __attribute__ ((__packed__)) QUOTA_CONTROL_ENTRY;
/*
* Predefined owner_id values (32-bit).
*/
enum {
QUOTA_INVALID_ID = cpu_to_le32(0x00000000),
QUOTA_DEFAULTS_ID = cpu_to_le32(0x00000001),
QUOTA_FIRST_USER_ID = cpu_to_le32(0x00000100),
};
/*
* Current constants for quota control entries.
*/
typedef enum {
/* Current version. */
QUOTA_VERSION = 2,
} QUOTA_CONTROL_ENTRY_CONSTANTS;
/*
* Index entry flags (16-bit).
*/
enum {
INDEX_ENTRY_NODE = cpu_to_le16(1), /* This entry contains a
sub-node, i.e. a reference to an index block in form of
a virtual cluster number (see below). */
INDEX_ENTRY_END = cpu_to_le16(2), /* This signifies the last
entry in an index block. The index entry does not
represent a file but it can point to a sub-node. */
INDEX_ENTRY_SPACE_FILLER = cpu_to_le16(0xffff), /* gcc: Force
enum bit width to 16-bit. */
} __attribute__ ((__packed__));
typedef le16 INDEX_ENTRY_FLAGS;
/*
* This the index entry header (see below).
*/
typedef struct {
/* 0*/ union {
struct { /* Only valid when INDEX_ENTRY_END is not set. */
leMFT_REF indexed_file; /* The mft reference of the file
described by this index
entry. Used for directory
indexes. */
} __attribute__ ((__packed__)) dir;
struct { /* Used for views/indexes to find the entry's data. */
le16 data_offset; /* Data byte offset from this
INDEX_ENTRY. Follows the
index key. */
le16 data_length; /* Data length in bytes. */
le32 reservedV; /* Reserved (zero). */
} __attribute__ ((__packed__)) vi;
} __attribute__ ((__packed__)) data;
/* 8*/ le16 length; /* Byte size of this index entry, multiple of
8-bytes. */
/* 10*/ le16 key_length; /* Byte size of the key value, which is in the
index entry. It follows field reserved. Not
multiple of 8-bytes. */
/* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */
/* 14*/ le16 reserved; /* Reserved/align to 8-byte boundary. */
/* sizeof() = 16 bytes */
} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER;
/*
* This is an index entry. A sequence of such entries follows each INDEX_HEADER
* structure. Together they make up a complete index. The index follows either
* an index root attribute or an index allocation attribute.
*
* NOTE: Before NTFS 3.0 only filename attributes were indexed.
*/
typedef struct {
/*Ofs*/
/* 0 INDEX_ENTRY_HEADER; -- Unfolded here as gcc dislikes unnamed structs. */
union {
struct { /* Only valid when INDEX_ENTRY_END is not set. */
leMFT_REF indexed_file; /* The mft reference of the file
described by this index
entry. Used for directory
indexes. */
} __attribute__ ((__packed__)) dir;
struct { /* Used for views/indexes to find the entry's data. */
le16 data_offset; /* Data byte offset from this
INDEX_ENTRY. Follows the
index key. */
le16 data_length; /* Data length in bytes. */
le32 reservedV; /* Reserved (zero). */
} __attribute__ ((__packed__)) vi;
} __attribute__ ((__packed__)) data;
le16 length; /* Byte size of this index entry, multiple of
8-bytes. */
le16 key_length; /* Byte size of the key value, which is in the
index entry. It follows field reserved. Not
multiple of 8-bytes. */
INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */
le16 reserved; /* Reserved/align to 8-byte boundary. */
/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present
if INDEX_ENTRY_END bit in flags is not set. NOTE: On
NTFS versions before 3.0 the only valid key is the
FILE_NAME_ATTR. On NTFS 3.0+ the following
additional index keys are defined: */
FILE_NAME_ATTR file_name;/* $I30 index in directories. */
SII_INDEX_KEY sii; /* $SII index in $Secure. */
SDH_INDEX_KEY sdh; /* $SDH index in $Secure. */
GUID object_id; /* $O index in FILE_Extend/$ObjId: The
object_id of the mft record found in
the data part of the index. */
REPARSE_INDEX_KEY reparse; /* $R index in
FILE_Extend/$Reparse. */
SID sid; /* $O index in FILE_Extend/$Quota:
SID of the owner of the user_id. */
le32 owner_id; /* $Q index in FILE_Extend/$Quota:
user_id of the owner of the quota
control entry in the data part of
the index. */
} __attribute__ ((__packed__)) key;
/* The (optional) index data is inserted here when creating. */
// leVCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last
// eight bytes of this index entry contain the virtual
// cluster number of the index block that holds the
// entries immediately preceding the current entry (the
// vcn references the corresponding cluster in the data
// of the non-resident index allocation attribute). If
// the key_length is zero, then the vcn immediately
// follows the INDEX_ENTRY_HEADER. Regardless of
// key_length, the address of the 8-byte boundary
// alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by
// (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN),
// where sizeof(VCN) can be hardcoded as 8 if wanted. */
} __attribute__ ((__packed__)) INDEX_ENTRY;
/*
* Attribute: Bitmap (0xb0).
*
* Contains an array of bits (aka a bitfield).
*
* When used in conjunction with the index allocation attribute, each bit
* corresponds to one index block within the index allocation attribute. Thus
* the number of bits in the bitmap * index block size / cluster size is the
* number of clusters in the index allocation attribute.
*/
typedef struct {
u8 bitmap[0]; /* Array of bits. */
} __attribute__ ((__packed__)) BITMAP_ATTR;
/*
* The reparse point tag defines the type of the reparse point. It also
* includes several flags, which further describe the reparse point.
*
* The reparse point tag is an unsigned 32-bit value divided in three parts:
*
* 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of
* the reparse point.
* 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use.
* 3. The most significant three bits are flags describing the reparse point.
* They are defined as follows:
* bit 29: Name surrogate bit. If set, the filename is an alias for
* another object in the system.
* bit 30: High-latency bit. If set, accessing the first byte of data will
* be slow. (E.g. the data is stored on a tape drive.)
* bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User
* defined tags have to use zero here.
*
* These are the predefined reparse point tags:
*/
enum {
IO_REPARSE_TAG_IS_ALIAS = cpu_to_le32(0x20000000),
IO_REPARSE_TAG_IS_HIGH_LATENCY = cpu_to_le32(0x40000000),
IO_REPARSE_TAG_IS_MICROSOFT = cpu_to_le32(0x80000000),
IO_REPARSE_TAG_RESERVED_ZERO = cpu_to_le32(0x00000000),
IO_REPARSE_TAG_RESERVED_ONE = cpu_to_le32(0x00000001),
IO_REPARSE_TAG_RESERVED_RANGE = cpu_to_le32(0x00000001),
IO_REPARSE_TAG_NSS = cpu_to_le32(0x68000005),
IO_REPARSE_TAG_NSS_RECOVER = cpu_to_le32(0x68000006),
IO_REPARSE_TAG_SIS = cpu_to_le32(0x68000007),
IO_REPARSE_TAG_DFS = cpu_to_le32(0x68000008),
IO_REPARSE_TAG_MOUNT_POINT = cpu_to_le32(0x88000003),
IO_REPARSE_TAG_HSM = cpu_to_le32(0xa8000004),
IO_REPARSE_TAG_SYMBOLIC_LINK = cpu_to_le32(0xe8000000),
IO_REPARSE_TAG_VALID_VALUES = cpu_to_le32(0xe000ffff),
};
/*
* Attribute: Reparse point (0xc0).
*
* NOTE: Can be resident or non-resident.
*/
typedef struct {
le32 reparse_tag; /* Reparse point type (inc. flags). */
le16 reparse_data_length; /* Byte size of reparse data. */
le16 reserved; /* Align to 8-byte boundary. */
u8 reparse_data[0]; /* Meaning depends on reparse_tag. */
} __attribute__ ((__packed__)) REPARSE_POINT;
/*
* Attribute: Extended attribute (EA) information (0xd0).
*
* NOTE: Always resident. (Is this true???)
*/
typedef struct {
le16 ea_length; /* Byte size of the packed extended
attributes. */
le16 need_ea_count; /* The number of extended attributes which have
the NEED_EA bit set. */
le32 ea_query_length; /* Byte size of the buffer required to query
the extended attributes when calling
ZwQueryEaFile() in Windows NT/2k. I.e. the
byte size of the unpacked extended
attributes. */
} __attribute__ ((__packed__)) EA_INFORMATION;
/*
* Extended attribute flags (8-bit).
*/
enum {
NEED_EA = 0x80 /* If set the file to which the EA belongs
cannot be interpreted without understanding
the associates extended attributes. */
} __attribute__ ((__packed__));
typedef u8 EA_FLAGS;
/*
* Attribute: Extended attribute (EA) (0xe0).
*
* NOTE: Can be resident or non-resident.
*
* Like the attribute list and the index buffer list, the EA attribute value is
* a sequence of EA_ATTR variable length records.
*/
typedef struct {
le32 next_entry_offset; /* Offset to the next EA_ATTR. */
EA_FLAGS flags; /* Flags describing the EA. */
u8 ea_name_length; /* Length of the name of the EA in bytes
excluding the '\0' byte terminator. */
le16 ea_value_length; /* Byte size of the EA's value. */
u8 ea_name[0]; /* Name of the EA. Note this is ASCII, not
Unicode and it is zero terminated. */
u8 ea_value[0]; /* The value of the EA. Immediately follows
the name. */
} __attribute__ ((__packed__)) EA_ATTR;
/*
* Attribute: Property set (0xf0).
*
* Intended to support Native Structure Storage (NSS) - a feature removed from
* NTFS 3.0 during beta testing.
*/
typedef struct {
/* Irrelevant as feature unused. */
} __attribute__ ((__packed__)) PROPERTY_SET;
/*
* Attribute: Logged utility stream (0x100).
*
* NOTE: Can be resident or non-resident.
*
* Operations on this attribute are logged to the journal ($LogFile) like
* normal metadata changes.
*
* Used by the Encrypting File System (EFS). All encrypted files have this
* attribute with the name $EFS.
*/
typedef struct {
/* Can be anything the creator chooses. */
/* EFS uses it as follows: */
} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR;
#endif /* _LINUX_NTFS_LAYOUT_H */
| {
"pile_set_name": "Github"
} |
import scala.language.higherKinds
final case class Getter[S, A](get: S => A)
final case class Wrap[F[_], A](value: F[A])
object Wrap {
// Helper to defer specifying second argument to Wrap.
// Basically a type lambda specialized for Wrap.
// Wr[F]#ap[A] =:= Wrap[F, A]
type Wr[F[_]] = { type ap[A] = Wrap[F, A] }
implicit def unwrapper[F[_], A]: Getter[Wrap[F, A], F[A]] =
Getter(w => w.value)
}
object Test {
import Wrap._
type Foo[A] = List[A]
type Bar[A] = String
type WrapFoo1[A] = Wrap[Foo, A]
type WrapBar1[A] = Wrap[Bar, A]
implicitly[Getter[WrapFoo1[Int], Foo[Int]]]
implicitly[Getter[WrapBar1[Int], Bar[Int]]]
type WrapFoo2[A] = Wr[Foo]#ap[A]
type WrapBar2[A] = Wr[Bar]#ap[A]
// here's evidence that the new types are the same as the old ones
implicitly[WrapFoo2[Int] =:= WrapFoo1[Int]]
implicitly[WrapBar2[Int] =:= WrapBar1[Int]]
implicitly[Getter[WrapFoo2[Int], Foo[Int]]]
implicitly[Getter[WrapBar2[Int], Bar[Int]]]
}
| {
"pile_set_name": "Github"
} |
B
32
//02
0x02
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//01
0x01
//02
0x02
//03
0x03
//04
0x04
//02
0x02
//00
0x00
//-3
0xfd
//02
0x02
//-1
0xff
//01
0x01
//00
0x00
//-5
0xfb
//-12
0xf4
//02
0x02
//00
0x00
//98
0x62
//-1
0xff
//01
0x01
//07
0x07
//05
0x05
//-2
0xfe
//02
0x02
//00
0x00 | {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UIElements;
using UnityEditor.ShaderGraph.Serialization;
namespace UnityEditor.ShaderGraph
{
[Serializable, GenerationAPI] // TODO: Public
internal abstract class Target : JsonObject
{
public string displayName { get; set; }
public bool isHidden { get; set; }
public abstract bool IsActive();
public abstract void Setup(ref TargetSetupContext context);
public abstract void GetFields(ref TargetFieldContext context);
public abstract void GetActiveBlocks(ref TargetActiveBlockContext context);
public abstract void GetPropertiesGUI(ref TargetPropertyGUIContext context, Action onChange, Action<string> registerUndo);
public virtual void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode) { }
public virtual void ProcessPreviewMaterial(Material material) { }
public virtual object saveContext => null;
public virtual bool IsNodeAllowedByTarget(Type nodeType) => true;
public abstract bool WorksWithSRP(RenderPipelineAsset scriptableRenderPipeline);
}
}
| {
"pile_set_name": "Github"
} |
## DBsubject(Calculus - single variable)
## DBchapter(Parametric)
## DBsection(Arc length)
## Institution(W.H.Freeman)
## Author(Christopher Sira)
## Level(3)
## MO(1)
## TitleText1('Calculus: Early Transcendentals')
## AuthorText1('Rogawski')
## EditionText1('2')
## Section1('11.2')
## Problem1('7')
## KEYWORDS('calculus', 'parametric', 'polar', 'conic')
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"Parser.pl",
"freemanMacros.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
$context = Context();
$a = random(2, 9);
$asq = $a ** 2;
$ans = Formula("$a * pi");
Context()->texStrings;
BEGIN_TEXT
\{ textbook_ref_exact("Rogawski ET 2e", "11.2","7") \}
Calculate the length of the path over the given interval.
\[ (\sin $a t, \cos $a t), \, 0 \le t \le \pi \]
$PAR
\{ ans_rule() \}
$PAR
END_TEXT
Context()->normalStrings;
ANS($ans->cmp);
Context()->texStrings;
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR
$SOL
We have \( x = \sin $a t, \, y = \cos $a t\), hence \( x' = $a \cos $a t\) and \( y' = - $a \sin $a t \). By the formula for the arc length we obtain:
\[ S = \int ^\pi _0 \sqrt{x'(t)^2 + y'(t)^2} \, dt = \int ^\pi _0 \sqrt{$asq \cos^2 $a t + $asq \sin^2 $a t} \, dt = \int ^\pi _0 \sqrt{$asq} \, dt = $a \pi \]
END_SOLUTION
ENDDOCUMENT();
| {
"pile_set_name": "Github"
} |
# coding=utf-8
#
# Copyright 2015-2016 F5 Networks Inc.
#
# 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.
#
# NOTE: Code taken from Effective Python Item 26
try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError as exc:
message = ("Maybe you're using Python < 2.7 and do not have the "
"orderreddict external dependency installed.")
raise exc(message)
from distutils.version import LooseVersion
from six import iteritems
import logging
from f5.sdk_exception import EmptyContent
from f5.sdk_exception import InvalidCommand
from f5.sdk_exception import LazyAttributesRequired
from f5.sdk_exception import MissingHttpHeader
from f5.sdk_exception import UnsupportedMethod
from f5.sdk_exception import UnsupportedTmosVersion
from f5.sdk_exception import UtilError
class ToDictMixin(object):
"""Convert an object's attributes to a dictionary"""
traversed = {}
Containers = tuple, list, set, frozenset, dict
def to_dict(self):
ToDictMixin.traversed = {}
return self._to_dict()
def _to_dict(self):
result = self._traverse_dict(self.__dict__)
return result
def _traverse_dict(self, instance_dict):
output = {}
# This iteration breaks if the second value comes before
# the first. We must use ordered dicts here
tmp = OrderedDict(sorted(iteritems(instance_dict), key=lambda t: t[0]))
for key, value in iteritems(tmp):
output[key] = self._traverse(key, value)
return output
def _traverse(self, key, value):
if isinstance(value, ToDictMixin.Containers) or\
hasattr(value, '__dict__'):
if id(value) in ToDictMixin.traversed:
return ToDictMixin.traversed[id(value)]
else:
ToDictMixin.traversed[id(value)] = ['TraversalRecord', key]
if isinstance(value, ToDictMixin):
return value._to_dict()
elif isinstance(value, dict):
return self._traverse_dict(value)
elif isinstance(value, list):
return [self._traverse(key, item) for item in value]
elif hasattr(value, '__dict__'):
return self._traverse_dict(value.__dict__)
else:
return value
class LazyAttributeMixin(object):
"""Allow attributes to be created lazily based on the allowed values"""
def __getattr__(container, name):
# ensure this object supports lazy attrs.
cls_name = container.__class__.__name__
if 'allowed_lazy_attributes' not in container._meta_data:
error_message = ('"allowed_lazy_attributes" not in',
'container._meta_data for class %s' % cls_name)
raise LazyAttributesRequired(error_message)
# ensure the requested attr is present
attr_names = container.transform_attr_names()
if name not in attr_names:
error_message = "'%s' object has no attribute '%s'"\
% (container.__class__, name)
raise AttributeError(error_message)
# Instantiate and potentially set the attr on the object
# Issue #112 -- Only call setattr here if the lazy attribute
# is NOT a `Resource`. This should allow for only 1 ltm attribute
# but many nat attributes just like the BIGIP device.
for lazy_attribute in container._meta_data['allowed_lazy_attributes']:
if name == lazy_attribute.__name__.lower():
attribute = lazy_attribute(container)
bases = [base.__name__ for base in lazy_attribute.__bases__]
# Doing version check per each resource
container._check_supported_versions(container, attribute)
if 'Resource' not in bases:
setattr(container, name, attribute)
return attribute
def transform_attr_names(self):
attr_names = \
[la.__name__.lower() for la in
self._meta_data['allowed_lazy_attributes']]
return attr_names
def _check_supported_versions(self, container, attribute):
tmos_v = container._meta_data['bigip'].tmos_version
minimum = attribute._meta_data['minimum_version']
if LooseVersion(tmos_v) < LooseVersion(minimum):
error = "There was an attempt to access resource: \n{}\n which " \
"is not implemented in the device's TMOS version: {}. " \
"The minimum TMOS version in which this resource *is* " \
"supported is {}".format(
attribute._meta_data['uri'],
tmos_v,
minimum)
raise UnsupportedTmosVersion(error)
def _is_version_supported_method(container, method_version):
"""Helper method
To use in instances where class methods on some resources
require a specific TMOS version to run.
Raises::
UnsupportedTmosVersion
"""
tmos_v = container._meta_data['bigip'].tmos_version
if LooseVersion(tmos_v) < LooseVersion(method_version):
error = "There was an attempt to use a method which " \
"has not been implemented or supported " \
"in the device's TMOS version: %s. " \
"Minimum TMOS version supported is %s" % (
tmos_v, method_version)
raise UnsupportedTmosVersion(error)
class ExclusiveAttributesMixin(object):
"""Overrides ``__setattr__`` to remove exclusive attrs from the object."""
def __setattr__(self, key, value):
"""Remove any of the existing exclusive attrs from the object
Objects attributes can be exclusive for example disable/enable. So
we need to make sure objects only have one of these attributes at
at time so that the updates won't fail.
"""
if '_meta_data' in self.__dict__:
# Sometimes this is called prior to full object construction
for attr_set in self._meta_data['exclusive_attributes']:
if key in attr_set:
new_set = set(attr_set) - set([key])
[self.__dict__.pop(n, '') for n in new_set]
# Now set the attribute
super(ExclusiveAttributesMixin, self).__setattr__(key, value)
class CommandExecutionMixin(object):
"""This adds command execution option on the objects.
These objects do not support create, delete, load, and require
a separate method of execution. Commands do not have
direct mapping to an HTTP method so usage of POST
and an absolute URI is required.
"""
def create(self, **kwargs):
"""Create is not supported for command execution
:raises: UnsupportedOperation
"""
raise UnsupportedMethod(
"%s does not support the create method" % self.__class__.__name__
)
def delete(self, **kwargs):
"""Delete is not supported for command execution
:raises: UnsupportedOperation
"""
raise UnsupportedMethod(
"%s does not support the delete method" % self.__class__.__name__
)
def load(self, **kwargs):
"""Load is not supported for command execution
:raises: UnsupportedOperation
"""
raise UnsupportedMethod(
"%s does not support the load method" % self.__class__.__name__
)
def _is_allowed_command(self, command):
"""Checking if the given command is allowed on a given endpoint."""
cmds = self._meta_data['allowed_commands']
if command not in self._meta_data['allowed_commands']:
error_message = "The command value {0} does not exist. " \
"Valid commands are {1}".format(command, cmds)
raise InvalidCommand(error_message)
def _check_command_result(self):
"""If command result exists run these checks."""
if self.commandResult.startswith('/bin/bash'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.startswith('/bin/mv'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.startswith('/bin/ls'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if self.commandResult.startswith('/bin/rm'):
raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
if 'invalid option' in self.commandResult:
raise UtilError('%s' % self.commandResult)
if 'Invalid option' in self.commandResult:
raise UtilError('%s' % self.commandResult)
if 'usage: /usr/bin/get_dossier' in self.commandResult:
raise UtilError('%s' % self.commandResult)
def exec_cmd(self, command, **kwargs):
"""Wrapper method that can be changed in the inheriting classes."""
self._is_allowed_command(command)
self._check_command_parameters(**kwargs)
return self._exec_cmd(command, **kwargs)
def _exec_cmd(self, command, **kwargs):
"""Create a new method as command has specific requirements.
There is a handful of the TMSH global commands supported,
so this method requires them as a parameter.
:raises: InvalidCommand
"""
kwargs['command'] = command
self._check_exclusive_parameters(**kwargs)
requests_params = self._handle_requests_params(kwargs)
session = self._meta_data['bigip']._meta_data['icr_session']
response = session.post(
self._meta_data['uri'], json=kwargs, **requests_params)
new_instance = self._stamp_out_core()
new_instance._local_update(response.json())
if 'commandResult' in new_instance.__dict__:
new_instance._check_command_result()
return new_instance
class FileUploadMixin(object):
def _upload_file(self, filepathname, **kwargs):
with open(filepathname, 'rb') as fileobj:
self._upload(fileobj, **kwargs)
def _upload(self, fileinterface, **kwargs):
size = len(fileinterface.read())
fileinterface.seek(0)
requests_params = self._handle_requests_params(kwargs)
session = self._meta_data['icr_session']
chunk_size = kwargs.pop('chunk_size', 512 * 1024)
start = 0
while True:
file_slice = fileinterface.read(chunk_size)
if not file_slice:
break
current_bytes = len(file_slice)
if current_bytes < chunk_size:
end = size
else:
end = start + current_bytes
headers = {
'Content-Range': '%s-%s/%s' % (start, end - 1, size),
'Content-Type': 'application/octet-stream'}
data = {
'data': file_slice,
'headers': headers,
'verify': False
}
logging.debug(data)
requests_params.update(data)
session.post(self.file_bound_uri,
**requests_params)
start += current_bytes
class FileDownloadMixin(object):
def _download_file(self, src, dest, **kwargs):
with open(dest, 'wb') as fileobj:
self._download(src, fileobj, **kwargs)
def _download(self, src, fileinterface, **kwargs):
requests_params = self._handle_requests_params(kwargs)
session = self._meta_data['icr_session']
chunk_size = kwargs.pop('chunk_size', 512 * 1024)
self.file_bound_uri = self._meta_data['uri'] + src
start = 0
end = chunk_size - 1
size = 0
current_bytes = 0
while True:
content_range = "%s-%s/%s" % (start, end, size)
headers = {
'Content-Range': content_range,
'Content-Type': 'application/octet-stream'
}
data = {
'headers': headers,
'verify': False,
'stream': True
}
logging.debug(data)
requests_params.update(data)
response = session.get(self.file_bound_uri,
**requests_params)
if response.status_code == 200:
# If the size is zero, then this is the first time through
# the loop and we don't want to write data because we
# haven't yet figured out the total size of the file.
if size > 0:
current_bytes += chunk_size
for chunk in response.iter_content(chunk_size):
fileinterface.write(chunk)
# Once we've downloaded the entire file, we can break out of
# the loop
if end == size:
break
crange = response.headers['Content-Range']
# Determine the total number of bytes to read.
if size == 0:
size = int(crange.split('/')[-1]) - 1
# If the file is smaller than the chunk_size, the BigIP
# will return an HTTP 400. Adjust the chunk_size down to
# the total file size...
if chunk_size > size:
end = size
# ...and pass on the rest of the code.
continue
start += chunk_size
if (current_bytes + chunk_size) > size:
end = size
else:
end = start + chunk_size - 1
class AsmFileMixin(object):
"""Mixin for manipulating files for ASM file-transfer endpoints.
For ease of code maintenance this is separate from FileUploadMixin
on purpose.
"""
def _download_file(self, filepathname):
self._download(filepathname)
def _download(self, filepathname):
session = self._meta_data['icr_session']
with open(filepathname, 'wb') as writefh:
headers = {
'Content-Type': 'application/json'
}
req_params = {'headers': headers,
'verify': False}
response = session.get(self.file_bound_uri, **req_params)
if response.status_code == 200:
if 'Content-Length' not in response.headers:
error_message = "The Content-Length header is not present."
raise MissingHttpHeader(error_message)
length = response.headers['Content-Length']
if int(length) > 0:
writefh.write(response.content)
else:
error = "Invalid Content-Length value returned: %s ," \
"the value should be greater than 0" % length
raise EmptyContent(error)
def _upload_file(self, filepathname, **kwargs):
with open(filepathname, 'rb') as fileobj:
self._upload(fileobj, **kwargs)
def _upload(self, fileinterface, **kwargs):
size = len(fileinterface.read())
fileinterface.seek(0)
requests_params = self._handle_requests_params(kwargs)
session = self._meta_data['icr_session']
chunk_size = kwargs.pop('chunk_size', 512 * 1024)
start = 0
while True:
file_slice = fileinterface.read(chunk_size)
if not file_slice:
break
current_bytes = len(file_slice)
if current_bytes < chunk_size:
end = size
else:
end = start + current_bytes
headers = {
'Content-Range': '%s-%s/%s' % (start, end - 1, size),
'Content-Type': 'application/octet-stream'}
data = {'data': file_slice,
'headers': headers,
'verify': False}
logging.debug(data)
requests_params.update(data)
session.post(self.file_bound_uri,
**requests_params)
start += current_bytes
class DeviceMixin(object):
'''Manage BigIP device cluster in a general way.'''
def get_device_info(self, bigip):
'''Get device information about a specific BigIP device.
:param bigip: bigip object --- device to inspect
:returns: bigip object
'''
coll = bigip.tm.cm.devices.get_collection()
device = [device for device in coll if device.selfDevice == 'true']
assert len(device) == 1
return device[0]
class CheckExistenceMixin(object):
'''In 11.6.0 some items return True on exists whether they exist or not'''
def _check_existence_by_collection(self, container, item_name):
'''Check existnce of item based on get collection call.
:param collection: container object -- capable of get_collection()
:param item_name: str -- name of item to search for in collection
'''
coll = container.get_collection()
for item in coll:
if item.name == item_name:
return True
return False
def _return_object(self, container, item_name):
"""Helper method to retrieve the object"""
coll = container.get_collection()
for item in coll:
if item.name == item_name:
return item
class UpdateMonitorMixin(object):
def update(self, **kwargs):
"""Change the configuration of the resource on the device.
This method uses Http PUT alter the service state on the device.
The attributes of the instance will be packaged as a dictionary. That
dictionary will be updated with kwargs. It is then submitted as JSON
to the device. Various edge cases are handled:
* read-only attributes that are unchangeable are removed
* ``defaultsFrom`` attribute is removed from JSON before the PUT
:param kwargs: keys and associated values to alter on the device
"""
self.__dict__.pop('defaultsFrom', '')
self._update(**kwargs)
| {
"pile_set_name": "Github"
} |
{
"name": "not-a-real-dep",
"version": "0.0.0"
} | {
"pile_set_name": "Github"
} |
# Copyright Materialize, Inc. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
"""A pure Python metadata parser for Cargo, Rust's package manager.
See the [Cargo] documentation for details. Only the features that are presently
necessary to support this repository are implemented.
[Cargo]: https://doc.rust-lang.org/cargo/
"""
from materialize import git
from pathlib import Path
from typing import Set
import semver
import toml
class Crate:
"""A Cargo crate.
A crate directory must contain a `Cargo.toml` file with `package.name` and
`package.version` keys.
Args:
root: The path to the root of the workspace.
path: The path to the crate directory.
Attributes:
name: The name of the crate.
version: The version of the crate.
"""
def __init__(self, root: Path, path: Path):
self.root = root
with open(path / "Cargo.toml") as f:
config = toml.load(f)
self.name = config["package"]["name"]
self.version = semver.VersionInfo.parse(config["package"]["version"])
self.path = path
self.path_dependencies: Set[str] = set()
for dep_type in ["build-dependencies", "dependencies"]:
if dep_type in config:
self.path_dependencies.update(
c.get("package", name)
for name, c in config[dep_type].items()
if "path" in c
)
self.bins = []
if "bin" in config:
for bin in config["bin"]:
self.bins.append(bin["name"])
if (path / "src" / "main.rs").exists():
self.bins.append(self.name)
for path in (path / "src" / "bin").glob("*.rs"):
self.bins.append(path.stem)
def inputs(self) -> Set[str]:
"""Compute the files that can impact the compilation of this crate.
Note that the returned list may have false positives (i.e., include
files that do not in fact impact the compilation of this crate), but it
is not believed to have false negatives.
Returns:
inputs: A list of input files, relative to the root of the
Cargo workspace.
"""
# NOTE(benesch): it would be nice to have fine-grained tracking of only
# exactly the files that go into a Rust crate, but doing this properly
# requires parsing Rust code, and we don't want to force a dependency on
# a Rust toolchain for users running demos. Instead, we assume that all†
# files in a crate's directory are inputs to that crate.
#
# † As a development convenience, we omit mzcompose and mzcompose.yml
# files within a crate. This is technically incorrect if someone writes
# `include!("mzcompose.yml")`, but that seems like a crazy thing to do.
return git.expand_globs(
self.root,
f"{self.path}/**",
f":(exclude){self.path}/mzcompose",
f":(exclude){self.path}/mzcompose.yml",
)
class Workspace:
"""A Cargo workspace.
A workspace directory must contain a `Cargo.toml` file with a
`workspace.members` key.
Args:
root: The path to the root of the workspace.
"""
def __init__(self, root: Path):
with open(root / "Cargo.toml") as f:
config = toml.load(f)
self.crates = {}
for path in config["workspace"]["members"]:
crate = Crate(root, root / path)
self.crates[crate.name] = crate
def crate_for_bin(self, bin: str) -> Crate:
"""Find the crate containing the named binary.
Args:
bin: The name of the binary to find.
Raises:
ValueError: The named binary did not exist in exactly one crate in
the Cargo workspace.
"""
out = None
for crate in self.crates.values():
for b in crate.bins:
if b == bin:
if out is not None:
raise ValueError(
f"bin {bin} appears more than once in cargo workspace"
)
out = crate
if out is None:
raise ValueError(f"bin {bin} does not exist in cargo workspace")
return out
def transitive_path_dependencies(self, crate: Crate) -> Set[Crate]:
"""Collects the transitive path dependencies of the requested crate.
Note that only _path_ dependencies are collected. Other types of
dependencies, like registry or Git dependencies, are not collected.
Args:
crate: The crate object from which to start the dependency crawl.
Returns:
crate_set: A set of all of the crates in this Cargo workspace upon
which the input crate depended upon, whether directly or
transitively.
Raises:
IndexError: The input crate did not exist.
"""
deps = set()
def visit(c: Crate) -> None:
deps.add(c)
for d in c.path_dependencies:
visit(self.crates[d])
visit(crate)
return deps
| {
"pile_set_name": "Github"
} |
{
"Resources": {
"NewVolume" : {
"Type" : "AWS::EC2::Volume",
"Properties" : {
"Size" : 101,
"Encrypted": true,
"AvailabilityZone" : "us-west-2b"
}
},
"NewVolume2" : {
"Type" : "AWS::EC2::Volume",
"Properties" : {
"Size" : 99,
"Encrypted": true,
"AvailabilityZone" : "us-west-2c"
}
}
}
}
| {
"pile_set_name": "Github"
} |
package pl.allegro.tech.build.axion.release.domain.hooks;
import groovy.lang.Closure;
public class SimpleReleaseHookAction implements ReleaseHookAction {
private final Closure customAction;
public SimpleReleaseHookAction(Closure customAction) {
this.customAction = customAction;
}
@Override
public void act(HookContext hookContext) {
customAction.call(hookContext);
}
public final static class Factory extends DefaultReleaseHookFactory {
@Override
public ReleaseHookAction create(Closure customAction) {
return new SimpleReleaseHookAction(customAction);
}
}
}
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
// Digital Ltd. LLC
//
// 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 Industrial Light & Magic nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
#ifndef IMFDEEPSCANLINEINPUTPART_H_
#define IMFDEEPSCANLINEINPUTPART_H_
#include "ImfMultiPartInputFile.h"
#include "ImfDeepScanLineInputFile.h"
#include "ImfDeepScanLineOutputFile.h"
#include "ImfNamespace.h"
#include "ImfExport.h"
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
class DeepScanLineInputPart
{
public:
IMF_EXPORT
DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
//------------------------
// Access to the file name
//------------------------
IMF_EXPORT
const char * fileName () const;
//--------------------------
// Access to the file header
//--------------------------
IMF_EXPORT
const Header & header () const;
//----------------------------------
// Access to the file format version
//----------------------------------
IMF_EXPORT
int version () const;
//-----------------------------------------------------------
// Set the current frame buffer -- copies the FrameBuffer
// object into the InputFile object.
//
// The current frame buffer is the destination for the pixel
// data read from the file. The current frame buffer must be
// set at least once before readPixels() is called.
// The current frame buffer can be changed after each call
// to readPixels().
//-----------------------------------------------------------
IMF_EXPORT
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
//-----------------------------------
// Access to the current frame buffer
//-----------------------------------
IMF_EXPORT
const DeepFrameBuffer & frameBuffer () const;
//---------------------------------------------------------------
// Check if the file is complete:
//
// isComplete() returns true if all pixels in the data window are
// present in the input file, or false if any pixels are missing.
// (Another program may still be busy writing the file, or file
// writing may have been aborted prematurely.)
//---------------------------------------------------------------
IMF_EXPORT
bool isComplete () const;
//---------------------------------------------------------------
// Read pixel data:
//
// readPixels(s1,s2) reads all scan lines with y coordinates
// in the interval [min (s1, s2), max (s1, s2)] from the file,
// and stores them in the current frame buffer.
//
// Both s1 and s2 must be within the interval
// [header().dataWindow().min.y, header.dataWindow().max.y]
//
// The scan lines can be read from the file in random order, and
// individual scan lines may be skipped or read multiple times.
// For maximum efficiency, the scan lines should be read in the
// order in which they were written to the file.
//
// readPixels(s) calls readPixels(s,s).
//
// If threading is enabled, readPixels (s1, s2) tries to perform
// decopmression of multiple scanlines in parallel.
//
//---------------------------------------------------------------
IMF_EXPORT
void readPixels (int scanLine1, int scanLine2);
IMF_EXPORT
void readPixels (int scanLine);
IMF_EXPORT
void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
int scanLine1,int scanLine2) const;
//----------------------------------------------
// Read a block of raw pixel data from the file,
// without uncompressing it (this function is
// used to implement OutputFile::copyPixels()).
//----------------------------------------------
IMF_EXPORT
void rawPixelData (int firstScanLine,
char * pixelData,
Int64 &pixelDataSize);
//-----------------------------------------------------------
// Read pixel sample counts into a slice in the frame buffer.
//
// readPixelSampleCounts(s1, s2) reads all the counts of
// pixel samples with y coordinates in the interval
// [min (s1, s2), max (s1, s2)] from the file, and stores
// them in the slice naming "sample count".
//
// Both s1 and s2 must be within the interval
// [header().dataWindow().min.y, header.dataWindow().max.y]
//
// readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
//-----------------------------------------------------------
IMF_EXPORT
void readPixelSampleCounts(int scanline1,
int scanline2);
IMF_EXPORT
void readPixelSampleCounts(int scanline);
IMF_EXPORT
void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
int scanLine1 , int scanLine2) const;
IMF_EXPORT
int firstScanLineInChunk(int y) const;
IMF_EXPORT
int lastScanLineInChunk (int y) const;
private:
DeepScanLineInputFile *file;
// needed for copyPixels
friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputPart &);
};
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
#endif /* IMFDEEPSCANLINEINPUTPART_H_ */
| {
"pile_set_name": "Github"
} |
/*
* drivers/input/serio/gscps2.c
*
* Copyright (c) 2004-2006 Helge Deller <[email protected]>
* Copyright (c) 2002 Laurent Canet <[email protected]>
* Copyright (c) 2002 Thibaut Varene <[email protected]>
*
* Pieces of code based on linux-2.4's hp_mouse.c & hp_keyb.c
* Copyright (c) 1999 Alex deVries <[email protected]>
* Copyright (c) 1999-2000 Philipp Rumpf <[email protected]>
* Copyright (c) 2000 Xavier Debacker <[email protected]>
* Copyright (c) 2000-2001 Thomas Marteau <[email protected]>
*
* HP GSC PS/2 port driver, found in PA/RISC Workstations
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* TODO:
* - Dino testing (did HP ever shipped a machine on which this port
* was usable/enabled ?)
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/pci_ids.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/parisc-device.h>
MODULE_AUTHOR("Laurent Canet <[email protected]>, Thibaut Varene <[email protected]>, Helge Deller <[email protected]>");
MODULE_DESCRIPTION("HP GSC PS2 port driver");
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(parisc, gscps2_device_tbl);
#define PFX "gscps2.c: "
/*
* Driver constants
*/
/* various constants */
#define ENABLE 1
#define DISABLE 0
#define GSC_DINO_OFFSET 0x0800 /* offset for DINO controller versus LASI one */
/* PS/2 IO port offsets */
#define GSC_ID 0x00 /* device ID offset (see: GSC_ID_XXX) */
#define GSC_RESET 0x00 /* reset port offset */
#define GSC_RCVDATA 0x04 /* receive port offset */
#define GSC_XMTDATA 0x04 /* transmit port offset */
#define GSC_CONTROL 0x08 /* see: Control register bits */
#define GSC_STATUS 0x0C /* see: Status register bits */
/* Control register bits */
#define GSC_CTRL_ENBL 0x01 /* enable interface */
#define GSC_CTRL_LPBXR 0x02 /* loopback operation */
#define GSC_CTRL_DIAG 0x20 /* directly control clock/data line */
#define GSC_CTRL_DATDIR 0x40 /* data line direct control */
#define GSC_CTRL_CLKDIR 0x80 /* clock line direct control */
/* Status register bits */
#define GSC_STAT_RBNE 0x01 /* Receive Buffer Not Empty */
#define GSC_STAT_TBNE 0x02 /* Transmit Buffer Not Empty */
#define GSC_STAT_TERR 0x04 /* Timeout Error */
#define GSC_STAT_PERR 0x08 /* Parity Error */
#define GSC_STAT_CMPINTR 0x10 /* Composite Interrupt = irq on any port */
#define GSC_STAT_DATSHD 0x40 /* Data Line Shadow */
#define GSC_STAT_CLKSHD 0x80 /* Clock Line Shadow */
/* IDs returned by GSC_ID port register */
#define GSC_ID_KEYBOARD 0 /* device ID values */
#define GSC_ID_MOUSE 1
static irqreturn_t gscps2_interrupt(int irq, void *dev);
#define BUFFER_SIZE 0x0f
/* GSC PS/2 port device struct */
struct gscps2port {
struct list_head node;
struct parisc_device *padev;
struct serio *port;
spinlock_t lock;
char *addr;
u8 act, append; /* position in buffer[] */
struct {
u8 data;
u8 str;
} buffer[BUFFER_SIZE+1];
int id;
};
/*
* Various HW level routines
*/
#define gscps2_readb_input(x) readb((x)+GSC_RCVDATA)
#define gscps2_readb_control(x) readb((x)+GSC_CONTROL)
#define gscps2_readb_status(x) readb((x)+GSC_STATUS)
#define gscps2_writeb_control(x, y) writeb((x), (y)+GSC_CONTROL)
/*
* wait_TBE() - wait for Transmit Buffer Empty
*/
static int wait_TBE(char *addr)
{
int timeout = 25000; /* device is expected to react within 250 msec */
while (gscps2_readb_status(addr) & GSC_STAT_TBNE) {
if (!--timeout)
return 0; /* This should not happen */
udelay(10);
}
return 1;
}
/*
* gscps2_flush() - flush the receive buffer
*/
static void gscps2_flush(struct gscps2port *ps2port)
{
while (gscps2_readb_status(ps2port->addr) & GSC_STAT_RBNE)
gscps2_readb_input(ps2port->addr);
ps2port->act = ps2port->append = 0;
}
/*
* gscps2_writeb_output() - write a byte to the port
*
* returns 1 on success, 0 on error
*/
static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data)
{
unsigned long flags;
char *addr = ps2port->addr;
if (!wait_TBE(addr)) {
printk(KERN_DEBUG PFX "timeout - could not write byte %#x\n", data);
return 0;
}
while (gscps2_readb_status(ps2port->addr) & GSC_STAT_RBNE)
/* wait */;
spin_lock_irqsave(&ps2port->lock, flags);
writeb(data, addr+GSC_XMTDATA);
spin_unlock_irqrestore(&ps2port->lock, flags);
/* this is ugly, but due to timing of the port it seems to be necessary. */
mdelay(6);
/* make sure any received data is returned as fast as possible */
/* this is important e.g. when we set the LEDs on the keyboard */
gscps2_interrupt(0, NULL);
return 1;
}
/*
* gscps2_enable() - enables or disables the port
*/
static void gscps2_enable(struct gscps2port *ps2port, int enable)
{
unsigned long flags;
u8 data;
/* now enable/disable the port */
spin_lock_irqsave(&ps2port->lock, flags);
gscps2_flush(ps2port);
data = gscps2_readb_control(ps2port->addr);
if (enable)
data |= GSC_CTRL_ENBL;
else
data &= ~GSC_CTRL_ENBL;
gscps2_writeb_control(data, ps2port->addr);
spin_unlock_irqrestore(&ps2port->lock, flags);
wait_TBE(ps2port->addr);
gscps2_flush(ps2port);
}
/*
* gscps2_reset() - resets the PS/2 port
*/
static void gscps2_reset(struct gscps2port *ps2port)
{
char *addr = ps2port->addr;
unsigned long flags;
/* reset the interface */
spin_lock_irqsave(&ps2port->lock, flags);
gscps2_flush(ps2port);
writeb(0xff, addr+GSC_RESET);
gscps2_flush(ps2port);
spin_unlock_irqrestore(&ps2port->lock, flags);
}
static LIST_HEAD(ps2port_list);
/**
* gscps2_interrupt() - Interruption service routine
*
* This function reads received PS/2 bytes and processes them on
* all interfaces.
* The problematic part here is, that the keyboard and mouse PS/2 port
* share the same interrupt and it's not possible to send data if any
* one of them holds input data. To solve this problem we try to receive
* the data as fast as possible and handle the reporting to the upper layer
* later.
*/
static irqreturn_t gscps2_interrupt(int irq, void *dev)
{
struct gscps2port *ps2port;
list_for_each_entry(ps2port, &ps2port_list, node) {
unsigned long flags;
spin_lock_irqsave(&ps2port->lock, flags);
while ( (ps2port->buffer[ps2port->append].str =
gscps2_readb_status(ps2port->addr)) & GSC_STAT_RBNE ) {
ps2port->buffer[ps2port->append].data =
gscps2_readb_input(ps2port->addr);
ps2port->append = ((ps2port->append+1) & BUFFER_SIZE);
}
spin_unlock_irqrestore(&ps2port->lock, flags);
} /* list_for_each_entry */
/* all data was read from the ports - now report the data to upper layer */
list_for_each_entry(ps2port, &ps2port_list, node) {
while (ps2port->act != ps2port->append) {
unsigned int rxflags;
u8 data, status;
/* Did new data arrived while we read existing data ?
If yes, exit now and let the new irq handler start over again */
if (gscps2_readb_status(ps2port->addr) & GSC_STAT_CMPINTR)
return IRQ_HANDLED;
status = ps2port->buffer[ps2port->act].str;
data = ps2port->buffer[ps2port->act].data;
ps2port->act = ((ps2port->act+1) & BUFFER_SIZE);
rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) |
((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 );
serio_interrupt(ps2port->port, data, rxflags);
} /* while() */
} /* list_for_each_entry */
return IRQ_HANDLED;
}
/*
* gscps2_write() - send a byte out through the aux interface.
*/
static int gscps2_write(struct serio *port, unsigned char data)
{
struct gscps2port *ps2port = port->port_data;
if (!gscps2_writeb_output(ps2port, data)) {
printk(KERN_DEBUG PFX "sending byte %#x failed.\n", data);
return -1;
}
return 0;
}
/*
* gscps2_open() is called when a port is opened by the higher layer.
* It resets and enables the port.
*/
static int gscps2_open(struct serio *port)
{
struct gscps2port *ps2port = port->port_data;
gscps2_reset(ps2port);
/* enable it */
gscps2_enable(ps2port, ENABLE);
gscps2_interrupt(0, NULL);
return 0;
}
/*
* gscps2_close() disables the port
*/
static void gscps2_close(struct serio *port)
{
struct gscps2port *ps2port = port->port_data;
gscps2_enable(ps2port, DISABLE);
}
/**
* gscps2_probe() - Probes PS2 devices
* @return: success/error report
*/
static int __init gscps2_probe(struct parisc_device *dev)
{
struct gscps2port *ps2port;
struct serio *serio;
unsigned long hpa = dev->hpa.start;
int ret;
if (!dev->irq)
return -ENODEV;
/* Offset for DINO PS/2. Works with LASI even */
if (dev->id.sversion == 0x96)
hpa += GSC_DINO_OFFSET;
ps2port = kzalloc(sizeof(struct gscps2port), GFP_KERNEL);
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!ps2port || !serio) {
ret = -ENOMEM;
goto fail_nomem;
}
dev_set_drvdata(&dev->dev, ps2port);
ps2port->port = serio;
ps2port->padev = dev;
ps2port->addr = ioremap_nocache(hpa, GSC_STATUS + 4);
spin_lock_init(&ps2port->lock);
gscps2_reset(ps2port);
ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f;
snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s",
(ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse");
strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
serio->id.type = SERIO_8042;
serio->write = gscps2_write;
serio->open = gscps2_open;
serio->close = gscps2_close;
serio->port_data = ps2port;
serio->dev.parent = &dev->dev;
ret = -EBUSY;
if (request_irq(dev->irq, gscps2_interrupt, IRQF_SHARED, ps2port->port->name, ps2port))
goto fail_miserably;
if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) {
printk(KERN_WARNING PFX "Unsupported PS/2 port at 0x%08lx (id=%d) ignored\n",
hpa, ps2port->id);
ret = -ENODEV;
goto fail;
}
#if 0
if (!request_mem_region(hpa, GSC_STATUS + 4, ps2port->port.name))
goto fail;
#endif
printk(KERN_INFO "serio: %s port at 0x%p irq %d @ %s\n",
ps2port->port->name,
ps2port->addr,
ps2port->padev->irq,
ps2port->port->phys);
serio_register_port(ps2port->port);
list_add_tail(&ps2port->node, &ps2port_list);
return 0;
fail:
free_irq(dev->irq, ps2port);
fail_miserably:
iounmap(ps2port->addr);
release_mem_region(dev->hpa.start, GSC_STATUS + 4);
fail_nomem:
kfree(ps2port);
kfree(serio);
return ret;
}
/**
* gscps2_remove() - Removes PS2 devices
* @return: success/error report
*/
static int __devexit gscps2_remove(struct parisc_device *dev)
{
struct gscps2port *ps2port = dev_get_drvdata(&dev->dev);
serio_unregister_port(ps2port->port);
free_irq(dev->irq, ps2port);
gscps2_flush(ps2port);
list_del(&ps2port->node);
iounmap(ps2port->addr);
#if 0
release_mem_region(dev->hpa, GSC_STATUS + 4);
#endif
dev_set_drvdata(&dev->dev, NULL);
kfree(ps2port);
return 0;
}
static struct parisc_device_id gscps2_device_tbl[] = {
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */
#ifdef DINO_TESTED
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */
#endif
{ 0, } /* 0 terminated list */
};
static struct parisc_driver parisc_ps2_driver = {
.name = "gsc_ps2",
.id_table = gscps2_device_tbl,
.probe = gscps2_probe,
.remove = gscps2_remove,
};
static int __init gscps2_init(void)
{
register_parisc_driver(&parisc_ps2_driver);
return 0;
}
static void __exit gscps2_exit(void)
{
unregister_parisc_driver(&parisc_ps2_driver);
}
module_init(gscps2_init);
module_exit(gscps2_exit);
| {
"pile_set_name": "Github"
} |
15:A8:F5:AE:6D:33:EB:E0:15:22:31:9B:A0:07:3B:7F:44:FB:85:9C:1D:F6:B7:5E:75:1A:A1:A3:3A:13:8D:86
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.