type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/rmap.h>
includes
#include <linux/mmzone.h>
includes
#include <linux/hugetlb.h>
includes
#include <linux/memcontrol.h>
includes
#include <linux/mm_inline.h>
functions
int can_do_mlock(void) { if (capable(CAP_IPC_LOCK)) return 1; if (rlimit(RLIMIT_MEMLOCK) != 0) return 1; return 0; }
functions
void clear_page_mlock(struct page *page) { if (!TestClearPageMlocked(page)) return; mod_zone_page_state(page_zone(page), NR_MLOCK, -hpage_nr_pages(page)); count_vm_event(UNEVICTABLE_PGCLEARED); if (!isolate_lru_page(page)) { putback_lru_page(page); }
functions
void mlock_vma_page(struct page *page) { /* Serialize with page migration */ BUG_ON(!PageLocked(page)); if (!TestSetPageMlocked(page)) { mod_zone_page_state(page_zone(page), NR_MLOCK, hpage_nr_pages(page)); count_vm_event(UNEVICTABLE_PGMLOCKED); if (!isolate_lru_page(page)) putback_lru_page(page); ...
functions
bool __munlock_isolate_lru_page(struct page *page, bool getpage) { if (PageLRU(page)) { struct lruvec *lruvec; lruvec = mem_cgroup_page_lruvec(page, page_zone(page)); if (getpage) get_page(page); ClearPageLRU(page); del_page_from_lru_list(page, lruvec, page_lru(page)); return true; }
functions
void __munlock_isolated_page(struct page *page) { int ret = SWAP_AGAIN; /* * Optimization: if the page was mapped just once, that's our mapping * and we don't need to check all the other vmas. */ if (page_mapcount(page) > 1) ret = try_to_munlock(page); /* Did try_to_unlock() succeed or punt? */ if (ret !...
functions
void __munlock_isolation_failed(struct page *page) { if (PageUnevictable(page)) __count_vm_event(UNEVICTABLE_PGSTRANDED); else __count_vm_event(UNEVICTABLE_PGMUNLOCKED); }
functions
int munlock_vma_page(struct page *page) { unsigned int nr_pages; struct zone *zone = page_zone(page); /* For try_to_munlock() and to serialize with page migration */ BUG_ON(!PageLocked(page)); /* * Serialize with any parallel __split_huge_page_refcount() which * might otherwise copy PageMlocked to part of th...
functions
long __mlock_vma_pages_range(struct vm_area_struct *vma, unsigned long start, unsigned long end, int *nonblocking) { struct mm_struct *mm = vma->vm_mm; unsigned long nr_pages = (end - start) / PAGE_SIZE; int gup_flags; VM_BUG_ON(start & ~PAGE_MASK); VM_BUG_ON(end & ~PAGE_MASK); VM_BUG_ON(start < vma->vm_star...
functions
int __mlock_posix_error_return(long retval) { if (retval == -EFAULT) retval = -ENOMEM; else if (retval == -ENOMEM) retval = -EAGAIN; return retval; }
functions
bool __putback_lru_fast_prepare(struct page *page, struct pagevec *pvec, int *pgrescued) { VM_BUG_ON_PAGE(PageLRU(page), page); VM_BUG_ON_PAGE(!PageLocked(page), page); if (page_mapcount(page) <= 1 && page_evictable(page)) { pagevec_add(pvec, page); if (TestClearPageUnevictable(page)) (*pgrescued)++; unl...
functions
void __putback_lru_fast(struct pagevec *pvec, int pgrescued) { count_vm_events(UNEVICTABLE_PGMUNLOCKED, pagevec_count(pvec)); /* *__pagevec_lru_add() calls release_pages() so we don't call * put_page() explicitly */ __pagevec_lru_add(pvec); count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued); }
functions
void __munlock_pagevec(struct pagevec *pvec, struct zone *zone) { int i; int nr = pagevec_count(pvec); int delta_munlocked; struct pagevec pvec_putback; int pgrescued = 0; pagevec_init(&pvec_putback, 0); /* Phase 1: page isolation */ spin_lock_irq(&zone->lru_lock); for (i = 0; i < nr; i++) { struct page *p...
functions
long __munlock_pagevec_fill(struct pagevec *pvec, struct vm_area_struct *vma, int zoneid, unsigned long start, unsigned long end) { pte_t *pte; spinlock_t *ptl; /* * Initialize pte walk starting at the already pinned page where we * are sure that there is a pte, as it was pinned under the same * mmap_sem ...
functions
void munlock_vma_pages_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { vma->vm_flags &= ~VM_LOCKED; while (start < end) { struct page *page = NULL; unsigned int page_mask; unsigned long page_increm; struct pagevec pvec; struct zone *zone; int zoneid; pagevec_init(&p...
functions
int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, vm_flags_t newflags) { struct mm_struct *mm = vma->vm_mm; pgoff_t pgoff; int nr_pages; int ret = 0; int lock = !!(newflags & VM_LOCKED); if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL)...
functions
int do_mlock(unsigned long start, size_t len, int on) { unsigned long nstart, end, tmp; struct vm_area_struct * vma, * prev; int error; VM_BUG_ON(start & ~PAGE_MASK); VM_BUG_ON(len != PAGE_ALIGN(len)); end = start + len; if (end < start) return -EINVAL; if (end == start) return 0; vma = find_vma(current->...
functions
int __mm_populate(unsigned long start, unsigned long len, int ignore_errors) { struct mm_struct *mm = current->mm; unsigned long end, nstart, nend; struct vm_area_struct *vma = NULL; int locked = 0; long ret = 0; VM_BUG_ON(start & ~PAGE_MASK); VM_BUG_ON(len != PAGE_ALIGN(len)); end = start + len; for (nstart...
functions
int do_mlockall(int flags) { struct vm_area_struct * vma, * prev = NULL; if (flags & MCL_FUTURE) current->mm->def_flags |= VM_LOCKED; else current->mm->def_flags &= ~VM_LOCKED; if (flags == MCL_FUTURE) goto out; for (vma = current->mm->mmap; vma ; vma = prev->vm_next) { vm_flags_t newflags; newflags =...
functions
int user_shm_lock(size_t size, struct user_struct *user) { unsigned long lock_limit, locked; int allowed = 0; locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; lock_limit = rlimit(RLIMIT_MEMLOCK); if (lock_limit == RLIM_INFINITY) allowed = 1; lock_limit >>= PAGE_SHIFT; spin_lock(&shmlock_user_lock); if (!allowe...
functions
void user_shm_unlock(size_t size, struct user_struct *user) { spin_lock(&shmlock_user_lock); user->locked_shm -= (size + PAGE_SIZE - 1) >> PAGE_SHIFT; spin_unlock(&shmlock_user_lock); free_uid(user); }
includes
#include <errno.h>
functions
int symlink(const char *target, const char *linkpath) { int ret = syscall2(int, SYS_SYMLINK, target, linkpath); if (ret < 0) { errno = -ret; ret = -1; }
functions
int readlink(const char *pathname, char *buf, size_t bufsize) { int ret = syscall3(int, SYS_READLINK, pathname, buf, bufsize); if (ret < 0) { errno = -ret; return -1; }
functions
int link(const char *oldpath, const char *newpath) { int ret = syscall2(int, SYS_LINK, oldpath, newpath); if (ret < 0) { errno = -ret; return -1; }
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <sys/time.h>
includes
#include <unistd.h>
includes
#include <curl/curl.h>
main
int main(void) { CURL *http_handle; CURL *http_handle2; CURLM *multi_handle; int still_running; /* keep number of running handles */ http_handle = curl_easy_init(); http_handle2 = curl_easy_init(); /* set options */ curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); /* set opti...
includes
#include <linux/init.h>
includes
#include <linux/delay.h>
includes
#include <linux/slab.h>
includes
#include <linux/pci.h>
includes
#include <linux/mutex.h>
includes
#include <sound/core.h>
includes
#include <sound/asoundef.h>
includes
#include <sound/tlv.h>
includes
#include <sound/initval.h>
includes
#include <sound/hda_hwdep.h>
defines
#define snd_hda_bus_dev_register NULL
defines
#define is_generic_config(codec) \
defines
#define is_generic_config(codec) 0
defines
#define HDA_MODREQ_MAX_COUNT 2 /* two request_modules()'s */
defines
#define HDA_MODREQ_MAX_COUNT 0 /* all presets are statically linked */
defines
#define HDA_HASH_KEY(nid, dir, idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24))
defines
#define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24))
defines
#define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24))
defines
#define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24))
defines
#define INFO_AMP_CAPS (1<<0)
defines
#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
defines
#define AMP_VAL_IDX_SHIFT 19
defines
#define AMP_VAL_IDX_MASK (0x0f<<19)
defines
#define snd_hda_spdif_out_switch_info snd_ctl_boolean_mono_info
defines
#define snd_hda_spdif_in_switch_info snd_hda_spdif_out_switch_info
defines
#define build_cmd_cache_key(nid, verb) ((verb << 8) | nid)
defines
#define get_cmd_cache_nid(key) ((key) & 0xff)
defines
#define get_cmd_cache_cmd(key) (((key) >> 8) & 0xffff)
defines
#define HDA_RATE(base, mult, div) \
defines
#define AC_PAR_PCM_RATE_BITS 11
defines
#define power_save(codec) \
structs
struct hda_vendor_id { unsigned int id; const char *name; };
structs
struct hda_cvt_setup { hda_nid_t nid; u8 stream_tag; u8 channel_id; u16 format_id; unsigned char active; /* cvt is currently used */ unsigned char dirty; /* setups should be cleared */ };
structs
struct hda_rate_tbl { unsigned int hz; unsigned int alsa_bits; unsigned int hda_fmt; };
functions
int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) { mutex_lock(&preset_mutex); list_add_tail(&preset->list, &hda_preset_tables); mutex_unlock(&preset_mutex); return 0; }
functions
int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) { mutex_lock(&preset_mutex); list_del(&preset->list); mutex_unlock(&preset_mutex); return 0; }
functions
void hda_keep_power_on(struct hda_codec *codec) {}
functions
int make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, unsigned int verb, unsigned int parm) { u32 val; if ((codec->addr & ~0xf) || (direct & ~1) || (nid & ~0x7f) || (verb & ~0xfff) || (parm & ~0xffff)) { printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n", codec->a...
functions
int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, unsigned int *res) { struct hda_bus *bus = codec->bus; int err; if (cmd == ~0) return -1; if (res) *res = -1; again: snd_hda_power_up(codec); mutex_lock(&bus->cmd_mutex); err = bus->ops.command(bus, cmd); if (!err && res) *res = bus->...
functions
int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, int direct, unsigned int verb, unsigned int parm) { unsigned cmd = make_codec_cmd(codec, nid, direct, verb, parm); unsigned int res; codec_exec_verb(codec, cmd, &res); return res; }
functions
int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, unsigned int verb, unsigned int parm) { unsigned int cmd = make_codec_cmd(codec, nid, direct, verb, parm); unsigned int res; return codec_exec_verb(codec, cmd, codec->bus->sync_write ? &res : NULL); }
functions
void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq) { for (; seq->nid; seq++) snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); }
functions
int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *start_id) { unsigned int parm; parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT); if (parm == -1) return 0; *start_id = (parm >> 16) & 0x7fff; return (int)(parm & 0x7fff); }
functions
int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *conn_list, int max_conns) { unsigned int parm; int i, conn_len, conns; unsigned int shift, num_elems, mask; unsigned int wcaps; hda_nid_t prev_nid; if (snd_BUG_ON(!conn_list || max_conns <= 0)) return -EINVAL; wcaps = get_w...
functions
int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) { struct hda_bus_unsolicited *unsol; unsigned int wp; unsol = bus->unsol; if (!unsol) return 0; wp = (unsol->wp + 1) % HDA_UNSOL_QUEUE_SIZE; unsol->wp = wp; wp <<= 1; unsol->queue[wp] = res; unsol->queue[wp + 1] = res_ex; queue_work...
functions
void process_unsol_events(struct work_struct *work) { struct hda_bus_unsolicited *unsol = container_of(work, struct hda_bus_unsolicited, work); struct hda_bus *bus = unsol->bus; struct hda_codec *codec; unsigned int rp, caddr, res; while (unsol->rp != unsol->wp) { rp = (unsol->rp + 1) % HDA_UNSOL_QUEUE_SIZE; ...
functions
int init_unsol_queue(struct hda_bus *bus) { struct hda_bus_unsolicited *unsol; if (bus->unsol) /* already initialized */ return 0; unsol = kzalloc(sizeof(*unsol), GFP_KERNEL); if (!unsol) { snd_printk(KERN_ERR "hda_codec: " "can't allocate unsolicited queue\n"); return -ENOMEM; }
functions
int snd_hda_bus_free(struct hda_bus *bus) { struct hda_codec *codec, *n; if (!bus) return 0; if (bus->workq) flush_workqueue(bus->workq); if (bus->unsol) kfree(bus->unsol); list_for_each_entry_safe(codec, n, &bus->codec_list, list) { snd_hda_codec_free(codec); }
functions
int snd_hda_bus_dev_free(struct snd_device *device) { struct hda_bus *bus = device->device_data; bus->shutdown = 1; return snd_hda_bus_free(bus); }
functions
int snd_hda_bus_dev_register(struct snd_device *device) { struct hda_bus *bus = device->device_data; struct hda_codec *codec; list_for_each_entry(codec, &bus->codec_list, list) { snd_hda_hwdep_add_sysfs(codec); snd_hda_hwdep_add_power_sysfs(codec); }
functions
int get_codec_name(struct hda_codec *codec) { const struct hda_vendor_id *c; const char *vendor = NULL; u16 vendor_id = codec->vendor_id >> 16; char tmp[16]; if (codec->vendor_name) goto get_chip_name; for (c = hda_vendor_ids; c->id; c++) { if (c->id == vendor_id) { vendor = c->name; break; }
functions
int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node) { int i; hda_nid_t nid; codec->num_nodes = snd_hda_get_sub_nodes(codec, fg_node, &codec->start_nid); codec->wcaps = kmalloc(codec->num_nodes * 4, GFP_KERNEL); if (!codec->wcaps) return -ENOMEM; nid = codec->start_nid; for (i = 0; i < code...
functions
int read_pin_defaults(struct hda_codec *codec) { int i; hda_nid_t nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { struct hda_pincfg *pin; unsigned int wcaps = get_wcaps(codec, nid); unsigned int wid_type = get_wcaps_type(wcaps); if (wid_type != AC_WID_PIN) continue; pin = snd_ar...
functions
void set_pincfg(struct hda_codec *codec, hda_nid_t nid, unsigned int cfg) { int i; for (i = 0; i < 4; i++) { snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, cfg & 0xff); cfg >>= 8; }
functions
int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, hda_nid_t nid, unsigned int cfg) { struct hda_pincfg *pin; unsigned int oldcfg; if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) return -EINVAL; oldcfg = snd_hda_codec_get_pincfg(codec, nid); pin = look_up_pincfg(codec, li...
functions
int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, unsigned int cfg) { return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); }
functions
int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) { struct hda_pincfg *pin; #ifdef CONFIG_SND_HDA_HWDEP pin = look_up_pincfg(codec, &codec->user_pins, nid); if (pin) return pin->cfg; #endif pin = look_up_pincfg(codec, &codec->driver_pins, nid); if (pin) return pin->cfg; pin = look_up_pincf...
functions
void restore_pincfgs(struct hda_codec *codec) { int i; for (i = 0; i < codec->init_pins.used; i++) { struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); set_pincfg(codec, pin->nid, snd_hda_codec_get_pincfg(codec, pin->nid)); }
functions
void snd_hda_shutup_pins(struct hda_codec *codec) { int i; /* don't shut up pins when unloading the driver; otherwise it breaks * the default pin setup at the next load of the driver */ if (codec->bus->shutdown) return; for (i = 0; i < codec->init_pins.used; i++) { struct hda_pincfg *pin = snd_array_elem(&c...
functions
void restore_shutup_pins(struct hda_codec *codec) { int i; if (!codec->pins_shutup) return; if (codec->bus->shutdown) return; for (i = 0; i < codec->init_pins.used; i++) { struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); snd_hda_codec_write(codec, pin->nid, 0, AC_VERB_SET_PIN_WIDGET_CO...
functions
void restore_init_pincfgs(struct hda_codec *codec) { /* first free driver_pins and user_pins, then call restore_pincfg * so that only the values in init_pins are restored */ snd_array_free(&codec->driver_pins); #ifdef CONFIG_SND_HDA_HWDEP snd_array_free(&codec->user_pins); #endif restore_pincfgs(codec); snd_ar...
functions
void snd_hda_codec_free(struct hda_codec *codec) { if (!codec) return; restore_init_pincfgs(codec); #ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); flush_workqueue(codec->bus->workq); #endif list_del(&codec->list); snd_array_free(&codec->mixers); snd_array_free(&codec->nids); codec->...
functions
int snd_hda_codec_configure(struct hda_codec *codec) { int err; codec->preset = find_codec_preset(codec); if (!codec->vendor_name || !codec->chip_name) { err = get_codec_name(codec); if (err < 0) return err; }
functions
void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format) { struct hda_codec *c; struct hda_cvt_setup *p; unsigned int oldval, newval; int type; int i; if (!nid) return; snd_printdd("hda_codec_setup_stream: " "NID=0x%x, stream=0x%x, chan...
functions
void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, int do_now) { struct hda_cvt_setup *p; if (!nid) return; if (codec->no_sticky_stream) do_now = 1; snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); p = get_hda_cvt_setup(codec, nid); if (p) { /* here we just clear...