unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
168,916 | 0 | DevToolsAgentHost::List GetBrowserAgentHosts() {
DevToolsAgentHost::List result;
for (const auto& id_host : g_devtools_instances.Get()) {
if (id_host.second->GetType() == DevToolsAgentHost::kTypeBrowser)
result.push_back(id_host.second);
}
return result;
}
| 8,400 |
155,424 | 0 | ParseCertificatePrincipalPattern(const base::Value* pattern) {
return certificate_matching::CertificatePrincipalPattern::
ParseFromOptionalDict(pattern, "CN", "L", "O", "OU");
}
| 8,401 |
49,134 | 0 | brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
{
strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1);
iebuf[VNDR_IE_CMD_LEN - 1] = '\0';
put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]);
put_unaligned_le32(pktflag, &iebuf[VNDR_IE_PKTFLAG_OFFSET]);
memcpy(&iebuf[VNDR_IE_VSIE_OFFSET], ie_ptr, ie_len);
return ie_len + VNDR_IE_HDR_SIZE;
}
| 8,402 |
140,406 | 0 | void TypingCommand::insertTextRunWithoutNewlines(const String& text,
bool selectInsertedText,
EditingState* editingState) {
CompositeEditCommand* command;
if (isIncrementalInsertion()) {
command = InsertIncrementalTextCommand::create(
document(), text, selectInsertedText,
m_compositionType == TextCompositionNone
? InsertIncrementalTextCommand::
RebalanceLeadingAndTrailingWhitespaces
: InsertIncrementalTextCommand::RebalanceAllWhitespaces);
} else {
command = InsertTextCommand::create(
document(), text, selectInsertedText,
m_compositionType == TextCompositionNone
? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces
: InsertTextCommand::RebalanceAllWhitespaces);
}
applyCommandToComposite(command, endingSelection(), editingState);
if (editingState->isAborted())
return;
typingAddedToOpenCommand(InsertText);
}
| 8,403 |
67,550 | 0 | static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page)
{
int len;
loff_t size = i_size_read(mpd->inode);
int err;
BUG_ON(page->index != mpd->first_page);
if (page->index == size >> PAGE_SHIFT)
len = size & ~PAGE_MASK;
else
len = PAGE_SIZE;
clear_page_dirty_for_io(page);
err = ext4_bio_write_page(&mpd->io_submit, page, len, mpd->wbc, false);
if (!err)
mpd->wbc->nr_to_write--;
mpd->first_page++;
return err;
}
| 8,404 |
5,696 | 0 | static TRBCCode xhci_disable_slot(XHCIState *xhci, unsigned int slotid)
{
int i;
trace_usb_xhci_slot_disable(slotid);
assert(slotid >= 1 && slotid <= xhci->numslots);
for (i = 1; i <= 31; i++) {
if (xhci->slots[slotid-1].eps[i-1]) {
xhci_disable_ep(xhci, slotid, i);
}
}
xhci->slots[slotid-1].enabled = 0;
xhci->slots[slotid-1].addressed = 0;
xhci->slots[slotid-1].uport = NULL;
return CC_SUCCESS;
}
| 8,405 |
120,252 | 0 | RendererCapabilities::RendererCapabilities(ResourceFormat best_texture_format,
bool allow_partial_texture_updates,
bool using_offscreen_context3d,
int max_texture_size,
bool using_shared_memory_resources)
: best_texture_format(best_texture_format),
allow_partial_texture_updates(allow_partial_texture_updates),
using_offscreen_context3d(using_offscreen_context3d),
max_texture_size(max_texture_size),
using_shared_memory_resources(using_shared_memory_resources) {}
| 8,406 |
25,068 | 0 | struct sock * __inet_lookup_established(struct net *net,
struct inet_hashinfo *hashinfo,
const __be32 saddr, const __be16 sport,
const __be32 daddr, const u16 hnum,
const int dif)
{
INET_ADDR_COOKIE(acookie, saddr, daddr)
const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
struct sock *sk;
const struct hlist_nulls_node *node;
/* Optimize here for direct hit, only listening connections can
* have wildcards anyways.
*/
unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport);
unsigned int slot = hash & hashinfo->ehash_mask;
struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
rcu_read_lock();
begin:
sk_nulls_for_each_rcu(sk, node, &head->chain) {
if (INET_MATCH(sk, net, hash, acookie,
saddr, daddr, ports, dif)) {
if (unlikely(!atomic_inc_not_zero(&sk->sk_refcnt)))
goto begintw;
if (unlikely(!INET_MATCH(sk, net, hash, acookie,
saddr, daddr, ports, dif))) {
sock_put(sk);
goto begin;
}
goto out;
}
}
/*
* if the nulls value we got at the end of this lookup is
* not the expected one, we must restart lookup.
* We probably met an item that was moved to another chain.
*/
if (get_nulls_value(node) != slot)
goto begin;
begintw:
/* Must check for a TIME_WAIT'er before going to listener hash. */
sk_nulls_for_each_rcu(sk, node, &head->twchain) {
if (INET_TW_MATCH(sk, net, hash, acookie,
saddr, daddr, ports, dif)) {
if (unlikely(!atomic_inc_not_zero(&sk->sk_refcnt))) {
sk = NULL;
goto out;
}
if (unlikely(!INET_TW_MATCH(sk, net, hash, acookie,
saddr, daddr, ports, dif))) {
sock_put(sk);
goto begintw;
}
goto out;
}
}
/*
* if the nulls value we got at the end of this lookup is
* not the expected one, we must restart lookup.
* We probably met an item that was moved to another chain.
*/
if (get_nulls_value(node) != slot)
goto begintw;
sk = NULL;
out:
rcu_read_unlock();
return sk;
}
| 8,407 |
159,298 | 0 | void WebGLRenderingContextBase::DrawElementsInstancedANGLE(GLenum mode,
GLsizei count,
GLenum type,
long long offset,
GLsizei primcount) {
if (!ValidateDrawElements("drawElementsInstancedANGLE", type, offset))
return;
if (!bound_vertex_array_object_->IsAllEnabledAttribBufferBound()) {
SynthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstancedANGLE",
"no buffer is bound to enabled attribute");
return;
}
ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_,
drawing_buffer_.get());
ClearIfComposited();
ContextGL()->DrawElementsInstancedANGLE(
mode, count, type, reinterpret_cast<void*>(static_cast<intptr_t>(offset)),
primcount);
MarkContextChanged(kCanvasChanged);
}
| 8,408 |
1,265 | 0 | SplashScreen *Splash::getScreen() {
return state->screen;
}
| 8,409 |
167,340 | 0 | explicit FlashContentSettingsChangeWaiter(Profile* profile)
: profile_(profile) {
HostContentSettingsMapFactory::GetForProfile(profile)->AddObserver(this);
}
| 8,410 |
157,199 | 0 | void WebMediaPlayerImpl::EnableOverlay() {
overlay_enabled_ = true;
if (request_routing_token_cb_ &&
overlay_mode_ == OverlayMode::kUseAndroidOverlay) {
overlay_routing_token_is_pending_ = true;
token_available_cb_.Reset(
base::Bind(&WebMediaPlayerImpl::OnOverlayRoutingToken, AsWeakPtr()));
request_routing_token_cb_.Run(token_available_cb_.callback());
}
if (decoder_requires_restart_for_overlay_)
ScheduleRestart();
}
| 8,411 |
177,601 | 0 | vpx_codec_err_t DecodeRemainingFrames() {
for (; video_->cxdata() != NULL; video_->Next()) {
const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK)
return res;
CheckDecodedFrames();
}
return VPX_CODEC_OK;
}
| 8,412 |
112,662 | 0 | void DocumentLoader::handleSubstituteDataLoadSoon()
{
if (m_deferMainResourceDataLoad)
startDataLoadTimer();
else
handleSubstituteDataLoadNow(0);
}
| 8,413 |
71,186 | 0 | static void hardware_disable_nolock(void *junk)
{
int cpu = raw_smp_processor_id();
if (!cpumask_test_cpu(cpu, cpus_hardware_enabled))
return;
cpumask_clear_cpu(cpu, cpus_hardware_enabled);
kvm_arch_hardware_disable();
}
| 8,414 |
29,087 | 0 | bool kvm_largepages_enabled(void)
{
return largepages_enabled;
}
| 8,415 |
48,526 | 0 | static inline void ion_buffer_page_clean(struct page **page)
{
*page = (struct page *)((unsigned long)(*page) & ~(1UL));
}
| 8,416 |
122,988 | 0 | bool RenderWidgetHostImpl::IsMouseLocked() const {
return view_ ? view_->IsMouseLocked() : false;
}
| 8,417 |
69,424 | 0 | static void copy_sec_desc(const struct cifs_ntsd *pntsd,
struct cifs_ntsd *pnntsd, __u32 sidsoffset)
{
struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
struct cifs_sid *nowner_sid_ptr, *ngroup_sid_ptr;
/* copy security descriptor control portion */
pnntsd->revision = pntsd->revision;
pnntsd->type = pntsd->type;
pnntsd->dacloffset = cpu_to_le32(sizeof(struct cifs_ntsd));
pnntsd->sacloffset = 0;
pnntsd->osidoffset = cpu_to_le32(sidsoffset);
pnntsd->gsidoffset = cpu_to_le32(sidsoffset + sizeof(struct cifs_sid));
/* copy owner sid */
owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
le32_to_cpu(pntsd->osidoffset));
nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset);
cifs_copy_sid(nowner_sid_ptr, owner_sid_ptr);
/* copy group sid */
group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
le32_to_cpu(pntsd->gsidoffset));
ngroup_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset +
sizeof(struct cifs_sid));
cifs_copy_sid(ngroup_sid_ptr, group_sid_ptr);
return;
}
| 8,418 |
181,333 | 1 | void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *ary,
int chunks)
{
ary->wc_discrim = xdr_one;
ary->wc_nchunks = cpu_to_be32(chunks);
}
| 8,419 |
68,804 | 0 | static ssize_t k90_store_macro_mode(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int ret;
struct usb_interface *usbif = to_usb_interface(dev->parent);
struct usb_device *usbdev = interface_to_usbdev(usbif);
__u16 value;
if (strncmp(buf, "SW", 2) == 0)
value = K90_MACRO_MODE_SW;
else if (strncmp(buf, "HW", 2) == 0)
value = K90_MACRO_MODE_HW;
else
return -EINVAL;
ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0),
K90_REQUEST_MACRO_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_DEVICE, value, 0, NULL, 0,
USB_CTRL_SET_TIMEOUT);
if (ret != 0) {
dev_warn(dev, "Failed to set macro mode.\n");
return ret;
}
return count;
}
| 8,420 |
89,765 | 0 | static void save_nonewprivs(void) {
if (arg_nonewprivs == 0)
return;
FILE *fp = fopen(RUN_NONEWPRIVS_CFG, "wxe");
if (fp) {
fprintf(fp, "\n");
SET_PERMS_STREAM(fp, 0, 0, 0644); // assume mode 0644
fclose(fp);
}
else {
fprintf(stderr, "Error: cannot save nonewprivs state\n");
exit(1);
}
}
| 8,421 |
53,884 | 0 | void __init acpi_osi_setup(char *str)
{
struct osi_setup_entry *osi;
bool enable = true;
int i;
if (!acpi_gbl_create_osi_method)
return;
if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
return;
}
if (*str == '!') {
str++;
if (*str == '\0') {
osi_linux.default_disabling = 1;
return;
} else if (*str == '*') {
acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
osi->enable = false;
}
return;
}
enable = false;
}
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
if (!strcmp(osi->string, str)) {
osi->enable = enable;
break;
} else if (osi->string[0] == '\0') {
osi->enable = enable;
strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
break;
}
}
}
| 8,422 |
48,518 | 0 | bool ion_buffer_cached(struct ion_buffer *buffer)
{
return !!(buffer->flags & ION_FLAG_CACHED);
}
| 8,423 |
154,328 | 0 | static void RebindCurrentFramebuffer(gl::GLApi* api,
GLenum target,
Framebuffer* framebuffer,
GLuint back_buffer_service_id) {
GLuint framebuffer_id = framebuffer ? framebuffer->service_id() : 0;
if (framebuffer_id == 0) {
framebuffer_id = back_buffer_service_id;
}
api->glBindFramebufferEXTFn(target, framebuffer_id);
}
| 8,424 |
62,840 | 0 | static void bio_release_pages(struct bio *bio)
{
struct bio_vec *bvec;
int i;
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
if (page)
put_page(page);
}
}
| 8,425 |
141,195 | 0 | void Document::RemoveAXContext(AXContext* context) {
auto** iter =
std::find_if(ax_contexts_.begin(), ax_contexts_.end(),
[&context](const auto& item) { return item == context; });
if (iter != ax_contexts_.end())
ax_contexts_.erase(iter);
if (ax_contexts_.size() == 0)
ClearAXObjectCache();
}
| 8,426 |
52,942 | 0 | static int qib_open(struct inode *in, struct file *fp)
{
/* The real work is performed later in qib_assign_ctxt() */
fp->private_data = kzalloc(sizeof(struct qib_filedata), GFP_KERNEL);
if (fp->private_data) /* no cpu affinity by default */
((struct qib_filedata *)fp->private_data)->rec_cpu_num = -1;
return fp->private_data ? 0 : -ENOMEM;
}
| 8,427 |
153,787 | 0 | void GLES2Implementation::PathCommandsCHROMIUM(GLuint path,
GLsizei num_commands,
const GLubyte* commands,
GLsizei num_coords,
GLenum coord_type,
const void* coords) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPathCommandsCHROMIUM(" << path
<< ", " << num_commands << ", " << commands << ", "
<< num_coords << ", " << coords << ")");
static const char kFunctionName[] = "glPathCommandsCHROMIUM";
if (path == 0) {
SetGLError(GL_INVALID_VALUE, kFunctionName, "invalid path object");
return;
}
if (num_commands < 0) {
SetGLError(GL_INVALID_VALUE, kFunctionName, "numCommands < 0");
return;
}
if (num_commands != 0 && !commands) {
SetGLError(GL_INVALID_VALUE, kFunctionName, "missing commands");
return;
}
if (num_coords < 0) {
SetGLError(GL_INVALID_VALUE, kFunctionName, "numCoords < 0");
return;
}
if (num_coords != 0 && !coords) {
SetGLError(GL_INVALID_VALUE, kFunctionName, "missing coords");
return;
}
uint32_t coord_type_size =
GLES2Util::GetGLTypeSizeForPathCoordType(coord_type);
if (coord_type_size == 0) {
SetGLError(GL_INVALID_ENUM, kFunctionName, "invalid coordType");
return;
}
if (num_commands == 0) {
helper_->PathCommandsCHROMIUM(path, num_commands, 0, 0, num_coords,
coord_type, 0, 0);
CheckGLError();
return;
}
uint32_t coords_size;
if (!base::CheckMul(num_coords, coord_type_size)
.AssignIfValid(&coords_size)) {
SetGLError(GL_INVALID_OPERATION, kFunctionName, "overflow");
return;
}
uint32_t required_buffer_size;
if (!base::CheckAdd(coords_size, num_commands)
.AssignIfValid(&required_buffer_size)) {
SetGLError(GL_INVALID_OPERATION, kFunctionName, "overflow");
return;
}
ScopedTransferBufferPtr buffer(required_buffer_size, helper_,
transfer_buffer_);
if (!buffer.valid() || buffer.size() < required_buffer_size) {
SetGLError(GL_OUT_OF_MEMORY, kFunctionName, "too large");
return;
}
uint32_t coords_shm_id = 0;
uint32_t coords_shm_offset = 0;
if (coords_size > 0) {
unsigned char* coords_addr = static_cast<unsigned char*>(buffer.address());
memcpy(coords_addr, coords, coords_size);
coords_shm_id = buffer.shm_id();
coords_shm_offset = buffer.offset();
}
DCHECK_GT(num_commands, 0);
unsigned char* commands_addr =
static_cast<unsigned char*>(buffer.address()) + coords_size;
memcpy(commands_addr, commands, num_commands);
helper_->PathCommandsCHROMIUM(path, num_commands, buffer.shm_id(),
buffer.offset() + coords_size, num_coords,
coord_type, coords_shm_id, coords_shm_offset);
CheckGLError();
}
| 8,428 |
15,548 | 0 | mux_tty_alloc_failed(Channel *c)
{
Buffer m;
Channel *mux_chan;
debug3("%s: channel %d: TTY alloc failed", __func__, c->self);
if ((mux_chan = channel_by_id(c->ctl_chan)) == NULL)
fatal("%s: channel %d missing mux channel %d",
__func__, c->self, c->ctl_chan);
/* Append exit message packet to control socket output queue */
buffer_init(&m);
buffer_put_int(&m, MUX_S_TTY_ALLOC_FAIL);
buffer_put_int(&m, c->self);
buffer_put_string(&mux_chan->output, buffer_ptr(&m), buffer_len(&m));
buffer_free(&m);
}
| 8,429 |
93,843 | 0 | virDomainLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
{
unsigned char uuid[VIR_UUID_BUFLEN];
VIR_DEBUG("conn=%p, uuidstr=%s", conn, NULLSTR(uuidstr));
virResetLastError();
virCheckConnectReturn(conn, NULL);
virCheckNonNullArgGoto(uuidstr, error);
if (virUUIDParse(uuidstr, uuid) < 0) {
virReportInvalidArg(uuidstr, "%s", _("Invalid UUID"));
goto error;
}
return virDomainLookupByUUID(conn, &uuid[0]);
error:
virDispatchError(conn);
return NULL;
}
| 8,430 |
12,457 | 0 | int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N)
{
/* Checks if A % N == 0 */
return SRP_Verify_B_mod_N(A,N) ;
}
| 8,431 |
32,982 | 0 | int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
{
struct sctp_association *asoc = sctp_id2assoc(sk, id);
struct socket *sock;
struct sctp_af *af;
int err = 0;
if (!asoc)
return -EINVAL;
/* An association cannot be branched off from an already peeled-off
* socket, nor is this supported for tcp style sockets.
*/
if (!sctp_style(sk, UDP))
return -EINVAL;
/* Create a new socket. */
err = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock);
if (err < 0)
return err;
sctp_copy_sock(sock->sk, sk, asoc);
/* Make peeled-off sockets more like 1-1 accepted sockets.
* Set the daddr and initialize id to something more random
*/
af = sctp_get_af_specific(asoc->peer.primary_addr.sa.sa_family);
af->to_sk_daddr(&asoc->peer.primary_addr, sk);
/* Populate the fields of the newsk from the oldsk and migrate the
* asoc to the newsk.
*/
sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);
*sockp = sock;
return err;
}
| 8,432 |
128,829 | 0 | gfx::SwapResult GLSurfaceOzoneSurfacelessSurfaceImpl::SwapBuffers() {
if (!images_[current_surface_]->ScheduleOverlayPlane(
widget_, 0, OverlayTransform::OVERLAY_TRANSFORM_NONE,
gfx::Rect(GetSize()), gfx::RectF(1, 1)))
return gfx::SwapResult::SWAP_FAILED;
gfx::SwapResult result = GLSurfaceOzoneSurfaceless::SwapBuffers();
if (result != gfx::SwapResult::SWAP_ACK)
return result;
current_surface_ ^= 1;
BindFramebuffer();
return gfx::SwapResult::SWAP_ACK;
}
| 8,433 |
58,586 | 0 | SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceA(void)
{
return &SSPI_SecurityFunctionTableA;
}
| 8,434 |
145,492 | 0 | void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
if (!async_revalidation_manager_)
async_revalidation_manager_.reset(new AsyncRevalidationManager);
}
| 8,435 |
158,578 | 0 | void WebLocalFrameImpl::SetIsolatedWorldSecurityOrigin(
int world_id,
const WebSecurityOrigin& security_origin) {
DCHECK(GetFrame());
DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(
world_id,
security_origin.Get() ? security_origin.Get()->IsolatedCopy() : nullptr);
}
| 8,436 |
22,995 | 0 | static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *mode)
{
__be32 *p;
*mode = 0;
if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U)))
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_MODE)) {
READ_BUF(4);
READ32(*mode);
*mode &= ~S_IFMT;
bitmap[1] &= ~FATTR4_WORD1_MODE;
}
dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode);
return 0;
}
| 8,437 |
5,569 | 0 | static inline int unhex(int c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'A' && c <= 'Z')
return c - 'A' + 10;
return c - 'a' + 10;
}
| 8,438 |
120,972 | 0 | bool SocketStream::is_secure() const {
return url_.SchemeIs("wss");
}
| 8,439 |
146,105 | 0 | ScriptValue WebGL2RenderingContextBase::getSamplerParameter(
ScriptState* script_state,
WebGLSampler* sampler,
GLenum pname) {
if (isContextLost() || !ValidateWebGLObject("getSamplerParameter", sampler))
return ScriptValue::CreateNull(script_state);
switch (pname) {
case GL_TEXTURE_COMPARE_FUNC:
case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_WRAP_R:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T: {
GLint value = 0;
ContextGL()->GetSamplerParameteriv(ObjectOrZero(sampler), pname, &value);
return WebGLAny(script_state, static_cast<unsigned>(value));
}
case GL_TEXTURE_MAX_LOD:
case GL_TEXTURE_MIN_LOD: {
GLfloat value = 0.f;
ContextGL()->GetSamplerParameterfv(ObjectOrZero(sampler), pname, &value);
return WebGLAny(script_state, value);
}
default:
SynthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
}
| 8,440 |
56,469 | 0 | unsigned long copy_vsx_from_user(struct task_struct *task,
void __user *from)
{
u64 buf[ELF_NVSRHALFREG];
int i;
if (__copy_from_user(buf, from, ELF_NVSRHALFREG * sizeof(double)))
return 1;
for (i = 0; i < ELF_NVSRHALFREG ; i++)
task->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i];
return 0;
}
| 8,441 |
124,359 | 0 | void BrowserEventRouter::DispatchEvent(
Profile* profile,
const char* event_name,
scoped_ptr<ListValue> args,
EventRouter::UserGestureState user_gesture) {
if (!profile_->IsSameProfile(profile) ||
!extensions::ExtensionSystem::Get(profile)->event_router())
return;
scoped_ptr<Event> event(new Event(event_name, args.Pass()));
event->restrict_to_profile = profile;
event->user_gesture = user_gesture;
ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
}
| 8,442 |
3,375 | 0 | static void php_apache_ini_dtor(request_rec *r, request_rec *p TSRMLS_DC)
{
if (strcmp(r->protocol, "INCLUDED")) {
zend_try { zend_ini_deactivate(TSRMLS_C); } zend_end_try();
} else {
typedef struct {
HashTable config;
} php_conf_rec;
char *str;
uint str_len;
php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module);
for (zend_hash_internal_pointer_reset(&c->config);
zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
zend_hash_move_forward(&c->config)
) {
zend_restore_ini_entry(str, str_len, ZEND_INI_STAGE_SHUTDOWN);
}
}
if (p) {
((php_struct *)SG(server_context))->r = p;
} else {
apr_pool_cleanup_run(r->pool, (void *)&SG(server_context), php_server_context_cleanup);
}
}
| 8,443 |
118,967 | 0 | void WebContentsImpl::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
switch (type) {
case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: {
RenderWidgetHost* host = Source<RenderWidgetHost>(source).ptr();
for (PendingWidgetViews::iterator i = pending_widget_views_.begin();
i != pending_widget_views_.end(); ++i) {
if (host->GetView() == i->second) {
pending_widget_views_.erase(i);
break;
}
}
break;
}
default:
NOTREACHED();
}
}
| 8,444 |
116,564 | 0 | virtual void TestInterstitialPageDeleted(TestInterstitialPage* interstitial) {
DCHECK(interstitial_page_ == interstitial);
interstitial_page_ = NULL;
}
| 8,445 |
167,167 | 0 | void HTMLMediaElement::AudioSourceProviderImpl::ProvideInput(
AudioBus* bus,
size_t frames_to_process) {
DCHECK(bus);
MutexTryLocker try_locker(provide_input_lock);
if (!try_locker.Locked() || !web_audio_source_provider_ || !client_.Get()) {
bus->Zero();
return;
}
size_t n = bus->NumberOfChannels();
WebVector<float*> web_audio_data(n);
for (size_t i = 0; i < n; ++i)
web_audio_data[i] = bus->Channel(i)->MutableData();
web_audio_source_provider_->ProvideInput(web_audio_data, frames_to_process);
}
| 8,446 |
79,823 | 0 | static void dispose_list(struct list_head *head)
{
while (!list_empty(head)) {
struct inode *inode;
inode = list_first_entry(head, struct inode, i_lru);
list_del_init(&inode->i_lru);
evict(inode);
cond_resched();
}
}
| 8,447 |
89,785 | 0 | resolve_symlinks_in_ops (void)
{
SetupOp *op;
for (op = ops; op != NULL; op = op->next)
{
const char *old_source;
switch (op->type)
{
case SETUP_RO_BIND_MOUNT:
case SETUP_DEV_BIND_MOUNT:
case SETUP_BIND_MOUNT:
old_source = op->source;
op->source = realpath (old_source, NULL);
if (op->source == NULL)
{
if (op->flags & ALLOW_NOTEXIST && errno == ENOENT)
op->source = old_source;
else
die_with_error("Can't find source path %s", old_source);
}
break;
default:
break;
}
}
}
| 8,448 |
40,187 | 0 | static void __net_exit raw6_exit_net(struct net *net)
{
remove_proc_entry("raw6", net->proc_net);
}
| 8,449 |
47,441 | 0 | static inline void padlock_store_cword(struct cword *cword)
{
per_cpu(paes_last_cword, raw_smp_processor_id()) = cword;
}
| 8,450 |
183,202 | 1 | ieee802_15_4_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
int hdrlen;
uint16_t fc;
uint8_t seq;
if (caplen < 3) {
ND_PRINT((ndo, "[|802.15.4] %x", caplen));
return caplen;
}
fc = EXTRACT_LE_16BITS(p);
hdrlen = extract_header_length(fc);
seq = EXTRACT_LE_8BITS(p + 2);
p += 3;
caplen -= 3;
ND_PRINT((ndo,"IEEE 802.15.4 %s packet ", ftypes[fc & 0x7]));
if (ndo->ndo_vflag)
ND_PRINT((ndo,"seq %02x ", seq));
if (hdrlen == -1) {
ND_PRINT((ndo,"invalid! "));
return caplen;
}
if (!ndo->ndo_vflag) {
p+= hdrlen;
caplen -= hdrlen;
} else {
uint16_t panid = 0;
switch ((fc >> 10) & 0x3) {
case 0x00:
ND_PRINT((ndo,"none "));
break;
case 0x01:
ND_PRINT((ndo,"reserved destination addressing mode"));
return 0;
case 0x02:
panid = EXTRACT_LE_16BITS(p);
p += 2;
ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
p += 2;
break;
case 0x03:
panid = EXTRACT_LE_16BITS(p);
p += 2;
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
p += 8;
break;
}
ND_PRINT((ndo,"< "));
switch ((fc >> 14) & 0x3) {
case 0x00:
ND_PRINT((ndo,"none "));
break;
case 0x01:
ND_PRINT((ndo,"reserved source addressing mode"));
return 0;
case 0x02:
if (!(fc & (1 << 6))) {
panid = EXTRACT_LE_16BITS(p);
p += 2;
}
ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
p += 2;
break;
case 0x03:
if (!(fc & (1 << 6))) {
panid = EXTRACT_LE_16BITS(p);
p += 2;
}
ND_PRINT((ndo,"%04x:%s ", panid, le64addr_string(ndo, p)));
p += 8;
break;
}
caplen -= hdrlen;
}
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
return 0;
}
| 8,451 |
104,011 | 0 | void GLES2DecoderImpl::DoDeleteSharedIdsCHROMIUM(
GLuint namespace_id, GLsizei n, const GLuint* ids) {
IdAllocatorInterface* id_allocator = group_->GetIdAllocator(namespace_id);
for (GLsizei ii = 0; ii < n; ++ii) {
id_allocator->FreeID(ids[ii]);
}
}
| 8,452 |
172,310 | 0 | static void on_alert_data(wifi_request_id id, char *buffer, int buffer_size, int err_code){
JNIHelper helper(mVM);
ALOGD("on_alert_data called, vm = %p, obj = %p, buffer_size = %d, error code = %d"
, mVM, mCls, buffer_size, err_code);
if (buffer_size > 0) {
JNIObject<jbyteArray> records = helper.newByteArray(buffer_size);
jbyte *bytes = (jbyte *) buffer;
helper.setByteArrayRegion(records, 0,buffer_size, bytes);
helper.reportEvent(mCls,"onWifiAlert","([BI)V", records.get(), err_code);
} else {
helper.reportEvent(mCls,"onWifiAlert","([BI)V", NULL, err_code);
}
}
| 8,453 |
172,542 | 0 | status_t StreamingProcessor::recordingStreamNeedsUpdate(
const Parameters ¶ms, bool *needsUpdate) {
status_t res;
if (needsUpdate == 0) {
ALOGE("%s: Camera %d: invalid argument", __FUNCTION__, mId);
return INVALID_OPERATION;
}
if (mRecordingStreamId == NO_STREAM) {
*needsUpdate = true;
return OK;
}
sp<CameraDeviceBase> device = mDevice.promote();
if (device == 0) {
ALOGE("%s: Camera %d: Device does not exist", __FUNCTION__, mId);
return INVALID_OPERATION;
}
uint32_t currentWidth, currentHeight, currentFormat;
android_dataspace currentDataSpace;
res = device->getStreamInfo(mRecordingStreamId,
¤tWidth, ¤tHeight, ¤tFormat, ¤tDataSpace);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying recording output stream info: "
"%s (%d)", __FUNCTION__, mId,
strerror(-res), res);
return res;
}
if (mRecordingConsumer == 0 ||
currentWidth != (uint32_t)params.videoWidth ||
currentHeight != (uint32_t)params.videoHeight ||
currentFormat != (uint32_t)mRecordingFormat ||
currentDataSpace != mRecordingDataSpace) {
*needsUpdate = true;
}
*needsUpdate = false;
return res;
}
| 8,454 |
73,392 | 0 | MagickExport char *GetNextImageProfile(const Image *image)
{
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->profiles == (SplayTreeInfo *) NULL)
return((char *) NULL);
return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->profiles));
}
| 8,455 |
37,307 | 0 | static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
{
if (func == 1 && nested)
entry->ecx |= bit(X86_FEATURE_VMX);
}
| 8,456 |
38,639 | 0 | release_thread(struct task_struct *t)
{
}
| 8,457 |
23,597 | 0 | static int multipath_message(struct dm_target *ti, unsigned argc, char **argv)
{
int r = -EINVAL;
struct dm_dev *dev;
struct multipath *m = (struct multipath *) ti->private;
action_fn action;
mutex_lock(&m->work_mutex);
if (dm_suspended(ti)) {
r = -EBUSY;
goto out;
}
if (argc == 1) {
if (!strcasecmp(argv[0], "queue_if_no_path")) {
r = queue_if_no_path(m, 1, 0);
goto out;
} else if (!strcasecmp(argv[0], "fail_if_no_path")) {
r = queue_if_no_path(m, 0, 0);
goto out;
}
}
if (argc != 2) {
DMWARN("Unrecognised multipath message received.");
goto out;
}
if (!strcasecmp(argv[0], "disable_group")) {
r = bypass_pg_num(m, argv[1], 1);
goto out;
} else if (!strcasecmp(argv[0], "enable_group")) {
r = bypass_pg_num(m, argv[1], 0);
goto out;
} else if (!strcasecmp(argv[0], "switch_group")) {
r = switch_pg_num(m, argv[1]);
goto out;
} else if (!strcasecmp(argv[0], "reinstate_path"))
action = reinstate_path;
else if (!strcasecmp(argv[0], "fail_path"))
action = fail_path;
else {
DMWARN("Unrecognised multipath message received.");
goto out;
}
r = dm_get_device(ti, argv[1], dm_table_get_mode(ti->table), &dev);
if (r) {
DMWARN("message: error getting device %s",
argv[1]);
goto out;
}
r = action_dev(m, dev, action);
dm_put_device(ti, dev);
out:
mutex_unlock(&m->work_mutex);
return r;
}
| 8,458 |
70,981 | 0 | void Type_Curve_Free(struct _cms_typehandler_struct* self, void* Ptr)
{
cmsToneCurve* gamma = (cmsToneCurve*) Ptr;
cmsFreeToneCurve(gamma);
return;
cmsUNUSED_PARAMETER(self);
}
| 8,459 |
68,561 | 0 | gst_asf_demux_mark_discont (GstASFDemux * demux)
{
guint n;
GST_DEBUG_OBJECT (demux, "Mark stream discont");
for (n = 0; n < demux->num_streams; n++)
demux->stream[n].discont = TRUE;
}
| 8,460 |
90,507 | 0 | static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask,
unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
struct mem_size_stats *mss = walk->private;
struct vm_area_struct *vma = walk->vma;
struct page *page = NULL;
if (pte_present(*pte)) {
page = vm_normal_page(vma, addr, *pte);
} else if (is_swap_pte(*pte)) {
swp_entry_t swpent = pte_to_swp_entry(*pte);
if (is_migration_entry(swpent))
page = migration_entry_to_page(swpent);
else if (is_device_private_entry(swpent))
page = device_private_entry_to_page(swpent);
}
if (page) {
int mapcount = page_mapcount(page);
if (mapcount >= 2)
mss->shared_hugetlb += huge_page_size(hstate_vma(vma));
else
mss->private_hugetlb += huge_page_size(hstate_vma(vma));
}
return 0;
}
| 8,461 |
127,546 | 0 | BackingStoreEvents(Display* d, Picture pic, Pixmap pix,
const base::Closure& c)
: display(d),
picture(pic),
pixmap(pix),
closure(c) {
}
| 8,462 |
53,063 | 0 | void bpf_prog_put(struct bpf_prog *prog)
{
if (atomic_dec_and_test(&prog->aux->refcnt))
__prog_put_common(&prog->aux->rcu);
}
| 8,463 |
25,595 | 0 | static int fld0(struct sh_fpu_soft_struct *fregs, int n)
{
FRn = 0;
return 0;
}
| 8,464 |
39,593 | 0 | static void aio_nr_sub(unsigned nr)
{
spin_lock(&aio_nr_lock);
if (WARN_ON(aio_nr - nr > aio_nr))
aio_nr = 0;
else
aio_nr -= nr;
spin_unlock(&aio_nr_lock);
}
| 8,465 |
149,464 | 0 | void ContentSecurityPolicy::reportInvalidDirectiveValueCharacter(
const String& directiveName,
const String& value) {
String message = "The value for Content Security Policy directive '" +
directiveName + "' contains an invalid character: '" +
value +
"'. Non-whitespace characters outside ASCII 0x21-0x7E must "
"be percent-encoded, as described in RFC 3986, section 2.1: "
"http://tools.ietf.org/html/rfc3986#section-2.1.";
logToConsole(message);
}
| 8,466 |
33,624 | 0 | crypto_cert_iteration_next(krb5_context context,
pkinit_cert_iter_handle ih,
pkinit_cert_handle *ch_ret)
{
struct _pkinit_cert_iter_data *id = (struct _pkinit_cert_iter_data *)ih;
struct _pkinit_cert_data *cd;
pkinit_identity_crypto_context id_cryptoctx;
if (id == NULL || id->magic != ITER_MAGIC)
return EINVAL;
if (ch_ret == NULL)
return EINVAL;
id_cryptoctx = id->idctx;
if (id_cryptoctx == NULL)
return EINVAL;
if (id_cryptoctx->creds[id->index] == NULL)
return PKINIT_ITER_NO_MORE;
cd = calloc(1, sizeof(*cd));
if (cd == NULL)
return ENOMEM;
cd->magic = CERT_MAGIC;
cd->plgctx = id->plgctx;
cd->reqctx = id->reqctx;
cd->idctx = id->idctx;
cd->index = id->index;
cd->cred = id_cryptoctx->creds[id->index++];
*ch_ret = (pkinit_cert_handle)cd;
return 0;
}
| 8,467 |
85,861 | 0 | static int clone_bio(struct dm_target_io *tio, struct bio *bio,
sector_t sector, unsigned len)
{
struct bio *clone = &tio->clone;
__bio_clone_fast(clone, bio);
if (unlikely(bio_integrity(bio) != NULL)) {
int r;
if (unlikely(!dm_target_has_integrity(tio->ti->type) &&
!dm_target_passes_integrity(tio->ti->type))) {
DMWARN("%s: the target %s doesn't support integrity data.",
dm_device_name(tio->io->md),
tio->ti->type->name);
return -EIO;
}
r = bio_integrity_clone(clone, bio, GFP_NOIO);
if (r < 0)
return r;
}
if (bio_op(bio) != REQ_OP_ZONE_REPORT)
bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
clone->bi_iter.bi_size = to_bytes(len);
if (unlikely(bio_integrity(bio) != NULL))
bio_integrity_trim(clone);
return 0;
}
| 8,468 |
142,671 | 0 | SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url)
{
if (!shouldTreatURLAsSrcdocDocument(url))
return SubstituteData();
String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr);
ASSERT(!srcdoc.isNull());
CString encodedSrcdoc = srcdoc.utf8();
return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcdoc.length()), "text/html", "UTF-8", KURL());
}
| 8,469 |
120,591 | 0 | bool Element::rareDataChildrenAffectedByDirectAdjacentRules() const
{
ASSERT(hasRareData());
return elementRareData()->childrenAffectedByDirectAdjacentRules();
}
| 8,470 |
73,001 | 0 | static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)
{
jpc_siz_t *siz = &ms->parms.siz;
int compno;
int tileno;
jpc_dec_tile_t *tile;
jpc_dec_tcomp_t *tcomp;
int htileno;
int vtileno;
jpc_dec_cmpt_t *cmpt;
size_t size;
dec->xstart = siz->xoff;
dec->ystart = siz->yoff;
dec->xend = siz->width;
dec->yend = siz->height;
dec->tilewidth = siz->tilewidth;
dec->tileheight = siz->tileheight;
dec->tilexoff = siz->tilexoff;
dec->tileyoff = siz->tileyoff;
dec->numcomps = siz->numcomps;
if (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {
return -1;
}
if (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {
return -1;
}
for (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,
++cmpt) {
cmpt->prec = siz->comps[compno].prec;
cmpt->sgnd = siz->comps[compno].sgnd;
cmpt->hstep = siz->comps[compno].hsamp;
cmpt->vstep = siz->comps[compno].vsamp;
cmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -
JPC_CEILDIV(dec->xstart, cmpt->hstep);
cmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -
JPC_CEILDIV(dec->ystart, cmpt->vstep);
cmpt->hsubstep = 0;
cmpt->vsubstep = 0;
}
dec->image = 0;
dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);
dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);
if (!jas_safe_size_mul(dec->numhtiles, dec->numvtiles, &size)) {
return -1;
}
dec->numtiles = size;
JAS_DBGLOG(10, ("numtiles = %d; numhtiles = %d; numvtiles = %d;\n",
dec->numtiles, dec->numhtiles, dec->numvtiles));
if (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {
return -1;
}
for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,
++tile) {
htileno = tileno % dec->numhtiles;
vtileno = tileno / dec->numhtiles;
tile->realmode = 0;
tile->state = JPC_TILE_INIT;
tile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,
dec->xstart);
tile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,
dec->ystart);
tile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *
dec->tilewidth, dec->xend);
tile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *
dec->tileheight, dec->yend);
tile->numparts = 0;
tile->partno = 0;
tile->pkthdrstream = 0;
tile->pkthdrstreampos = 0;
tile->pptstab = 0;
tile->cp = 0;
tile->pi = 0;
if (!(tile->tcomps = jas_alloc2(dec->numcomps,
sizeof(jpc_dec_tcomp_t)))) {
return -1;
}
for (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;
compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {
tcomp->rlvls = 0;
tcomp->numrlvls = 0;
tcomp->data = 0;
tcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);
tcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);
tcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);
tcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);
tcomp->tsfb = 0;
}
}
dec->pkthdrstreams = 0;
/* We should expect to encounter other main header marker segments
or an SOT marker segment next. */
dec->state = JPC_MH;
return 0;
}
| 8,471 |
176,233 | 0 | static Handle<FixedArray> CreateListFromArrayImpl(Isolate* isolate,
Handle<JSArray> array) {
UNREACHABLE();
return Handle<FixedArray>();
}
| 8,472 |
100,635 | 0 | bool CSSStyleSheet::parseString(const String &string, bool strict)
{
setStrictParsing(strict);
CSSParser p(strict);
p.parseSheet(this, string);
return true;
}
| 8,473 |
41,156 | 0 | static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
/* Check #1 */
if (tp->rcv_ssthresh < tp->window_clamp &&
(int)tp->rcv_ssthresh < tcp_space(sk) &&
!tcp_memory_pressure) {
int incr;
/* Check #2. Increase window, if skb with such overhead
* will fit to rcvbuf in future.
*/
if (tcp_win_from_space(skb->truesize) <= skb->len)
incr = 2 * tp->advmss;
else
incr = __tcp_grow_window(sk, skb);
if (incr) {
tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr,
tp->window_clamp);
inet_csk(sk)->icsk_ack.quick |= 1;
}
}
}
| 8,474 |
182,586 | 1 | void f2fs_wait_discard_bios(struct f2fs_sb_info *sbi)
{
__issue_discard_cmd(sbi, false);
__drop_discard_cmd(sbi);
__wait_discard_cmd(sbi, false);
}
| 8,475 |
32,756 | 0 | static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct tg3 *tp = netdev_priv(dev);
u32 speed = ethtool_cmd_speed(cmd);
if (tg3_flag(tp, USE_PHYLIB)) {
struct phy_device *phydev;
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
return phy_ethtool_sset(phydev, cmd);
}
if (cmd->autoneg != AUTONEG_ENABLE &&
cmd->autoneg != AUTONEG_DISABLE)
return -EINVAL;
if (cmd->autoneg == AUTONEG_DISABLE &&
cmd->duplex != DUPLEX_FULL &&
cmd->duplex != DUPLEX_HALF)
return -EINVAL;
if (cmd->autoneg == AUTONEG_ENABLE) {
u32 mask = ADVERTISED_Autoneg |
ADVERTISED_Pause |
ADVERTISED_Asym_Pause;
if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY))
mask |= ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full;
if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
mask |= ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full |
ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full |
ADVERTISED_TP;
else
mask |= ADVERTISED_FIBRE;
if (cmd->advertising & ~mask)
return -EINVAL;
mask &= (ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full |
ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full |
ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full);
cmd->advertising &= mask;
} else {
if (tp->phy_flags & TG3_PHYFLG_ANY_SERDES) {
if (speed != SPEED_1000)
return -EINVAL;
if (cmd->duplex != DUPLEX_FULL)
return -EINVAL;
} else {
if (speed != SPEED_100 &&
speed != SPEED_10)
return -EINVAL;
}
}
tg3_full_lock(tp, 0);
tp->link_config.autoneg = cmd->autoneg;
if (cmd->autoneg == AUTONEG_ENABLE) {
tp->link_config.advertising = (cmd->advertising |
ADVERTISED_Autoneg);
tp->link_config.speed = SPEED_UNKNOWN;
tp->link_config.duplex = DUPLEX_UNKNOWN;
} else {
tp->link_config.advertising = 0;
tp->link_config.speed = speed;
tp->link_config.duplex = cmd->duplex;
}
if (netif_running(dev))
tg3_setup_phy(tp, 1);
tg3_full_unlock(tp);
return 0;
}
| 8,476 |
68,875 | 0 | static int enable_cpucache(struct kmem_cache *cachep, gfp_t gfp)
{
int err;
int limit = 0;
int shared = 0;
int batchcount = 0;
err = cache_random_seq_create(cachep, cachep->num, gfp);
if (err)
goto end;
if (!is_root_cache(cachep)) {
struct kmem_cache *root = memcg_root_cache(cachep);
limit = root->limit;
shared = root->shared;
batchcount = root->batchcount;
}
if (limit && shared && batchcount)
goto skip_setup;
/*
* The head array serves three purposes:
* - create a LIFO ordering, i.e. return objects that are cache-warm
* - reduce the number of spinlock operations.
* - reduce the number of linked list operations on the slab and
* bufctl chains: array operations are cheaper.
* The numbers are guessed, we should auto-tune as described by
* Bonwick.
*/
if (cachep->size > 131072)
limit = 1;
else if (cachep->size > PAGE_SIZE)
limit = 8;
else if (cachep->size > 1024)
limit = 24;
else if (cachep->size > 256)
limit = 54;
else
limit = 120;
/*
* CPU bound tasks (e.g. network routing) can exhibit cpu bound
* allocation behaviour: Most allocs on one cpu, most free operations
* on another cpu. For these cases, an efficient object passing between
* cpus is necessary. This is provided by a shared array. The array
* replaces Bonwick's magazine layer.
* On uniprocessor, it's functionally equivalent (but less efficient)
* to a larger limit. Thus disabled by default.
*/
shared = 0;
if (cachep->size <= PAGE_SIZE && num_possible_cpus() > 1)
shared = 8;
#if DEBUG
/*
* With debugging enabled, large batchcount lead to excessively long
* periods with disabled local interrupts. Limit the batchcount
*/
if (limit > 32)
limit = 32;
#endif
batchcount = (limit + 1) / 2;
skip_setup:
err = do_tune_cpucache(cachep, limit, batchcount, shared, gfp);
end:
if (err)
pr_err("enable_cpucache failed for %s, error %d\n",
cachep->name, -err);
return err;
}
| 8,477 |
128,547 | 0 | void Instance::DidChangeView(const pp::View& view) {
pp::Rect view_rect(view.GetRect());
float device_scale = 1.0f;
float old_device_scale = device_scale_;
if (hidpi_enabled_)
device_scale = view.GetDeviceScale();
pp::Size view_device_size(view_rect.width() * device_scale,
view_rect.height() * device_scale);
if (view_device_size == plugin_size_ && device_scale == device_scale_)
return; // We don't care about the position, only the size.
image_data_ = pp::ImageData();
device_scale_ = device_scale;
plugin_dip_size_ = view_rect.size();
plugin_size_ = view_device_size;
paint_manager_.SetSize(view_device_size, device_scale_);
image_data_ = pp::ImageData(this,
PP_IMAGEDATAFORMAT_BGRA_PREMUL,
plugin_size_,
false);
if (image_data_.is_null()) {
DCHECK(plugin_size_.IsEmpty());
return;
}
DisableAutoscroll();
OnGeometryChanged(zoom_, old_device_scale);
}
| 8,478 |
30,839 | 0 | static void hash_release(void *private)
{
crypto_free_ahash(private);
}
| 8,479 |
93,981 | 0 | PHP_METHOD(HttpParams, offsetExists)
{
char *name_str;
int name_len;
zval **zparam, *zparams;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len)) {
return;
}
zparams = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0 TSRMLS_CC));
if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(zparams), name_str, name_len + 1, (void *) &zparam)) {
RETVAL_BOOL(Z_TYPE_PP(zparam) != IS_NULL);
} else {
RETVAL_FALSE;
}
zval_ptr_dtor(&zparams);
}
| 8,480 |
9,214 | 0 | hwaddr virtio_queue_get_avail_size(VirtIODevice *vdev, int n)
{
return offsetof(VRingAvail, ring) +
sizeof(uint16_t) * vdev->vq[n].vring.num;
}
| 8,481 |
113,585 | 0 | bool AccessibilityUIElement::isChecked() const
{
return checkElementState(m_element, ATK_STATE_CHECKED);
}
| 8,482 |
158,118 | 0 | void LocalFrameClientImpl::ScrollRectToVisibleInParentFrame(
const WebRect& rect_to_scroll,
const WebScrollIntoViewParams& params) {
web_frame_->Client()->ScrollRectToVisibleInParentFrame(rect_to_scroll,
params);
}
| 8,483 |
10,152 | 0 | Ins_ROLL( INS_ARG )
{
FT_Long A, B, C;
FT_UNUSED_EXEC;
A = args[2];
B = args[1];
C = args[0];
args[2] = C;
args[1] = A;
args[0] = B;
}
| 8,484 |
56,754 | 0 | static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
u16 portchange)
{
int status, i;
unsigned unit_load;
struct usb_device *hdev = hub->hdev;
struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
struct usb_port *port_dev = hub->ports[port1 - 1];
struct usb_device *udev = port_dev->child;
static int unreliable_port = -1;
/* Disconnect any existing devices under this port */
if (udev) {
if (hcd->usb_phy && !hdev->parent)
usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
usb_disconnect(&port_dev->child);
}
/* We can forget about a "removed" device when there's a physical
* disconnect or the connect status changes.
*/
if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
(portchange & USB_PORT_STAT_C_CONNECTION))
clear_bit(port1, hub->removed_bits);
if (portchange & (USB_PORT_STAT_C_CONNECTION |
USB_PORT_STAT_C_ENABLE)) {
status = hub_port_debounce_be_stable(hub, port1);
if (status < 0) {
if (status != -ENODEV &&
port1 != unreliable_port &&
printk_ratelimit())
dev_err(&port_dev->dev, "connect-debounce failed\n");
portstatus &= ~USB_PORT_STAT_CONNECTION;
unreliable_port = port1;
} else {
portstatus = status;
}
}
/* Return now if debouncing failed or nothing is connected or
* the device was "removed".
*/
if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
test_bit(port1, hub->removed_bits)) {
/*
* maybe switch power back on (e.g. root hub was reset)
* but only if the port isn't owned by someone else.
*/
if (hub_is_port_power_switchable(hub)
&& !port_is_power_on(hub, portstatus)
&& !port_dev->port_owner)
set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
if (portstatus & USB_PORT_STAT_ENABLE)
goto done;
return;
}
if (hub_is_superspeed(hub->hdev))
unit_load = 150;
else
unit_load = 100;
status = 0;
for (i = 0; i < SET_CONFIG_TRIES; i++) {
/* reallocate for each attempt, since references
* to the previous one can escape in various ways
*/
udev = usb_alloc_dev(hdev, hdev->bus, port1);
if (!udev) {
dev_err(&port_dev->dev,
"couldn't allocate usb_device\n");
goto done;
}
usb_set_device_state(udev, USB_STATE_POWERED);
udev->bus_mA = hub->mA_per_port;
udev->level = hdev->level + 1;
udev->wusb = hub_is_wusb(hub);
/* Only USB 3.0 devices are connected to SuperSpeed hubs. */
if (hub_is_superspeed(hub->hdev))
udev->speed = USB_SPEED_SUPER;
else
udev->speed = USB_SPEED_UNKNOWN;
choose_devnum(udev);
if (udev->devnum <= 0) {
status = -ENOTCONN; /* Don't retry */
goto loop;
}
/* reset (non-USB 3.0 devices) and get descriptor */
usb_lock_port(port_dev);
status = hub_port_init(hub, udev, port1, i);
usb_unlock_port(port_dev);
if (status < 0)
goto loop;
if (udev->quirks & USB_QUIRK_DELAY_INIT)
msleep(1000);
/* consecutive bus-powered hubs aren't reliable; they can
* violate the voltage drop budget. if the new child has
* a "powered" LED, users should notice we didn't enable it
* (without reading syslog), even without per-port LEDs
* on the parent.
*/
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB
&& udev->bus_mA <= unit_load) {
u16 devstat;
status = usb_get_status(udev, USB_RECIP_DEVICE, 0,
&devstat);
if (status) {
dev_dbg(&udev->dev, "get status %d ?\n", status);
goto loop_disable;
}
if ((devstat & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
dev_err(&udev->dev,
"can't connect bus-powered hub "
"to this port\n");
if (hub->has_indicators) {
hub->indicator[port1-1] =
INDICATOR_AMBER_BLINK;
queue_delayed_work(
system_power_efficient_wq,
&hub->leds, 0);
}
status = -ENOTCONN; /* Don't retry */
goto loop_disable;
}
}
/* check for devices running slower than they could */
if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0200
&& udev->speed == USB_SPEED_FULL
&& highspeed_hubs != 0)
check_highspeed(hub, udev, port1);
/* Store the parent's children[] pointer. At this point
* udev becomes globally accessible, although presumably
* no one will look at it until hdev is unlocked.
*/
status = 0;
mutex_lock(&usb_port_peer_mutex);
/* We mustn't add new devices if the parent hub has
* been disconnected; we would race with the
* recursively_mark_NOTATTACHED() routine.
*/
spin_lock_irq(&device_state_lock);
if (hdev->state == USB_STATE_NOTATTACHED)
status = -ENOTCONN;
else
port_dev->child = udev;
spin_unlock_irq(&device_state_lock);
mutex_unlock(&usb_port_peer_mutex);
/* Run it through the hoops (find a driver, etc) */
if (!status) {
status = usb_new_device(udev);
if (status) {
mutex_lock(&usb_port_peer_mutex);
spin_lock_irq(&device_state_lock);
port_dev->child = NULL;
spin_unlock_irq(&device_state_lock);
mutex_unlock(&usb_port_peer_mutex);
} else {
if (hcd->usb_phy && !hdev->parent)
usb_phy_notify_connect(hcd->usb_phy,
udev->speed);
}
}
if (status)
goto loop_disable;
status = hub_power_remaining(hub);
if (status)
dev_dbg(hub->intfdev, "%dmA power budget left\n", status);
return;
loop_disable:
hub_port_disable(hub, port1, 1);
loop:
usb_ep0_reinit(udev);
release_devnum(udev);
hub_free_dev(udev);
usb_put_dev(udev);
if ((status == -ENOTCONN) || (status == -ENOTSUPP))
break;
}
if (hub->hdev->parent ||
!hcd->driver->port_handed_over ||
!(hcd->driver->port_handed_over)(hcd, port1)) {
if (status != -ENOTCONN && status != -ENODEV)
dev_err(&port_dev->dev,
"unable to enumerate USB device\n");
}
done:
hub_port_disable(hub, port1, 1);
if (hcd->driver->relinquish_port && !hub->hdev->parent)
hcd->driver->relinquish_port(hcd, port1);
}
| 8,485 |
134,122 | 0 | void InputMethodIBus::UpdateContextFocusState() {
const bool old_context_focused = context_focused_;
switch (GetTextInputType()) {
case TEXT_INPUT_TYPE_NONE:
case TEXT_INPUT_TYPE_PASSWORD:
context_focused_ = false;
break;
default:
context_focused_ = true;
break;
}
if (!GetEngine())
return;
if (old_context_focused && !context_focused_) {
GetEngine()->FocusOut();
} else if (!old_context_focused && context_focused_) {
GetEngine()->FocusIn();
OnCaretBoundsChanged(GetTextInputClient());
}
}
| 8,486 |
14,672 | 0 | int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC) /* {{{ */
{
const char *pos, *slash;
*ext_str = NULL;
*ext_len = 0;
if (!filename_len || filename_len == 1) {
return FAILURE;
}
phar_request_initialize(TSRMLS_C);
/* first check for alias in first segment */
pos = memchr(filename, '/', filename_len);
if (pos && pos != filename) {
/* check for url like http:// or phar:// */
if (*(pos - 1) == ':' && (pos - filename) < filename_len - 1 && *(pos + 1) == '/') {
*ext_len = -2;
*ext_str = NULL;
return FAILURE;
}
if (zend_hash_exists(&(PHAR_GLOBALS->phar_alias_map), (char *) filename, pos - filename)) {
*ext_str = pos;
*ext_len = -1;
return FAILURE;
}
if (PHAR_G(manifest_cached) && zend_hash_exists(&cached_alias, (char *) filename, pos - filename)) {
*ext_str = pos;
*ext_len = -1;
return FAILURE;
}
}
if (zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)) || PHAR_G(manifest_cached)) {
phar_archive_data **pphar;
if (is_complete) {
if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), (char *) filename, filename_len, (void **)&pphar)) {
*ext_str = filename + (filename_len - (*pphar)->ext_len);
woohoo:
*ext_len = (*pphar)->ext_len;
if (executable == 2) {
return SUCCESS;
}
if (executable == 1 && !(*pphar)->is_data) {
return SUCCESS;
}
if (!executable && (*pphar)->is_data) {
return SUCCESS;
}
return FAILURE;
}
if (PHAR_G(manifest_cached) && SUCCESS == zend_hash_find(&cached_phars, (char *) filename, filename_len, (void **)&pphar)) {
*ext_str = filename + (filename_len - (*pphar)->ext_len);
goto woohoo;
}
} else {
phar_zstr key;
char *str_key;
uint keylen;
ulong unused;
zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map));
while (FAILURE != zend_hash_has_more_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &key, &keylen, &unused, 0, NULL)) {
break;
}
PHAR_STR(key, str_key);
if (keylen > (uint) filename_len) {
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
PHAR_STR_FREE(str_key);
continue;
}
if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
PHAR_STR_FREE(str_key);
if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
break;
}
*ext_str = filename + (keylen - (*pphar)->ext_len);
goto woohoo;
}
PHAR_STR_FREE(str_key);
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
}
if (PHAR_G(manifest_cached)) {
zend_hash_internal_pointer_reset(&cached_phars);
while (FAILURE != zend_hash_has_more_elements(&cached_phars)) {
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&cached_phars, &key, &keylen, &unused, 0, NULL)) {
break;
}
PHAR_STR(key, str_key);
if (keylen > (uint) filename_len) {
zend_hash_move_forward(&cached_phars);
PHAR_STR_FREE(str_key);
continue;
}
if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
PHAR_STR_FREE(str_key);
if (FAILURE == zend_hash_get_current_data(&cached_phars, (void **) &pphar)) {
break;
}
*ext_str = filename + (keylen - (*pphar)->ext_len);
goto woohoo;
}
PHAR_STR_FREE(str_key);
zend_hash_move_forward(&cached_phars);
}
}
}
}
pos = memchr(filename + 1, '.', filename_len);
next_extension:
if (!pos) {
return FAILURE;
}
while (pos != filename && (*(pos - 1) == '/' || *(pos - 1) == '\0')) {
pos = memchr(pos + 1, '.', filename_len - (pos - filename) + 1);
if (!pos) {
return FAILURE;
}
}
slash = memchr(pos, '/', filename_len - (pos - filename));
if (!slash) {
/* this is a url like "phar://blah.phar" with no directory */
*ext_str = pos;
*ext_len = strlen(pos);
/* file extension must contain "phar" */
switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
/* we are at the end of the string, so we fail */
return FAILURE;
}
}
/* we've found an extension that ends at a directory separator */
*ext_str = pos;
*ext_len = slash - pos;
switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
/* look for more extensions */
pos = strchr(pos + 1, '.');
if (pos) {
*ext_str = NULL;
*ext_len = 0;
}
goto next_extension;
}
return FAILURE;
}
/* }}} */
| 8,487 |
48,067 | 0 | static bool nested_cr4_valid(struct kvm_vcpu *vcpu, unsigned long val)
{
u64 fixed0 = to_vmx(vcpu)->nested.nested_vmx_cr4_fixed0;
u64 fixed1 = to_vmx(vcpu)->nested.nested_vmx_cr4_fixed1;
return fixed_bits_valid(val, fixed0, fixed1);
}
| 8,488 |
22,945 | 0 | nfs4_insert_state_owner(struct nfs_client *clp, struct nfs4_state_owner *new)
{
struct rb_node **p = &clp->cl_state_owners.rb_node,
*parent = NULL;
struct nfs4_state_owner *sp;
while (*p != NULL) {
parent = *p;
sp = rb_entry(parent, struct nfs4_state_owner, so_client_node);
if (new->so_server < sp->so_server) {
p = &parent->rb_left;
continue;
}
if (new->so_server > sp->so_server) {
p = &parent->rb_right;
continue;
}
if (new->so_cred < sp->so_cred)
p = &parent->rb_left;
else if (new->so_cred > sp->so_cred)
p = &parent->rb_right;
else {
atomic_inc(&sp->so_count);
return sp;
}
}
nfs_alloc_unique_id(&clp->cl_openowner_id, &new->so_owner_id, 1, 64);
rb_link_node(&new->so_client_node, parent, p);
rb_insert_color(&new->so_client_node, &clp->cl_state_owners);
return new;
}
| 8,489 |
85,289 | 0 | int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
{
struct f2fs_inode *src, *dst;
nid_t ino = ino_of_node(page);
struct node_info old_ni, new_ni;
struct page *ipage;
get_node_info(sbi, ino, &old_ni);
if (unlikely(old_ni.blk_addr != NULL_ADDR))
return -EINVAL;
retry:
ipage = f2fs_grab_cache_page(NODE_MAPPING(sbi), ino, false);
if (!ipage) {
congestion_wait(BLK_RW_ASYNC, HZ/50);
goto retry;
}
/* Should not use this inode from free nid list */
remove_free_nid(sbi, ino);
if (!PageUptodate(ipage))
SetPageUptodate(ipage);
fill_node_footer(ipage, ino, ino, 0, true);
src = F2FS_INODE(page);
dst = F2FS_INODE(ipage);
memcpy(dst, src, (unsigned long)&src->i_ext - (unsigned long)src);
dst->i_size = 0;
dst->i_blocks = cpu_to_le64(1);
dst->i_links = cpu_to_le32(1);
dst->i_xattr_nid = 0;
dst->i_inline = src->i_inline & F2FS_INLINE_XATTR;
new_ni = old_ni;
new_ni.ino = ino;
if (unlikely(!inc_valid_node_count(sbi, NULL)))
WARN_ON(1);
set_node_addr(sbi, &new_ni, NEW_ADDR, false);
inc_valid_inode_count(sbi);
set_page_dirty(ipage);
f2fs_put_page(ipage, 1);
return 0;
}
| 8,490 |
51,467 | 0 | static gdImagePtr _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** cidx)
{
gdImagePtr im;
if (_gd2GetHeader (in, sx, sy, cs, vers, fmt, ncx, ncy, cidx) != 1) {
GD2_DBG(php_gd_error("Bad GD2 header"));
goto fail1;
}
if (gd2_truecolor(*fmt)) {
im = gdImageCreateTrueColor(*sx, *sy);
} else {
im = gdImageCreate(*sx, *sy);
}
if (im == NULL) {
GD2_DBG(php_gd_error("Could not create gdImage"));
goto fail1;
}
if (!_gdGetColors(in, im, (*vers) == 2)) {
GD2_DBG(php_gd_error("Could not read color palette"));
goto fail2;
}
GD2_DBG(php_gd_error("Image palette completed: %d colours", im->colorsTotal));
return im;
fail2:
gdImageDestroy(im);
return 0;
fail1:
return 0;
}
| 8,491 |
117,336 | 0 | xmlXPtrRangeCheckOrder(xmlXPathObjectPtr range) {
int tmp;
xmlNodePtr tmp2;
if (range == NULL)
return;
if (range->type != XPATH_RANGE)
return;
if (range->user2 == NULL)
return;
tmp = xmlXPtrCmpPoints(range->user, range->index,
range->user2, range->index2);
if (tmp == -1) {
tmp2 = range->user;
range->user = range->user2;
range->user2 = tmp2;
tmp = range->index;
range->index = range->index2;
range->index2 = tmp;
}
}
| 8,492 |
51,731 | 0 | proto_register_pktap(void)
{
static hf_register_info hf[] = {
{ &hf_pktap_hdrlen,
{ "Header length", "pktap.hdrlen",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_rectype,
{ "Record type", "pktap.rectype",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_dlt,
{ "DLT", "pktap.dlt",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_ifname, /* fixed length *and* null-terminated */
{ "Interface name", "pktap.ifname",
FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_flags,
{ "Flags", "pktap.flags",
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_pfamily,
{ "Protocol family", "pktap.pfamily",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_llhdrlen,
{ "Link-layer header length", "pktap.llhdrlen",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_lltrlrlen,
{ "Link-layer trailer length", "pktap.lltrlrlen",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_pid,
{ "Process ID", "pktap.pid",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_cmdname, /* fixed length *and* null-terminated */
{ "Command name", "pktap.cmdname",
FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_svc_class,
{ "Service class", "pktap.svc_class",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_iftype,
{ "Interface type", "pktap.iftype",
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_ifunit,
{ "Interface unit", "pktap.ifunit",
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_epid,
{ "Effective process ID", "pktap.epid",
FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_pktap_ecmdname, /* fixed length *and* null-terminated */
{ "Effective command name", "pktap.ecmdname",
FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL } },
};
static gint *ett[] = {
&ett_pktap,
};
static ei_register_info ei[] = {
{ &ei_pktap_hdrlen_too_short,
{ "pktap.hdrlen_too_short", PI_MALFORMED, PI_ERROR,
"Header length is too short", EXPFILL }},
};
expert_module_t* expert_pktap;
proto_pktap = proto_register_protocol("PKTAP packet header", "PKTAP",
"pktap");
proto_register_field_array(proto_pktap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_pktap = expert_register_protocol(proto_pktap);
expert_register_field_array(expert_pktap, ei, array_length(ei));
pktap_handle = register_dissector("pktap", dissect_pktap, proto_pktap);
}
| 8,493 |
15,809 | 0 | int ctdb_tcp_listen(struct ctdb_context *ctdb)
{
struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
struct ctdb_tcp);
ctdb_sock_addr sock;
int sock_size;
int one = 1;
struct tevent_fd *fde;
/* we can either auto-bind to the first available address, or we can
use a specified address */
if (!ctdb->address.address) {
return ctdb_tcp_listen_automatic(ctdb);
}
ZERO_STRUCT(sock);
if (ctdb_tcp_get_address(ctdb, ctdb->address.address,
&sock) != 0) {
goto failed;
}
switch (sock.sa.sa_family) {
case AF_INET:
sock.ip.sin_port = htons(ctdb->address.port);
sock_size = sizeof(sock.ip);
break;
case AF_INET6:
sock.ip6.sin6_port = htons(ctdb->address.port);
sock_size = sizeof(sock.ip6);
break;
default:
DEBUG(DEBUG_ERR, (__location__ " unknown family %u\n",
sock.sa.sa_family));
goto failed;
}
#ifdef HAVE_SOCK_SIN_LEN
sock.ip.sin_len = sock_size;
#endif
ctcp->listen_fd = socket(sock.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
if (ctcp->listen_fd == -1) {
ctdb_set_error(ctdb, "socket failed\n");
return -1;
}
set_close_on_exec(ctcp->listen_fd);
setsockopt(ctcp->listen_fd,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one));
if (bind(ctcp->listen_fd, (struct sockaddr * )&sock, sock_size) != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to bind() to socket. %s(%d)\n", strerror(errno), errno));
goto failed;
}
if (listen(ctcp->listen_fd, 10) == -1) {
goto failed;
}
fde = event_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, EVENT_FD_READ,
ctdb_listen_event, ctdb);
tevent_fd_set_auto_close(fde);
return 0;
failed:
if (ctcp->listen_fd != -1) {
close(ctcp->listen_fd);
}
ctcp->listen_fd = -1;
return -1;
}
| 8,494 |
2,839 | 0 | nm_setting_vpn_foreach_secret (NMSettingVPN *setting,
NMVPNIterFunc func,
gpointer user_data)
{
g_return_if_fail (setting != NULL);
g_return_if_fail (NM_IS_SETTING_VPN (setting));
foreach_item_helper (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, func, user_data);
}
| 8,495 |
103,030 | 0 | virtual int GetDragActions() const { return 0; }
| 8,496 |
160,628 | 0 | void RenderFrameImpl::InitializeUserMediaClient() {
RenderThreadImpl* render_thread = RenderThreadImpl::current();
if (!render_thread) // Will be NULL during unit tests.
return;
#if BUILDFLAG(ENABLE_WEBRTC)
DCHECK(!web_user_media_client_);
web_user_media_client_ = new UserMediaClientImpl(
this, RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(),
std::make_unique<MediaStreamDeviceObserver>(this));
#endif
}
| 8,497 |
142,209 | 0 | bool PrepareTestEntries(Profile* profile) {
if (!CreateRootDirectory(profile))
return false;
CreateEntry(AddEntriesMessage::TestEntryInfo(AddEntriesMessage::FILE,
"text.txt", "hello.txt")
.SetMimeType("text/plain"));
CreateEntry(AddEntriesMessage::TestEntryInfo(AddEntriesMessage::DIRECTORY,
std::string(), "A"));
base::RunLoop().RunUntilIdle();
return true;
}
| 8,498 |
3,959 | 0 | GooString *Stream::getPSFilter(int psLevel, const char *indent) {
return new GooString();
}
| 8,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.