unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
147,370 | 0 | void V8TestObject::DoubleOrNullStringAttributeAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_doubleOrNullStringAttribute_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_object_v8_internal::DoubleOrNullStringAttributeAttributeSetter(v8_value, info);
}
| 1,000 |
130,590 | 0 | static void activityLoggedAttrSetter1AttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "activityLoggedAttrSetter1", "TestObject", info.Holder(), info.GetIsolate());
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState);
imp->setActivityLoggedAttrSetter1(cppValue);
}
| 1,001 |
164,632 | 0 | void IndexedDBDatabase::GetKeyGeneratorCurrentNumber(
IndexedDBTransaction* transaction,
int64_t object_store_id,
scoped_refptr<IndexedDBCallbacks> callbacks) {
DCHECK(transaction);
if (!ValidateObjectStoreId(object_store_id)) {
callbacks->OnError(CreateError(blink::kWebIDBDatabaseExceptionDataError,
"Object store id not valid.", transaction));
return;
}
transaction->ScheduleTask(
base::BindOnce(&IndexedDBDatabase::GetKeyGeneratorCurrentNumberOperation,
this, object_store_id, callbacks));
}
| 1,002 |
57,444 | 0 | ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
ext4_lblk_t block)
{
int depth = ext_depth(inode);
unsigned long len;
ext4_lblk_t lblock;
struct ext4_extent *ex;
ex = path[depth].p_ext;
if (ex == NULL) {
/* there is no extent yet, so gap is [0;-] */
lblock = 0;
len = EXT_MAX_BLOCK;
ext_debug("cache gap(whole file):");
} else if (block < le32_to_cpu(ex->ee_block)) {
lblock = block;
len = le32_to_cpu(ex->ee_block) - block;
ext_debug("cache gap(before): %u [%u:%u]",
block,
le32_to_cpu(ex->ee_block),
ext4_ext_get_actual_len(ex));
} else if (block >= le32_to_cpu(ex->ee_block)
+ ext4_ext_get_actual_len(ex)) {
ext4_lblk_t next;
lblock = le32_to_cpu(ex->ee_block)
+ ext4_ext_get_actual_len(ex);
next = ext4_ext_next_allocated_block(path);
ext_debug("cache gap(after): [%u:%u] %u",
le32_to_cpu(ex->ee_block),
ext4_ext_get_actual_len(ex),
block);
BUG_ON(next == lblock);
len = next - lblock;
} else {
lblock = len = 0;
BUG();
}
ext_debug(" -> %u:%lu\n", lblock, len);
ext4_ext_put_in_cache(inode, lblock, len, 0, EXT4_EXT_CACHE_GAP);
}
| 1,003 |
148,589 | 0 | void WebContentsImpl::UpdateWebContentsVisibility(bool visible) {
if (!did_first_set_visible_) {
if (visible) {
did_first_set_visible_ = true;
WasShown();
}
return;
}
if (visible == should_normally_be_visible_)
return;
if (visible)
WasShown();
else
WasHidden();
}
| 1,004 |
74,422 | 0 | static __inline USHORT CalculateIpPseudoHeaderChecksum(IPHeader *pIpHeader,
tTcpIpPacketParsingResult res,
USHORT headerAndPayloadLen)
{
if (res.ipStatus == ppresIPV4)
return CalculateIpv4PseudoHeaderChecksum(&pIpHeader->v4, headerAndPayloadLen);
if (res.ipStatus == ppresIPV6)
return CalculateIpv6PseudoHeaderChecksum(&pIpHeader->v6, headerAndPayloadLen);
return 0;
}
| 1,005 |
174,957 | 0 | status_t CameraClient::initialize(camera_module_t *module) {
int callingPid = getCallingPid();
status_t res;
LOG1("CameraClient::initialize E (pid %d, id %d)", callingPid, mCameraId);
res = startCameraOps();
if (res != OK) {
return res;
}
char camera_device_name[10];
snprintf(camera_device_name, sizeof(camera_device_name), "%d", mCameraId);
mHardware = new CameraHardwareInterface(camera_device_name);
res = mHardware->initialize(&module->common);
if (res != OK) {
ALOGE("%s: Camera %d: unable to initialize device: %s (%d)",
__FUNCTION__, mCameraId, strerror(-res), res);
mHardware.clear();
return NO_INIT;
}
mHardware->setCallbacks(notifyCallback,
dataCallback,
dataCallbackTimestamp,
(void *)mCameraId);
enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS |
CAMERA_MSG_PREVIEW_METADATA | CAMERA_MSG_FOCUS_MOVE);
LOG1("CameraClient::initialize X (pid %d, id %d)", callingPid, mCameraId);
return OK;
}
| 1,006 |
132,676 | 0 | void BlinkTestRunner::SetEditCommand(const std::string& name,
const std::string& value) {
render_view()->SetEditCommandForNextKeyEvent(name, value);
}
| 1,007 |
15,273 | 0 | PHP_FUNCTION(stream_get_line)
{
char *str = NULL;
int str_len = 0;
long max_length;
zval *zstream;
char *buf;
size_t buf_size;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) {
RETURN_FALSE;
}
if (max_length < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
RETURN_FALSE;
}
if (!max_length) {
max_length = PHP_SOCK_CHUNK_SIZE;
}
php_stream_from_zval(stream, &zstream);
if ((buf = php_stream_get_record(stream, max_length, &buf_size, str, str_len TSRMLS_CC))) {
RETURN_STRINGL(buf, buf_size, 0);
} else {
RETURN_FALSE;
}
}
| 1,008 |
149,792 | 0 | static int GetLayersUpdateTimeHistogramBucket(size_t numLayers) {
if (numLayers < 10)
return 0;
if (numLayers < 30)
return 1;
if (numLayers < 70)
return 2;
if (numLayers < 150)
return 3;
return 4;
}
| 1,009 |
172,883 | 0 | void bdt_dut_mode_configure(char *p)
{
int32_t mode = -1;
bdt_log("BT DUT MODE CONFIGURE");
if (!bt_enabled) {
bdt_log("Bluetooth must be enabled for test_mode to work.");
return;
}
mode = get_signed_int(&p, mode);
if ((mode != 0) && (mode != 1)) {
bdt_log("Please specify mode: 1 to enter, 0 to exit");
return;
}
status = sBtInterface->dut_mode_configure(mode);
check_return_status(status);
}
| 1,010 |
69,967 | 0 | unsigned long getClientOutputBufferMemoryUsage(client *c) {
unsigned long list_item_size = sizeof(listNode)+sizeof(robj);
return c->reply_bytes + (list_item_size*listLength(c->reply));
}
| 1,011 |
79,429 | 0 | static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov,
MOVTrack *track, int moof_size,
int first, int end)
{
int64_t pos = avio_tell(pb);
uint32_t flags = MOV_TRUN_DATA_OFFSET;
int i;
for (i = first; i < end; i++) {
if (get_cluster_duration(track, i) != track->default_duration)
flags |= MOV_TRUN_SAMPLE_DURATION;
if (track->cluster[i].size != track->default_size)
flags |= MOV_TRUN_SAMPLE_SIZE;
if (i > first && get_sample_flags(track, &track->cluster[i]) != track->default_sample_flags)
flags |= MOV_TRUN_SAMPLE_FLAGS;
}
if (!(flags & MOV_TRUN_SAMPLE_FLAGS) && track->entry > 0 &&
get_sample_flags(track, &track->cluster[0]) != track->default_sample_flags)
flags |= MOV_TRUN_FIRST_SAMPLE_FLAGS;
if (track->flags & MOV_TRACK_CTTS)
flags |= MOV_TRUN_SAMPLE_CTS;
avio_wb32(pb, 0); /* size placeholder */
ffio_wfourcc(pb, "trun");
if (mov->flags & FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS)
avio_w8(pb, 1); /* version */
else
avio_w8(pb, 0); /* version */
avio_wb24(pb, flags);
avio_wb32(pb, end - first); /* sample count */
if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET &&
!(mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) &&
!mov->first_trun)
avio_wb32(pb, 0); /* Later tracks follow immediately after the previous one */
else
avio_wb32(pb, moof_size + 8 + track->data_offset +
track->cluster[first].pos); /* data offset */
if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS)
avio_wb32(pb, get_sample_flags(track, &track->cluster[first]));
for (i = first; i < end; i++) {
if (flags & MOV_TRUN_SAMPLE_DURATION)
avio_wb32(pb, get_cluster_duration(track, i));
if (flags & MOV_TRUN_SAMPLE_SIZE)
avio_wb32(pb, track->cluster[i].size);
if (flags & MOV_TRUN_SAMPLE_FLAGS)
avio_wb32(pb, get_sample_flags(track, &track->cluster[i]));
if (flags & MOV_TRUN_SAMPLE_CTS)
avio_wb32(pb, track->cluster[i].cts);
}
mov->first_trun = 0;
return update_size(pb, pos);
}
| 1,012 |
4,909 | 0 | XineramaSetCursorPosition(DeviceIntPtr pDev, int x, int y, Bool generateEvent)
{
ScreenPtr pScreen;
int i;
SpritePtr pSprite = pDev->spriteInfo->sprite;
/* x,y are in Screen 0 coordinates. We need to decide what Screen
to send the message too and what the coordinates relative to
that screen are. */
pScreen = pSprite->screen;
x += screenInfo.screens[0]->x;
y += screenInfo.screens[0]->y;
if (!point_on_screen(pScreen, x, y)) {
FOR_NSCREENS(i) {
if (i == pScreen->myNum)
continue;
if (point_on_screen(screenInfo.screens[i], x, y)) {
pScreen = screenInfo.screens[i];
break;
}
}
}
pSprite->screen = pScreen;
pSprite->hotPhys.x = x - screenInfo.screens[0]->x;
pSprite->hotPhys.y = y - screenInfo.screens[0]->y;
x -= pScreen->x;
y -= pScreen->y;
return (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
}
| 1,013 |
182,012 | 1 | static void sycc422_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
unsigned int maxw, maxh, max;
int offset, upb;
unsigned int i, j;
upb = (int)img->comps[0].prec;
offset = 1<<(upb - 1); upb = (1<<upb)-1;
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * (size_t)max);
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
if(r == NULL || g == NULL || b == NULL) goto fails;
for(i=0U; i < maxh; ++i)
{
for(j=0U; j < (maxw & ~(unsigned int)1U); j += 2U)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
if (j < maxw) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
#if defined(USE_JPWL) || defined(USE_MJ2)
img->comps[1].w = maxw; img->comps[1].h = maxh;
img->comps[2].w = maxw; img->comps[2].h = maxh;
#else
img->comps[1].w = (OPJ_UINT32)maxw; img->comps[1].h = (OPJ_UINT32)maxh;
img->comps[2].w = (OPJ_UINT32)maxw; img->comps[2].h = (OPJ_UINT32)maxh;
#endif
img->comps[1].dx = img->comps[0].dx;
img->comps[2].dx = img->comps[0].dx;
img->comps[1].dy = img->comps[0].dy;
img->comps[2].dy = img->comps[0].dy;
return;
fails:
if(r) free(r);
if(g) free(g);
if(b) free(b);
}/* sycc422_to_rgb() */
| 1,014 |
99,916 | 0 | NPError NPN_NewStream(NPP id,
NPMIMEType type,
const char* target,
NPStream** stream) {
DLOG(INFO) << "NPN_NewStream is not implemented yet.";
return NPERR_GENERIC_ERROR;
}
| 1,015 |
105,586 | 0 | void Automation::GoForward(int tab_id, Error** error) {
int windex = 0, tab_index = 0;
*error = GetIndicesForTab(tab_id, &windex, &tab_index);
if (*error)
return;
std::string error_msg;
if (!SendGoForwardJSONRequest(
automation(), windex, tab_index, &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
| 1,016 |
74,021 | 0 | MagickExport Image *ExtentImage(const Image *image,
const RectangleInfo *geometry,ExceptionInfo *exception)
{
Image
*extent_image;
/*
Allocate extent image.
*/
assert(image != (const Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(geometry != (const RectangleInfo *) NULL);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
if ((image->columns == geometry->width) &&
(image->rows == geometry->height) &&
(geometry->x == 0) && (geometry->y == 0))
return(CloneImage(image,0,0,MagickTrue,exception));
extent_image=CloneImage(image,geometry->width,geometry->height,MagickTrue,
exception);
if (extent_image == (Image *) NULL)
return((Image *) NULL);
(void) SetImageBackgroundColor(extent_image,exception);
(void) CompositeImage(extent_image,image,image->compose,MagickTrue,
-geometry->x,-geometry->y,exception);
return(extent_image);
}
| 1,017 |
26,773 | 0 | static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct net_device *dev = info->user_ptr[1];
struct wireless_dev *wdev = dev->ieee80211_ptr;
const u8 *bssid;
if (!info->attrs[NL80211_ATTR_MAC])
return -EINVAL;
if (netif_running(dev))
return -EBUSY;
if (!rdev->ops->set_wds_peer)
return -EOPNOTSUPP;
if (wdev->iftype != NL80211_IFTYPE_WDS)
return -EOPNOTSUPP;
bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid);
}
| 1,018 |
78,028 | 0 | char* GetData(cmsIT8* it8, int nSet, int nField)
{
TABLE* t = GetTable(it8);
int nSamples = t -> nSamples;
int nPatches = t -> nPatches;
if (nSet >= nPatches || nField >= nSamples)
return NULL;
if (!t->Data) return NULL;
return t->Data [nSet * nSamples + nField];
}
| 1,019 |
102,327 | 0 | void ExtensionPrefs::SetExtensionPrefPermissionSet(
const std::string& extension_id,
const std::string& pref_key,
const ExtensionPermissionSet* new_value) {
ListValue* api_values = new ListValue();
ExtensionAPIPermissionSet apis = new_value->apis();
ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance();
std::string api_pref = JoinPrefs(pref_key, kPrefAPIs);
for (ExtensionAPIPermissionSet::const_iterator i = apis.begin();
i != apis.end(); ++i) {
ExtensionAPIPermission* perm = info->GetByID(*i);
if (perm)
api_values->Append(Value::CreateStringValue(perm->name()));
}
UpdateExtensionPref(extension_id, api_pref, api_values);
if (!new_value->explicit_hosts().is_empty()) {
SetExtensionPrefURLPatternSet(extension_id,
JoinPrefs(pref_key, kPrefExplicitHosts),
new_value->explicit_hosts());
}
if (!new_value->scriptable_hosts().is_empty()) {
SetExtensionPrefURLPatternSet(extension_id,
JoinPrefs(pref_key, kPrefScriptableHosts),
new_value->scriptable_hosts());
}
}
| 1,020 |
4,426 | 0 | static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, int f404_len, char *entry, int entry_len TSRMLS_DC) /* {{{ */
{
sapi_header_line ctr = {0};
phar_entry_info *info;
if (phar && f404_len) {
info = phar_get_entry_info(phar, f404, f404_len, NULL, 1 TSRMLS_CC);
if (info) {
phar_file_action(phar, info, "text/html", PHAR_MIME_PHP, f404, f404_len, fname, NULL, NULL, 0 TSRMLS_CC);
return;
}
}
ctr.response_code = 404;
ctr.line_len = sizeof("HTTP/1.0 404 Not Found")-1;
ctr.line = "HTTP/1.0 404 Not Found";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
PHPWRITE("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ", sizeof("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ") - 1);
PHPWRITE(entry, entry_len);
PHPWRITE(" Not Found</h1>\n </body>\n</html>", sizeof(" Not Found</h1>\n </body>\n</html>") - 1);
}
/* }}} */
| 1,021 |
178,638 | 1 | static int tight_fill_palette(VncState *vs, int x, int y,
size_t count, uint32_t *bg, uint32_t *fg,
VncPalette **palette)
{
int max;
max = count / tight_conf[vs->tight.compression].idx_max_colors_divisor;
if (max < 2 &&
count >= tight_conf[vs->tight.compression].mono_min_rect_size) {
max = 2;
}
if (max >= 256) {
max = 256;
}
switch(vs->clientds.pf.bytes_per_pixel) {
case 4:
return tight_fill_palette32(vs, x, y, max, count, bg, fg, palette);
case 2:
return tight_fill_palette16(vs, x, y, max, count, bg, fg, palette);
default:
max = 2;
return tight_fill_palette8(vs, x, y, max, count, bg, fg, palette);
}
return 0;
}
| 1,022 |
159,866 | 0 | bool TopSitesImpl::AddPrepopulatedPages(MostVisitedURLList* urls,
size_t num_forced_urls) const {
bool added = false;
for (const auto& prepopulated_page : prepopulated_pages_) {
if (urls->size() - num_forced_urls < kNonForcedTopSitesNumber &&
IndexOf(*urls, prepopulated_page.most_visited.url) == -1) {
urls->push_back(prepopulated_page.most_visited);
added = true;
}
}
return added;
}
| 1,023 |
161,493 | 0 | TargetHandler::~TargetHandler() {
}
| 1,024 |
13,711 | 0 | ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */
{
ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg));
_zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC);
Z_TYPE_P(arg) = IS_ARRAY;
return SUCCESS;
}
/* }}} */
| 1,025 |
92,433 | 0 | static void sas_unregister_devs_sas_addr(struct domain_device *parent,
int phy_id, bool last)
{
struct expander_device *ex_dev = &parent->ex_dev;
struct ex_phy *phy = &ex_dev->ex_phy[phy_id];
struct domain_device *child, *n, *found = NULL;
if (last) {
list_for_each_entry_safe(child, n,
&ex_dev->children, siblings) {
if (SAS_ADDR(child->sas_addr) ==
SAS_ADDR(phy->attached_sas_addr)) {
set_bit(SAS_DEV_GONE, &child->state);
if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
sas_unregister_ex_tree(parent->port, child);
else
sas_unregister_dev(parent->port, child);
found = child;
break;
}
}
sas_disable_routing(parent, phy->attached_sas_addr);
}
memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
if (phy->port) {
sas_port_delete_phy(phy->port, phy->phy);
sas_device_set_phy(found, phy->port);
if (phy->port->num_phys == 0)
list_add_tail(&phy->port->del_list,
&parent->port->sas_port_del_list);
phy->port = NULL;
}
}
| 1,026 |
27,729 | 0 | static int sco_connect(struct sock *sk)
{
bdaddr_t *src = &bt_sk(sk)->src;
bdaddr_t *dst = &bt_sk(sk)->dst;
struct sco_conn *conn;
struct hci_conn *hcon;
struct hci_dev *hdev;
int err, type;
BT_DBG("%s -> %s", batostr(src), batostr(dst));
hdev = hci_get_route(dst, src);
if (!hdev)
return -EHOSTUNREACH;
hci_dev_lock_bh(hdev);
err = -ENOMEM;
if (lmp_esco_capable(hdev) && !disable_esco)
type = ESCO_LINK;
else
type = SCO_LINK;
hcon = hci_connect(hdev, type, dst, BT_SECURITY_LOW, HCI_AT_NO_BONDING);
if (!hcon)
goto done;
conn = sco_conn_add(hcon, 0);
if (!conn) {
hci_conn_put(hcon);
goto done;
}
/* Update source addr of the socket */
bacpy(src, conn->src);
err = sco_chan_add(conn, sk, NULL);
if (err)
goto done;
if (hcon->state == BT_CONNECTED) {
sco_sock_clear_timer(sk);
sk->sk_state = BT_CONNECTED;
} else {
sk->sk_state = BT_CONNECT;
sco_sock_set_timer(sk, sk->sk_sndtimeo);
}
done:
hci_dev_unlock_bh(hdev);
hci_dev_put(hdev);
return err;
}
| 1,027 |
111,383 | 0 | bool WebPagePrivate::shouldSendResizeEvent()
{
if (!m_mainFrame->document())
return false;
static const bool unrestrictedResizeEvents = Platform::Settings::instance()->unrestrictedResizeEvents();
if (unrestrictedResizeEvents)
return true;
DocumentLoader* documentLoader = m_mainFrame->loader()->documentLoader();
if (documentLoader && documentLoader->isLoadingInAPISense())
return false;
return true;
}
| 1,028 |
104,167 | 0 | bool IsOffscreenBufferMultisampled() const {
return offscreen_target_samples_ > 1;
}
| 1,029 |
74,581 | 0 | struct dentry *ovl_dentry_upper(struct dentry *dentry)
{
struct ovl_entry *oe = dentry->d_fsdata;
return ovl_upperdentry_dereference(oe);
}
| 1,030 |
61,832 | 0 | static int parse_global_var(AVFormatContext *avctx, AVStream *st,
const char *name, int size)
{
MvContext *mv = avctx->priv_data;
AVIOContext *pb = avctx->pb;
if (!strcmp(name, "__NUM_I_TRACKS")) {
mv->nb_video_tracks = var_read_int(pb, size);
} else if (!strcmp(name, "__NUM_A_TRACKS")) {
mv->nb_audio_tracks = var_read_int(pb, size);
} else if (!strcmp(name, "COMMENT") || !strcmp(name, "TITLE")) {
var_read_metadata(avctx, name, size);
} else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") ||
!strcmp(name, "OPTIMIZED")) {
avio_skip(pb, size); // ignore
} else
return AVERROR_INVALIDDATA;
return 0;
}
| 1,031 |
150,957 | 0 | static v8::Local<v8::Value> installPrivateScriptRunner(v8::Isolate* isolate) {
const String className = "PrivateScriptRunner";
size_t index;
for (index = 0; index < WTF_ARRAY_LENGTH(kPrivateScriptSources); index++) {
if (className == kPrivateScriptSources[index].className)
break;
}
if (index == WTF_ARRAY_LENGTH(kPrivateScriptSources)) {
LOG(FATAL)
<< "Private script error: Target source code was not found. (Class "
"name = "
<< className.utf8().data() << ")";
}
String resourceData =
loadResourceAsASCIIString(kPrivateScriptSources[index].resourceFile);
return compileAndRunPrivateScript(ScriptState::current(isolate), className,
resourceData.utf8().data(),
resourceData.length());
}
| 1,032 |
136,699 | 0 | void FrameSelection::Clear() {
granularity_ = TextGranularity::kCharacter;
if (granularity_strategy_)
granularity_strategy_->Clear();
SetSelectionAndEndTyping(SelectionInDOMTree());
is_handle_visible_ = false;
is_directional_ = ShouldAlwaysUseDirectionalSelection(frame_);
}
| 1,033 |
179,624 | 1 | queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
{
spin_unlock(&hb->lock);
drop_futex_key_refs(&q->key);
}
| 1,034 |
43,431 | 0 | static int bprm_mm_init(struct linux_binprm *bprm)
{
int err;
struct mm_struct *mm = NULL;
bprm->mm = mm = mm_alloc();
err = -ENOMEM;
if (!mm)
goto err;
err = __bprm_mm_init(bprm);
if (err)
goto err;
return 0;
err:
if (mm) {
bprm->mm = NULL;
mmdrop(mm);
}
return err;
}
| 1,035 |
2,820 | 0 | gx_device_set_procs(gx_device * dev)
{
if (dev->static_procs != 0) { /* 0 if already populated */
dev->procs = *dev->static_procs;
dev->static_procs = 0;
}
}
| 1,036 |
133,775 | 0 | void SSLClientSocketOpenSSL::OnSendComplete(int result) {
if (next_handshake_state_ == STATE_HANDSHAKE) {
OnHandshakeIOComplete(result);
return;
}
int rv_read = ERR_IO_PENDING;
int rv_write = ERR_IO_PENDING;
bool network_moved;
do {
if (user_read_buf_.get())
rv_read = DoPayloadRead();
if (user_write_buf_.get())
rv_write = DoPayloadWrite();
network_moved = DoTransportIO();
} while (rv_read == ERR_IO_PENDING && rv_write == ERR_IO_PENDING &&
(user_read_buf_.get() || user_write_buf_.get()) && network_moved);
base::WeakPtr<SSLClientSocketOpenSSL> guard(weak_factory_.GetWeakPtr());
if (user_read_buf_.get() && rv_read != ERR_IO_PENDING)
DoReadCallback(rv_read);
if (!guard.get())
return;
if (user_write_buf_.get() && rv_write != ERR_IO_PENDING)
DoWriteCallback(rv_write);
}
| 1,037 |
9,631 | 0 | PHPAPI int php_session_register_module(ps_module *ptr) /* {{{ */
{
int ret = -1;
int i;
for (i = 0; i < MAX_MODULES; i++) {
if (!ps_modules[i]) {
ps_modules[i] = ptr;
ret = 0;
break;
}
}
return ret;
}
/* }}} */
| 1,038 |
128,219 | 0 | void FrameView::adjustMediaTypeForPrinting(bool printing)
{
if (printing) {
if (m_mediaTypeWhenNotPrinting.isNull())
m_mediaTypeWhenNotPrinting = mediaType();
setMediaType("print");
} else {
if (!m_mediaTypeWhenNotPrinting.isNull())
setMediaType(m_mediaTypeWhenNotPrinting);
m_mediaTypeWhenNotPrinting = nullAtom;
}
}
| 1,039 |
88,720 | 0 | static int check_confirmation(modbus_t *ctx, uint8_t *req,
uint8_t *rsp, int rsp_length)
{
int rc;
int rsp_length_computed;
const int offset = ctx->backend->header_length;
const int function = rsp[offset];
if (ctx->backend->pre_check_confirmation) {
rc = ctx->backend->pre_check_confirmation(ctx, req, rsp, rsp_length);
if (rc == -1) {
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_PROTOCOL) {
_sleep_response_timeout(ctx);
modbus_flush(ctx);
}
return -1;
}
}
rsp_length_computed = compute_response_length_from_request(ctx, req);
/* Exception code */
if (function >= 0x80) {
if (rsp_length == (offset + 2 + (int)ctx->backend->checksum_length) &&
req[offset] == (rsp[offset] - 0x80)) {
/* Valid exception code received */
int exception_code = rsp[offset + 1];
if (exception_code < MODBUS_EXCEPTION_MAX) {
errno = MODBUS_ENOBASE + exception_code;
} else {
errno = EMBBADEXC;
}
_error_print(ctx, NULL);
return -1;
} else {
errno = EMBBADEXC;
_error_print(ctx, NULL);
return -1;
}
}
/* Check length */
if ((rsp_length == rsp_length_computed ||
rsp_length_computed == MSG_LENGTH_UNDEFINED) &&
function < 0x80) {
int req_nb_value;
int rsp_nb_value;
/* Check function code */
if (function != req[offset]) {
if (ctx->debug) {
fprintf(stderr,
"Received function not corresponding to the request (0x%X != 0x%X)\n",
function, req[offset]);
}
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_PROTOCOL) {
_sleep_response_timeout(ctx);
modbus_flush(ctx);
}
errno = EMBBADDATA;
return -1;
}
/* Check the number of values is corresponding to the request */
switch (function) {
case MODBUS_FC_READ_COILS:
case MODBUS_FC_READ_DISCRETE_INPUTS:
/* Read functions, 8 values in a byte (nb
* of values in the request and byte count in
* the response. */
req_nb_value = (req[offset + 3] << 8) + req[offset + 4];
req_nb_value = (req_nb_value / 8) + ((req_nb_value % 8) ? 1 : 0);
rsp_nb_value = rsp[offset + 1];
break;
case MODBUS_FC_WRITE_AND_READ_REGISTERS:
case MODBUS_FC_READ_HOLDING_REGISTERS:
case MODBUS_FC_READ_INPUT_REGISTERS:
/* Read functions 1 value = 2 bytes */
req_nb_value = (req[offset + 3] << 8) + req[offset + 4];
rsp_nb_value = (rsp[offset + 1] / 2);
break;
case MODBUS_FC_WRITE_MULTIPLE_COILS:
case MODBUS_FC_WRITE_MULTIPLE_REGISTERS:
/* N Write functions */
req_nb_value = (req[offset + 3] << 8) + req[offset + 4];
rsp_nb_value = (rsp[offset + 3] << 8) | rsp[offset + 4];
break;
case MODBUS_FC_REPORT_SLAVE_ID:
/* Report slave ID (bytes received) */
req_nb_value = rsp_nb_value = rsp[offset + 1];
break;
default:
/* 1 Write functions & others */
req_nb_value = rsp_nb_value = 1;
}
if (req_nb_value == rsp_nb_value) {
rc = rsp_nb_value;
} else {
if (ctx->debug) {
fprintf(stderr,
"Quantity not corresponding to the request (%d != %d)\n",
rsp_nb_value, req_nb_value);
}
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_PROTOCOL) {
_sleep_response_timeout(ctx);
modbus_flush(ctx);
}
errno = EMBBADDATA;
rc = -1;
}
} else {
if (ctx->debug) {
fprintf(stderr,
"Message length not corresponding to the computed length (%d != %d)\n",
rsp_length, rsp_length_computed);
}
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_PROTOCOL) {
_sleep_response_timeout(ctx);
modbus_flush(ctx);
}
errno = EMBBADDATA;
rc = -1;
}
return rc;
}
| 1,040 |
187,285 | 1 | FileStream::FileStream(base::File file,
const scoped_refptr<base::TaskRunner>& task_runner)
: context_(base::MakeUnique<Context>(std::move(file), task_runner)) {}
| 1,041 |
122,608 | 0 | void Extension::AddWebExtentPattern(const URLPattern& pattern) {
extent_.AddPattern(pattern);
}
| 1,042 |
44,772 | 0 | static void process_lock_setup_atfork(void)
{
pthread_atfork(process_lock, process_unlock, process_unlock);
}
| 1,043 |
31,248 | 0 | static inline struct ahash_alg *crypto_ahash_alg(struct crypto_ahash *hash)
{
return container_of(crypto_hash_alg_common(hash), struct ahash_alg,
halg);
}
| 1,044 |
123,076 | 0 | void RenderWidgetHostImpl::WasResized() {
if (resize_ack_pending_ || !process_->HasConnection() || !view_ ||
!renderer_initialized_ || should_auto_resize_) {
return;
}
gfx::Rect view_bounds = view_->GetViewBounds();
gfx::Size new_size(view_bounds.size());
bool was_fullscreen = is_fullscreen_;
is_fullscreen_ = IsFullscreen();
bool fullscreen_changed = was_fullscreen != is_fullscreen_;
bool size_changed = new_size != current_size_;
if (!size_changed && !fullscreen_changed)
return;
if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ &&
!fullscreen_changed)
return;
if (!new_size.IsEmpty() && size_changed)
resize_ack_pending_ = true;
if (!Send(new ViewMsg_Resize(routing_id_, new_size,
GetRootWindowResizerRect(), is_fullscreen_))) {
resize_ack_pending_ = false;
} else {
in_flight_size_ = new_size;
}
}
| 1,045 |
115,154 | 0 | void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>)
{
}
| 1,046 |
154,607 | 0 | error::Error GLES2DecoderPassthroughImpl::DoCoverStrokePathCHROMIUM(
GLuint path,
GLenum coverMode) {
NOTIMPLEMENTED();
return error::kNoError;
}
| 1,047 |
35,491 | 0 | static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
struct sk_buff *skb,
struct ieee80211_tx_info *info,
struct tid_ampdu_tx *tid_tx,
int tid)
{
bool queued = false;
bool reset_agg_timer = false;
struct sk_buff *purge_skb = NULL;
if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
info->flags |= IEEE80211_TX_CTL_AMPDU;
reset_agg_timer = true;
} else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
/*
* nothing -- this aggregation session is being started
* but that might still fail with the driver
*/
} else {
spin_lock(&tx->sta->lock);
/*
* Need to re-check now, because we may get here
*
* 1) in the window during which the setup is actually
* already done, but not marked yet because not all
* packets are spliced over to the driver pending
* queue yet -- if this happened we acquire the lock
* either before or after the splice happens, but
* need to recheck which of these cases happened.
*
* 2) during session teardown, if the OPERATIONAL bit
* was cleared due to the teardown but the pointer
* hasn't been assigned NULL yet (or we loaded it
* before it was assigned) -- in this case it may
* now be NULL which means we should just let the
* packet pass through because splicing the frames
* back is already done.
*/
tid_tx = rcu_dereference_protected_tid_tx(tx->sta, tid);
if (!tid_tx) {
/* do nothing, let packet pass through */
} else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
info->flags |= IEEE80211_TX_CTL_AMPDU;
reset_agg_timer = true;
} else {
queued = true;
info->control.vif = &tx->sdata->vif;
info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
__skb_queue_tail(&tid_tx->pending, skb);
if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
purge_skb = __skb_dequeue(&tid_tx->pending);
}
spin_unlock(&tx->sta->lock);
if (purge_skb)
ieee80211_free_txskb(&tx->local->hw, purge_skb);
}
/* reset session timer */
if (reset_agg_timer && tid_tx->timeout)
tid_tx->last_tx = jiffies;
return queued;
}
| 1,048 |
78,454 | 0 | gpk_restore_security_env(sc_card_t *card, int se_num)
{
return 0;
}
| 1,049 |
129,365 | 0 | GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
if (framebuffer != NULL) {
return framebuffer->GetColorAttachmentTextureType();
} else {
return GL_UNSIGNED_BYTE;
}
}
| 1,050 |
184,339 | 1 | bool WebPagePrivate::dispatchTouchPointAsMouseEventToFullScreenPlugin(PluginView* pluginView, const Platform::TouchPoint& point)
{
NPEvent npEvent;
NPMouseEvent mouse;
switch (point.m_state) {
case Platform::TouchPoint::TouchPressed:
mouse.type = MOUSE_BUTTON_DOWN;
break;
case Platform::TouchPoint::TouchReleased:
mouse.type = MOUSE_BUTTON_UP;
break;
case Platform::TouchPoint::TouchMoved:
mouse.type = MOUSE_MOTION;
break;
case Platform::TouchPoint::TouchStationary:
return true;
}
mouse.x = point.m_screenPos.x();
mouse.y = point.m_screenPos.y();
mouse.button = mouse.type != MOUSE_BUTTON_UP;
mouse.flags = 0;
npEvent.type = NP_MouseEvent;
npEvent.data = &mouse;
pluginView->dispatchFullScreenNPEvent(npEvent);
return true;
}
| 1,051 |
153,001 | 0 | int PDFiumEngine::Form_Response(IPDF_JSPLATFORM* param,
FPDF_WIDESTRING question,
FPDF_WIDESTRING title,
FPDF_WIDESTRING default_response,
FPDF_WIDESTRING label,
FPDF_BOOL password,
void* response,
int length) {
std::string question_str = base::UTF16ToUTF8(
reinterpret_cast<const base::char16*>(question));
std::string default_str = base::UTF16ToUTF8(
reinterpret_cast<const base::char16*>(default_response));
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
std::string rv = engine->client_->Prompt(question_str, default_str);
base::string16 rv_16 = base::UTF8ToUTF16(rv);
int rv_bytes = rv_16.size() * sizeof(base::char16);
if (response) {
int bytes_to_copy = rv_bytes < length ? rv_bytes : length;
memcpy(response, rv_16.c_str(), bytes_to_copy);
}
return rv_bytes;
}
| 1,052 |
33,380 | 0 | kvp_work_func(struct work_struct *dummy)
{
/*
* If the timer fires, the user-mode component has not responded;
* process the pending transaction.
*/
kvp_respond_to_host("Unknown key", "Guest timed out", TIMEOUT_FIRED);
}
| 1,053 |
138,210 | 0 | void AXObject::tokenVectorFromAttribute(Vector<String>& tokens,
const QualifiedName& attribute) const {
Node* node = this->getNode();
if (!node || !node->isElementNode())
return;
String attributeValue = getAttribute(attribute).getString();
if (attributeValue.isEmpty())
return;
attributeValue.simplifyWhiteSpace();
attributeValue.split(' ', tokens);
}
| 1,054 |
44,618 | 0 | int pin_rootfs(const char *rootfs)
{
char absrootfs[MAXPATHLEN];
char absrootfspin[MAXPATHLEN];
struct stat s;
int ret, fd;
if (rootfs == NULL || strlen(rootfs) == 0)
return -2;
if (!realpath(rootfs, absrootfs))
return -2;
if (access(absrootfs, F_OK))
return -1;
if (stat(absrootfs, &s))
return -1;
if (!S_ISDIR(s.st_mode))
return -2;
ret = snprintf(absrootfspin, MAXPATHLEN, "%s/lxc.hold", absrootfs);
if (ret >= MAXPATHLEN)
return -1;
fd = open(absrootfspin, O_CREAT | O_RDWR, S_IWUSR|S_IRUSR);
if (fd < 0)
return fd;
(void)unlink(absrootfspin);
return fd;
}
| 1,055 |
166,664 | 0 | void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) {
if (isContextLost())
return;
bool is_valid = false;
switch (target) {
case GL_GENERATE_MIPMAP_HINT:
is_valid = true;
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives
if (ExtensionEnabled(kOESStandardDerivativesName) || IsWebGL2OrHigher())
is_valid = true;
break;
}
if (!is_valid) {
SynthesizeGLError(GL_INVALID_ENUM, "hint", "invalid target");
return;
}
ContextGL()->Hint(target, mode);
}
| 1,056 |
136,658 | 0 | void FrameLoader::DispatchUnloadEvent() {
FrameNavigationDisabler navigation_disabler(*frame_);
protect_provisional_loader_ = false;
SaveScrollState();
if (frame_->GetDocument() && !SVGImage::IsInSVGImage(frame_->GetDocument()))
frame_->GetDocument()->DispatchUnloadEvents();
}
| 1,057 |
35,804 | 0 | static void kvm_timer_init(void)
{
int cpu;
max_tsc_khz = tsc_khz;
cpu_notifier_register_begin();
if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
#ifdef CONFIG_CPU_FREQ
struct cpufreq_policy policy;
memset(&policy, 0, sizeof(policy));
cpu = get_cpu();
cpufreq_get_policy(&policy, cpu);
if (policy.cpuinfo.max_freq)
max_tsc_khz = policy.cpuinfo.max_freq;
put_cpu();
#endif
cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
}
pr_debug("kvm: max_tsc_khz = %ld\n", max_tsc_khz);
for_each_online_cpu(cpu)
smp_call_function_single(cpu, tsc_khz_changed, NULL, 1);
__register_hotcpu_notifier(&kvmclock_cpu_notifier_block);
cpu_notifier_register_done();
}
| 1,058 |
98,390 | 0 | G_CONST_RETURN gchar* webkit_web_frame_get_name(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
WebKitWebFramePrivate* priv = frame->priv;
if (priv->name)
return priv->name;
Frame* coreFrame = core(frame);
if (!coreFrame)
return "";
String string = coreFrame->tree()->name();
priv->name = g_strdup(string.utf8().data());
return priv->name;
}
| 1,059 |
148,140 | 0 | void V8TestObject::VoidMethodPromiseArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodPromiseArg");
test_object_v8_internal::VoidMethodPromiseArgMethod(info);
}
| 1,060 |
41,643 | 0 | static int btrfs_init_locked_inode(struct inode *inode, void *p)
{
struct btrfs_iget_args *args = p;
inode->i_ino = args->location->objectid;
memcpy(&BTRFS_I(inode)->location, args->location,
sizeof(*args->location));
BTRFS_I(inode)->root = args->root;
return 0;
}
| 1,061 |
57,298 | 0 | xdr_krb5_kvno(XDR *xdrs, krb5_kvno *objp)
{
return xdr_u_int(xdrs, objp);
}
| 1,062 |
136,664 | 0 | bool FrameLoader::IsLoadingMainFrame() const {
return frame_->IsMainFrame();
}
| 1,063 |
141,436 | 0 | void PaintLayerScrollableArea::InvalidateStickyConstraintsFor(
PaintLayer* layer,
bool needs_compositing_update) {
if (PaintLayerScrollableAreaRareData* d = RareData()) {
d->sticky_constraints_map_.erase(layer);
if (needs_compositing_update &&
layer->GetLayoutObject().StyleRef().HasStickyConstrainedPosition()) {
layer->SetNeedsCompositingInputsUpdate();
layer->GetLayoutObject().SetNeedsPaintPropertyUpdate();
}
}
}
| 1,064 |
33,913 | 0 | mainloop_child_destroy(mainloop_child_t *child)
{
if (child->timerid != 0) {
crm_trace("Removing timer %d", child->timerid);
g_source_remove(child->timerid);
child->timerid = 0;
}
free(child->desc);
g_free(child);
}
| 1,065 |
13,844 | 0 | ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
zval *tmp;
ALLOC_ZVAL(tmp);
Z_UNSET_ISREF_P(tmp);
Z_SET_REFCOUNT_P(tmp, 0);
ZVAL_DOUBLE(tmp, value);
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
/* }}} */
| 1,066 |
163,096 | 0 | std::unique_ptr<BlobDataSnapshot> BlobStorageContext::CreateSnapshot(
const std::string& uuid) {
std::unique_ptr<BlobDataSnapshot> result;
BlobEntry* entry = registry_.GetEntry(uuid);
if (entry->status() != BlobStatus::DONE)
return result;
std::unique_ptr<BlobDataSnapshot> snapshot(new BlobDataSnapshot(
uuid, entry->content_type(), entry->content_disposition()));
snapshot->items_.reserve(entry->items().size());
for (const auto& shareable_item : entry->items()) {
snapshot->items_.push_back(shareable_item->item());
}
memory_controller_.NotifyMemoryItemsUsed(entry->items());
return snapshot;
}
| 1,067 |
32,939 | 0 | static void ext3_orphan_cleanup (struct super_block * sb,
struct ext3_super_block * es)
{
unsigned int s_flags = sb->s_flags;
int nr_orphans = 0, nr_truncates = 0;
#ifdef CONFIG_QUOTA
int i;
#endif
if (!es->s_last_orphan) {
jbd_debug(4, "no orphan inodes to clean up\n");
return;
}
if (bdev_read_only(sb->s_bdev)) {
ext3_msg(sb, KERN_ERR, "error: write access "
"unavailable, skipping orphan cleanup.");
return;
}
/* Check if feature set allows readwrite operations */
if (EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) {
ext3_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
"unknown ROCOMPAT features");
return;
}
if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
/* don't clear list on RO mount w/ errors */
if (es->s_last_orphan && !(s_flags & MS_RDONLY)) {
jbd_debug(1, "Errors on filesystem, "
"clearing orphan list.\n");
es->s_last_orphan = 0;
}
jbd_debug(1, "Skipping orphan recovery on fs with errors.\n");
return;
}
if (s_flags & MS_RDONLY) {
ext3_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
sb->s_flags &= ~MS_RDONLY;
}
#ifdef CONFIG_QUOTA
/* Needed for iput() to work correctly and not trash data */
sb->s_flags |= MS_ACTIVE;
/* Turn on quotas so that they are updated correctly */
for (i = 0; i < MAXQUOTAS; i++) {
if (EXT3_SB(sb)->s_qf_names[i]) {
int ret = ext3_quota_on_mount(sb, i);
if (ret < 0)
ext3_msg(sb, KERN_ERR,
"error: cannot turn on journaled "
"quota: %d", ret);
}
}
#endif
while (es->s_last_orphan) {
struct inode *inode;
inode = ext3_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
if (IS_ERR(inode)) {
es->s_last_orphan = 0;
break;
}
list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
dquot_initialize(inode);
if (inode->i_nlink) {
printk(KERN_DEBUG
"%s: truncating inode %lu to %Ld bytes\n",
__func__, inode->i_ino, inode->i_size);
jbd_debug(2, "truncating inode %lu to %Ld bytes\n",
inode->i_ino, inode->i_size);
ext3_truncate(inode);
nr_truncates++;
} else {
printk(KERN_DEBUG
"%s: deleting unreferenced inode %lu\n",
__func__, inode->i_ino);
jbd_debug(2, "deleting unreferenced inode %lu\n",
inode->i_ino);
nr_orphans++;
}
iput(inode); /* The delete magic happens here! */
}
#define PLURAL(x) (x), ((x)==1) ? "" : "s"
if (nr_orphans)
ext3_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
PLURAL(nr_orphans));
if (nr_truncates)
ext3_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
PLURAL(nr_truncates));
#ifdef CONFIG_QUOTA
/* Turn quotas off */
for (i = 0; i < MAXQUOTAS; i++) {
if (sb_dqopt(sb)->files[i])
dquot_quota_off(sb, i);
}
#endif
sb->s_flags = s_flags; /* Restore MS_RDONLY status */
}
| 1,068 |
21,365 | 0 | static struct vm_area_struct* hugetlb_vma(unsigned long addr, struct mm_walk *walk)
{
struct vm_area_struct *vma;
/* We don't need vma lookup at all. */
if (!walk->hugetlb_entry)
return NULL;
VM_BUG_ON(!rwsem_is_locked(&walk->mm->mmap_sem));
vma = find_vma(walk->mm, addr);
if (vma && vma->vm_start <= addr && is_vm_hugetlb_page(vma))
return vma;
return NULL;
}
| 1,069 |
11,101 | 0 | PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
{
int i;
PHAR_G(request_ends) = 1;
if (PHAR_G(request_init))
{
phar_release_functions();
zend_hash_destroy(&(PHAR_G(phar_alias_map)));
PHAR_G(phar_alias_map.u.flags) = 0;
zend_hash_destroy(&(PHAR_G(phar_fname_map)));
PHAR_G(phar_fname_map.u.flags) = 0;
zend_hash_destroy(&(PHAR_G(phar_persist_map)));
PHAR_G(phar_persist_map.u.flags) = 0;
PHAR_G(phar_SERVER_mung_list) = 0;
if (PHAR_G(cached_fp)) {
for (i = 0; i < zend_hash_num_elements(&cached_phars); ++i) {
if (PHAR_G(cached_fp)[i].fp) {
php_stream_close(PHAR_G(cached_fp)[i].fp);
}
if (PHAR_G(cached_fp)[i].ufp) {
php_stream_close(PHAR_G(cached_fp)[i].ufp);
}
efree(PHAR_G(cached_fp)[i].manifest);
}
efree(PHAR_G(cached_fp));
PHAR_G(cached_fp) = 0;
}
PHAR_G(request_init) = 0;
if (PHAR_G(cwd)) {
efree(PHAR_G(cwd));
}
PHAR_G(cwd) = NULL;
PHAR_G(cwd_len) = 0;
PHAR_G(cwd_init) = 0;
}
PHAR_G(request_done) = 1;
return SUCCESS;
}
/* }}} */
| 1,070 |
178,360 | 1 | static int ohci_bus_start(OHCIState *ohci)
{
ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
ohci_frame_boundary,
ohci);
if (ohci->eof_timer == NULL) {
trace_usb_ohci_bus_eof_timer_failed(ohci->name);
ohci_die(ohci);
return 0;
}
trace_usb_ohci_start(ohci->name);
/* Delay the first SOF event by one frame time as
if (ohci->eof_timer == NULL) {
trace_usb_ohci_bus_eof_timer_failed(ohci->name);
ohci_die(ohci);
return 0;
}
trace_usb_ohci_start(ohci->name);
/* Delay the first SOF event by one frame time as
static void ohci_bus_stop(OHCIState *ohci)
{
trace_usb_ohci_stop(ohci->name);
if (ohci->eof_timer) {
timer_del(ohci->eof_timer);
timer_free(ohci->eof_timer);
}
ohci->eof_timer = NULL;
}
/* Sets a flag in a port status register but only set it if the port is
}
| 1,071 |
37,098 | 0 | static int handle_vmresume(struct kvm_vcpu *vcpu)
{
return nested_vmx_run(vcpu, false);
}
| 1,072 |
30,110 | 0 | __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
void *data, int flags)
{
struct ftrace_func_probe *entry;
struct hlist_node *tmp;
char str[KSYM_SYMBOL_LEN];
int type = MATCH_FULL;
int i, len = 0;
char *search;
if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))
glob = NULL;
else if (glob) {
int not;
type = filter_parse_regex(glob, strlen(glob), &search, ¬);
len = strlen(search);
/* we do not support '!' for function probes */
if (WARN_ON(not))
return;
}
mutex_lock(&ftrace_lock);
for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) {
struct hlist_head *hhd = &ftrace_func_hash[i];
hlist_for_each_entry_safe(entry, tmp, hhd, node) {
/* break up if statements for readability */
if ((flags & PROBE_TEST_FUNC) && entry->ops != ops)
continue;
if ((flags & PROBE_TEST_DATA) && entry->data != data)
continue;
/* do this last, since it is the most expensive */
if (glob) {
kallsyms_lookup(entry->ip, NULL, NULL,
NULL, str);
if (!ftrace_match(str, glob, len, type))
continue;
}
hlist_del_rcu(&entry->node);
call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu);
}
}
__disable_ftrace_function_probe();
mutex_unlock(&ftrace_lock);
}
| 1,073 |
106,053 | 0 | void JSTestNamedConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
JSTestNamedConstructor* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.get().asCell());
DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, jsTestNamedConstructor->impl(), jsTestNamedConstructor);
jsTestNamedConstructor->releaseImpl();
}
| 1,074 |
64,326 | 0 | static int test_ifmod_section(cmd_parms *cmd, const char *arg)
{
return find_module(cmd->server, arg) != NULL;
}
| 1,075 |
186,273 | 1 | static void LongOrNullAttributeAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestObject* impl = V8TestObject::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "longOrNullAttribute");
// Prepare the value to be set.
int32_t cpp_value = NativeValueTraits<IDLLong>::NativeValue(info.GetIsolate(), v8_value, exception_state);
if (exception_state.HadException())
return;
bool is_null = IsUndefinedOrNull(v8_value);
impl->setLongOrNullAttribute(cpp_value, is_null);
}
| 1,076 |
175,639 | 0 | SoftAACEncoder2::SoftAACEncoder2(
const char *name,
const OMX_CALLBACKTYPE *callbacks,
OMX_PTR appData,
OMX_COMPONENTTYPE **component)
: SimpleSoftOMXComponent(name, callbacks, appData, component),
mAACEncoder(NULL),
mNumChannels(1),
mSampleRate(44100),
mBitRate(0),
mSBRMode(-1),
mSBRRatio(0),
mAACProfile(OMX_AUDIO_AACObjectLC),
mSentCodecSpecificData(false),
mInputSize(0),
mInputFrame(NULL),
mInputTimeUs(-1ll),
mSawInputEOS(false),
mSignalledError(false) {
initPorts();
CHECK_EQ(initEncoder(), (status_t)OK);
setAudioParams();
}
| 1,077 |
162,302 | 0 | gpu::CommandBuffer::State CommandBufferProxyImpl::WaitForTokenInRange(
int32_t start,
int32_t end) {
CheckLock();
base::AutoLock lock(last_state_lock_);
TRACE_EVENT2("gpu", "CommandBufferProxyImpl::WaitForToken", "start", start,
"end", end);
if (last_state_.error != gpu::error::kNoError) {
if (gpu_control_client_)
gpu_control_client_->OnGpuControlLostContextMaybeReentrant();
return last_state_;
}
TryUpdateState();
if (!InRange(start, end, last_state_.token) &&
last_state_.error == gpu::error::kNoError) {
gpu::CommandBuffer::State state;
if (Send(new GpuCommandBufferMsg_WaitForTokenInRange(route_id_, start, end,
&state))) {
SetStateFromMessageReply(state);
}
}
if (!InRange(start, end, last_state_.token) &&
last_state_.error == gpu::error::kNoError) {
LOG(ERROR) << "GPU state invalid after WaitForTokenInRange.";
OnGpuSyncReplyError();
}
return last_state_;
}
| 1,078 |
141,302 | 0 | HTMLAllCollection* Document::all() {
return EnsureCachedCollection<HTMLAllCollection>(kDocAll);
}
| 1,079 |
57,708 | 0 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
{
struct fxregs_state *fxsave =
&vcpu->arch.guest_fpu.state.fxsave;
memcpy(fpu->fpr, fxsave->st_space, 128);
fpu->fcw = fxsave->cwd;
fpu->fsw = fxsave->swd;
fpu->ftwx = fxsave->twd;
fpu->last_opcode = fxsave->fop;
fpu->last_ip = fxsave->rip;
fpu->last_dp = fxsave->rdp;
memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space);
return 0;
}
| 1,080 |
103,739 | 0 | static void AddHistogramSample(void* hist, int sample) {
base::Histogram* histogram = static_cast<base::Histogram*>(hist);
histogram->Add(sample);
}
| 1,081 |
74,406 | 0 | static NDIS_STATUS SetupDPCTarget(PARANDIS_ADAPTER *pContext)
{
ULONG i;
#if NDIS_SUPPORT_NDIS620
NDIS_STATUS status;
PROCESSOR_NUMBER procNumber;
#endif
for (i = 0; i < pContext->nPathBundles; i++)
{
#if NDIS_SUPPORT_NDIS620
status = KeGetProcessorNumberFromIndex(i, &procNumber);
if (status != NDIS_STATUS_SUCCESS)
{
DPrintf(0, ("[%s] - KeGetProcessorNumberFromIndex failed for index %lu - %d\n", __FUNCTION__, i, status));
return status;
}
ParaNdis_ProcessorNumberToGroupAffinity(&pContext->pPathBundles[i].rxPath.DPCAffinity, &procNumber);
pContext->pPathBundles[i].txPath.DPCAffinity = pContext->pPathBundles[i].rxPath.DPCAffinity;
#elif NDIS_SUPPORT_NDIS6
pContext->pPathBundles[i].rxPath.DPCTargetProcessor = 1i64 << i;
pContext->pPathBundles[i].txPath.DPCTargetProcessor = pContext->pPathBundles[i].rxPath.DPCTargetProcessor;
#else
#error not supported
#endif
}
#if NDIS_SUPPORT_NDIS620
pContext->CXPath.DPCAffinity = pContext->pPathBundles[0].rxPath.DPCAffinity;
#elif NDIS_SUPPORT_NDIS6
pContext->CXPath.DPCTargetProcessor = pContext->pPathBundles[0].rxPath.DPCTargetProcessor;
#else
#error not yet defined
#endif
return NDIS_STATUS_SUCCESS;
}
| 1,082 |
48,601 | 0 | static void vfio_pci_request(void *device_data, unsigned int count)
{
struct vfio_pci_device *vdev = device_data;
mutex_lock(&vdev->igate);
if (vdev->req_trigger) {
if (!(count % 10))
dev_notice_ratelimited(&vdev->pdev->dev,
"Relaying device request to user (#%u)\n",
count);
eventfd_signal(vdev->req_trigger, 1);
} else if (count == 0) {
dev_warn(&vdev->pdev->dev,
"No device request channel registered, blocked until released by user\n");
}
mutex_unlock(&vdev->igate);
}
| 1,083 |
114,189 | 0 | void BrowserGpuChannelHostFactory::Terminate() {
delete instance_;
instance_ = NULL;
}
| 1,084 |
26,654 | 0 | struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
int approxlen, gfp_t gfp)
{
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
return __cfg80211_testmode_alloc_skb(rdev, approxlen, 0, 0, gfp);
}
| 1,085 |
23,875 | 0 | static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
{
struct sock *sk;
struct tun_struct *tun;
struct net_device *dev;
int err;
dev = __dev_get_by_name(net, ifr->ifr_name);
if (dev) {
const struct cred *cred = current_cred();
if (ifr->ifr_flags & IFF_TUN_EXCL)
return -EBUSY;
if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)
tun = netdev_priv(dev);
else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)
tun = netdev_priv(dev);
else
return -EINVAL;
if (((tun->owner != -1 && cred->euid != tun->owner) ||
(tun->group != -1 && !in_egroup_p(tun->group))) &&
!capable(CAP_NET_ADMIN))
return -EPERM;
err = security_tun_dev_attach(tun->socket.sk);
if (err < 0)
return err;
err = tun_attach(tun, file);
if (err < 0)
return err;
}
else {
char *name;
unsigned long flags = 0;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
err = security_tun_dev_create();
if (err < 0)
return err;
/* Set dev type */
if (ifr->ifr_flags & IFF_TUN) {
/* TUN device */
flags |= TUN_TUN_DEV;
name = "tun%d";
} else if (ifr->ifr_flags & IFF_TAP) {
/* TAP device */
flags |= TUN_TAP_DEV;
name = "tap%d";
} else
return -EINVAL;
if (*ifr->ifr_name)
name = ifr->ifr_name;
dev = alloc_netdev(sizeof(struct tun_struct), name,
tun_setup);
if (!dev)
return -ENOMEM;
dev_net_set(dev, net);
dev->rtnl_link_ops = &tun_link_ops;
tun = netdev_priv(dev);
tun->dev = dev;
tun->flags = flags;
tun->txflt.count = 0;
tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
err = -ENOMEM;
sk = sk_alloc(net, AF_UNSPEC, GFP_KERNEL, &tun_proto);
if (!sk)
goto err_free_dev;
tun->socket.wq = &tun->wq;
init_waitqueue_head(&tun->wq.wait);
tun->socket.ops = &tun_socket_ops;
sock_init_data(&tun->socket, sk);
sk->sk_write_space = tun_sock_write_space;
sk->sk_sndbuf = INT_MAX;
tun_sk(sk)->tun = tun;
security_tun_dev_post_create(sk);
tun_net_init(dev);
dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
TUN_USER_FEATURES;
dev->features = dev->hw_features;
err = register_netdevice(tun->dev);
if (err < 0)
goto err_free_sk;
if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
device_create_file(&tun->dev->dev, &dev_attr_owner) ||
device_create_file(&tun->dev->dev, &dev_attr_group))
pr_err("Failed to create tun sysfs files\n");
sk->sk_destruct = tun_sock_destruct;
err = tun_attach(tun, file);
if (err < 0)
goto failed;
}
tun_debug(KERN_INFO, tun, "tun_set_iff\n");
if (ifr->ifr_flags & IFF_NO_PI)
tun->flags |= TUN_NO_PI;
else
tun->flags &= ~TUN_NO_PI;
if (ifr->ifr_flags & IFF_ONE_QUEUE)
tun->flags |= TUN_ONE_QUEUE;
else
tun->flags &= ~TUN_ONE_QUEUE;
if (ifr->ifr_flags & IFF_VNET_HDR)
tun->flags |= TUN_VNET_HDR;
else
tun->flags &= ~TUN_VNET_HDR;
/* Make sure persistent devices do not get stuck in
* xoff state.
*/
if (netif_running(tun->dev))
netif_wake_queue(tun->dev);
strcpy(ifr->ifr_name, tun->dev->name);
return 0;
err_free_sk:
sock_put(sk);
err_free_dev:
free_netdev(dev);
failed:
return err;
}
| 1,086 |
110,328 | 0 | void PrintEnd() {
if (ppp_printing_ != NULL)
ppp_printing_->End(plugin_->pp_instance());
}
| 1,087 |
67,343 | 0 | static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target)
{
if (target->d_parent != dentry->d_parent)
spin_unlock(&dentry->d_parent->d_lock);
if (target->d_parent != target)
spin_unlock(&target->d_parent->d_lock);
spin_unlock(&target->d_lock);
spin_unlock(&dentry->d_lock);
}
| 1,088 |
138,133 | 0 | const AXObject::AXObjectVector& AXObject::children() {
updateChildrenIfNecessary();
return m_children;
}
| 1,089 |
142,149 | 0 | virtual void CreateEntry(const AddEntriesMessage::TestEntryInfo& entry) {
CreateEntryImpl(entry, root_path().AppendASCII(entry.target_path));
}
| 1,090 |
158,286 | 0 | TouchEmulator* RenderWidgetHostImpl::GetTouchEmulator() {
if (!delegate_ || !delegate_->GetInputEventRouter())
return nullptr;
return delegate_->GetInputEventRouter()->GetTouchEmulator();
}
| 1,091 |
61,839 | 0 | static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
{
char *value = var_read_string(avctx->pb, size);
if (value)
av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL);
}
| 1,092 |
94,378 | 0 | static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
unsigned char *buffer)
{
unsigned char cmd[16];
struct scsi_sense_hdr sshdr;
int sense_valid = 0;
int the_result;
int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET;
unsigned int alignment;
unsigned long long lba;
unsigned sector_size;
if (sdp->no_read_capacity_16)
return -EINVAL;
do {
memset(cmd, 0, 16);
cmd[0] = SERVICE_ACTION_IN;
cmd[1] = SAI_READ_CAPACITY_16;
cmd[13] = RC16_LEN;
memset(buffer, 0, RC16_LEN);
the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE,
buffer, RC16_LEN, &sshdr,
SD_TIMEOUT, SD_MAX_RETRIES, NULL);
if (media_not_present(sdkp, &sshdr))
return -ENODEV;
if (the_result) {
sense_valid = scsi_sense_valid(&sshdr);
if (sense_valid &&
sshdr.sense_key == ILLEGAL_REQUEST &&
(sshdr.asc == 0x20 || sshdr.asc == 0x24) &&
sshdr.ascq == 0x00)
/* Invalid Command Operation Code or
* Invalid Field in CDB, just retry
* silently with RC10 */
return -EINVAL;
if (sense_valid &&
sshdr.sense_key == UNIT_ATTENTION &&
sshdr.asc == 0x29 && sshdr.ascq == 0x00)
/* Device reset might occur several times,
* give it one more chance */
if (--reset_retries > 0)
continue;
}
retries--;
} while (the_result && retries);
if (the_result) {
sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n");
read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
return -EINVAL;
}
sector_size = get_unaligned_be32(&buffer[8]);
lba = get_unaligned_be64(&buffer[0]);
sd_read_protection_type(sdkp, buffer);
if ((sizeof(sdkp->capacity) == 4) && (lba >= 0xffffffffULL)) {
sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
"kernel compiled with support for large block "
"devices.\n");
sdkp->capacity = 0;
return -EOVERFLOW;
}
/* Logical blocks per physical block exponent */
sdkp->physical_block_size = (1 << (buffer[13] & 0xf)) * sector_size;
/* Lowest aligned logical block */
alignment = ((buffer[14] & 0x3f) << 8 | buffer[15]) * sector_size;
blk_queue_alignment_offset(sdp->request_queue, alignment);
if (alignment && sdkp->first_scan)
sd_printk(KERN_NOTICE, sdkp,
"physical block alignment offset: %u\n", alignment);
if (buffer[14] & 0x80) { /* LBPME */
sdkp->lbpme = 1;
if (buffer[14] & 0x40) /* LBPRZ */
sdkp->lbprz = 1;
sd_config_discard(sdkp, SD_LBP_WS16);
}
sdkp->capacity = lba + 1;
return sector_size;
}
| 1,093 |
161,402 | 0 | void ServiceWorkerHandler::ClearForceUpdate() {
if (context_)
context_->SetForceUpdateOnPageLoad(false);
}
| 1,094 |
27,412 | 0 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
u8 *type, u8 *code, int *msg, __u32 *info, int offset)
{
struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data;
struct ip6_tnl *t;
int rel_msg = 0;
u8 rel_type = ICMPV6_DEST_UNREACH;
u8 rel_code = ICMPV6_ADDR_UNREACH;
__u32 rel_info = 0;
__u16 len;
int err = -ENOENT;
/* If the packet doesn't contain the original IPv6 header we are
in trouble since we might need the source address for further
processing of the error. */
rcu_read_lock();
if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->daddr,
&ipv6h->saddr)) == NULL)
goto out;
if (t->parms.proto != ipproto && t->parms.proto != 0)
goto out;
err = 0;
switch (*type) {
__u32 teli;
struct ipv6_tlv_tnl_enc_lim *tel;
__u32 mtu;
case ICMPV6_DEST_UNREACH:
if (net_ratelimit())
printk(KERN_WARNING
"%s: Path to destination invalid "
"or inactive!\n", t->parms.name);
rel_msg = 1;
break;
case ICMPV6_TIME_EXCEED:
if ((*code) == ICMPV6_EXC_HOPLIMIT) {
if (net_ratelimit())
printk(KERN_WARNING
"%s: Too small hop limit or "
"routing loop in tunnel!\n",
t->parms.name);
rel_msg = 1;
}
break;
case ICMPV6_PARAMPROB:
teli = 0;
if ((*code) == ICMPV6_HDR_FIELD)
teli = parse_tlv_tnl_enc_lim(skb, skb->data);
if (teli && teli == *info - 2) {
tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
if (tel->encap_limit == 0) {
if (net_ratelimit())
printk(KERN_WARNING
"%s: Too small encapsulation "
"limit or routing loop in "
"tunnel!\n", t->parms.name);
rel_msg = 1;
}
} else if (net_ratelimit()) {
printk(KERN_WARNING
"%s: Recipient unable to parse tunneled "
"packet!\n ", t->parms.name);
}
break;
case ICMPV6_PKT_TOOBIG:
mtu = *info - offset;
if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU;
t->dev->mtu = mtu;
if ((len = sizeof (*ipv6h) + ntohs(ipv6h->payload_len)) > mtu) {
rel_type = ICMPV6_PKT_TOOBIG;
rel_code = 0;
rel_info = mtu;
rel_msg = 1;
}
break;
}
*type = rel_type;
*code = rel_code;
*info = rel_info;
*msg = rel_msg;
out:
rcu_read_unlock();
return err;
}
| 1,095 |
96,965 | 0 | static struct page *new_non_cma_page(struct page *page, unsigned long private)
{
/*
* We want to make sure we allocate the new page from the same node
* as the source page.
*/
int nid = page_to_nid(page);
/*
* Trying to allocate a page for migration. Ignore allocation
* failure warnings. We don't force __GFP_THISNODE here because
* this node here is the node where we have CMA reservation and
* in some case these nodes will have really less non movable
* allocation memory.
*/
gfp_t gfp_mask = GFP_USER | __GFP_NOWARN;
if (PageHighMem(page))
gfp_mask |= __GFP_HIGHMEM;
#ifdef CONFIG_HUGETLB_PAGE
if (PageHuge(page)) {
struct hstate *h = page_hstate(page);
/*
* We don't want to dequeue from the pool because pool pages will
* mostly be from the CMA region.
*/
return alloc_migrate_huge_page(h, gfp_mask, nid, NULL);
}
#endif
if (PageTransHuge(page)) {
struct page *thp;
/*
* ignore allocation failure warnings
*/
gfp_t thp_gfpmask = GFP_TRANSHUGE | __GFP_NOWARN;
/*
* Remove the movable mask so that we don't allocate from
* CMA area again.
*/
thp_gfpmask &= ~__GFP_MOVABLE;
thp = __alloc_pages_node(nid, thp_gfpmask, HPAGE_PMD_ORDER);
if (!thp)
return NULL;
prep_transhuge_page(thp);
return thp;
}
return __alloc_pages_node(nid, gfp_mask, 0);
}
| 1,096 |
113,331 | 0 | StatisticsCB NewStatisticsCB() {
return base::Bind(&MockStatisticsCB::OnStatistics,
base::Unretained(&statistics_cb_));
}
| 1,097 |
168,634 | 0 | void StartUpgrade() {
connection_ = db_->CreateConnection(pending_->database_callbacks,
pending_->child_process_id);
DCHECK_EQ(db_->connections_.count(connection_.get()), 1UL);
std::vector<int64_t> object_store_ids;
IndexedDBTransaction* transaction = db_->CreateTransaction(
pending_->transaction_id, connection_.get(), object_store_ids,
blink::kWebIDBTransactionModeVersionChange);
DCHECK(db_->transaction_coordinator_.IsRunningVersionChangeTransaction());
transaction->ScheduleTask(
base::BindOnce(&IndexedDBDatabase::VersionChangeOperation, db_,
pending_->version, pending_->callbacks));
}
| 1,098 |
14,806 | 0 | ftp_readline(ftpbuf_t *ftp)
{
long size, rcvd;
char *data, *eol;
/* shift the extra to the front */
size = FTP_BUFSIZE;
rcvd = 0;
if (ftp->extra) {
memmove(ftp->inbuf, ftp->extra, ftp->extralen);
rcvd = ftp->extralen;
}
data = ftp->inbuf;
do {
size -= rcvd;
for (eol = data; rcvd; rcvd--, eol++) {
if (*eol == '\r') {
*eol = 0;
ftp->extra = eol + 1;
if (rcvd > 1 && *(eol + 1) == '\n') {
ftp->extra++;
rcvd--;
}
if ((ftp->extralen = --rcvd) == 0) {
ftp->extra = NULL;
}
return 1;
} else if (*eol == '\n') {
*eol = 0;
ftp->extra = eol + 1;
if ((ftp->extralen = --rcvd) == 0) {
ftp->extra = NULL;
}
return 1;
}
}
data = eol;
if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) {
return 0;
}
} while (size);
return 0;
}
| 1,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.