• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PDE_DATA函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PDE_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ PDE_DATA函数的具体用法?C++ PDE_DATA怎么用?C++ PDE_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PDE_DATA函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: proc_bus_pci_write

static ssize_t
proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos)
{
    struct inode *ino = file_inode(file);
    struct pci_dev *dev = PDE_DATA(ino);
    int pos = *ppos;
    int size = dev->cfg_size;
    int cnt;

    if (pos >= size)
        return 0;
    if (nbytes >= size)
        nbytes = size;
    if (pos + nbytes > size)
        nbytes = size - pos;
    cnt = nbytes;

    if (!access_ok(VERIFY_READ, buf, cnt))
        return -EINVAL;

    pci_config_pm_runtime_get(dev);

    if ((pos & 1) && cnt) {
        unsigned char val;
        __get_user(val, buf);
        pci_user_write_config_byte(dev, pos, val);
        buf++;
        pos++;
        cnt--;
    }

    if ((pos & 3) && cnt > 2) {
        __le16 val;
        __get_user(val, (__le16 __user *) buf);
        pci_user_write_config_word(dev, pos, le16_to_cpu(val));
        buf += 2;
        pos += 2;
        cnt -= 2;
    }

    while (cnt >= 4) {
        __le32 val;
        __get_user(val, (__le32 __user *) buf);
        pci_user_write_config_dword(dev, pos, le32_to_cpu(val));
        buf += 4;
        pos += 4;
        cnt -= 4;
    }

    if (cnt >= 2) {
        __le16 val;
        __get_user(val, (__le16 __user *) buf);
        pci_user_write_config_word(dev, pos, le16_to_cpu(val));
        buf += 2;
        pos += 2;
        cnt -= 2;
    }

    if (cnt) {
        unsigned char val;
        __get_user(val, buf);
        pci_user_write_config_byte(dev, pos, val);
        buf++;
        pos++;
        cnt--;
    }

    pci_config_pm_runtime_put(dev);

    *ppos = pos;
    i_size_write(ino, dev->cfg_size);
    return nbytes;
}
开发者ID:ricardoanguiano,项目名称:linux-xlnx,代码行数:73,代码来源:proc.c


示例2: rpc_proc_open

static int rpc_proc_open(struct inode *inode, struct file *file)
{
	return single_open(file, rpc_proc_show, PDE_DATA(inode));
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:4,代码来源:stats.c


示例3: uf_proc_open

static int uf_proc_open(struct inode *inode, struct file *file)
{
	return single_open_size(file, uf_proc_show, PDE_DATA(inode),
				UNIFI_DEBUG_TXT_BUFFER);
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:5,代码来源:io.c


示例4: snmp6_dev_seq_open

static int snmp6_dev_seq_open(struct inode *inode, struct file *file)
{
	return single_open(file, snmp6_dev_seq_show, PDE_DATA(inode));
}
开发者ID:MaxChina,项目名称:linux,代码行数:4,代码来源:proc.c


示例5: mic_dma_reg_show


//.........这里部分代码省略.........

	for (i = first_dma_chan(); i <= last_dma_chan(); i++) {
		curr_chan = &dma_ctx->dma_channels[i];
		chan_num = curr_chan->ch_num;
		dtpr = md_mic_dma_read_mmio(dma_dev, chan_num, REG_DTPR);
		seq_printf(m,  "Channel %i: [", chan_num);
		size = ((int) md_mic_dma_read_mmio(dma_dev, chan_num, REG_DHPR)
			- dtpr) % curr_chan->chan->num_desc_in_ring;
		/*
		 * In KNC B0, empty condition is tail = head -1
		 */
		if (mic_hw_family(dma_ctx->device_num) == FAMILY_KNC &&
			mic_hw_stepping(dma_ctx->device_num) >= KNC_B0_STEP)
			size -= 1;

		for (j = 0; j < size; j++) {
			desc = curr_chan->desc_ring[(j+dtpr) % 
				curr_chan->chan->num_desc_in_ring];	

			switch (desc.desc.nop.type){
			case NOP:
				seq_printf(m," {Type: NOP, 0x%#llx"
					" %#llx} ",  desc.qwords.qw0,
						   desc.qwords.qw1);
			case MEMCOPY:
				seq_printf(m," {Type: MEMCOPY, SAP:"
					" 0x%#llx, DAP: %#llx, length: %#llx} ",
					  (uint64_t) desc.desc.memcopy.sap,
					  (uint64_t) desc.desc.memcopy.dap,
					  (uint64_t) desc.desc.memcopy.length);
				break;
			case STATUS:
				seq_printf(m," {Type: STATUS, data:"
					" 0x%#llx, DAP: %#llx, intr: %lli} ",
					(uint64_t) desc.desc.status.data,
					(uint64_t) desc.desc.status.dap,
					(uint64_t) desc.desc.status.intr);
				break;
			case GENERAL:
				seq_printf(m," {Type: GENERAL, "
					"DAP: %#llx, dword: %#llx} ",
					(uint64_t) desc.desc.general.dap,
					(uint64_t) desc.desc.general.data);
				break;
			case KEYNONCECNT:
				seq_printf(m," {Type: KEYNONCECNT, sel: "
					"%lli, h: %lli, index: %lli, cs: %lli,"
					" value: %#llx} ",
						(uint64_t) desc.desc.keynoncecnt.sel,
						(uint64_t) desc.desc.keynoncecnt.h,
						(uint64_t) desc.desc.keynoncecnt.index,
						(uint64_t) desc.desc.keynoncecnt.cs,
						(uint64_t) desc.desc.keynoncecnt.data);
				break;
			case KEY:
				seq_printf(m," {Type: KEY, dest_ind"
					   "ex: %lli, ski: %lli, skap: %#llx ",
						(uint64_t) desc.desc.key.di,
						(uint64_t) desc.desc.key.ski,
						(uint64_t) desc.desc.key.skap);
				break;
			default:
				seq_printf(m," {Uknown Type=%lli ,"
				 "%#llx %#llx} ",(uint64_t)  desc.desc.nop.type,
						(uint64_t) desc.qwords.qw0,
						(uint64_t) desc.qwords.qw1);
			}
		}
		seq_printf(m,  "]\n");
		if (mic_hw_family(dma_ctx->device_num) == FAMILY_KNC &&
		    mic_hw_stepping(dma_ctx->device_num) >= KNC_B0_STEP &&
		    curr_chan->chan->dstat_wb_loc)
			seq_printf(m, "DSTAT_WB = 0x%x\n",
				*((uint32_t*)curr_chan->chan->dstat_wb_loc));
	}
	return 0;
}

static int mic_dma_reg_open(struct inode *inode, struct file *file)
{
	return single_open(file, mic_dma_reg_show, PDE_DATA(inode));
}

static const struct file_operations mic_dma_reg_fops = {
	.owner   = THIS_MODULE,
	.open    = mic_dma_reg_open,
	.read    = seq_read,
	.llseek  = seq_lseek,
	.release = single_release
};

static void
mic_dma_proc_init(struct mic_dma_ctx_t *dma_ctx)
{
	char name[64];
	snprintf(name, 63, "%s%d", proc_dma_ring, dma_ctx->device_num);
	proc_create_data(name,  S_IFREG | S_IRUGO, NULL, &mic_dma_ring_fops, dma_ctx);
	snprintf(name, 63, "%s%d", proc_dma_reg, dma_ctx->device_num);
	proc_create_data(name,  S_IFREG | S_IRUGO, NULL, &mic_dma_reg_fops, dma_ctx);
}
开发者ID:NakamuraK,项目名称:mpss-modules,代码行数:101,代码来源:mic_dma_lib.c


示例6: pfq_proc_stats_open

static int pfq_proc_stats_open(struct inode *inode, struct file *file)
{
	return single_open(file, pfq_proc_stats, PDE_DATA(inode));
}
开发者ID:bullno1,项目名称:PFQ,代码行数:4,代码来源:pf_q-proc.c


示例7: acpi_button_state_open_fs

static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
{
	return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode));
}
开发者ID:daveyoung,项目名称:linux,代码行数:4,代码来源:button.c


示例8: _cl_bcct_open

static int _cl_bcct_open(struct inode *inode, struct file *file)
{
	return single_open(file, _cl_bcct_read, PDE_DATA(inode));
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:4,代码来源:mtk_cooler_bcct.c


示例9: ipsec_proc_open

static int ipsec_proc_open(struct inode *inode, struct file *file)
{
	struct ipsec_proc_list *it = PDE_DATA(inode);
    return single_open(file, it->proc_open, it->data);
}
开发者ID:dkg,项目名称:libreswan,代码行数:5,代码来源:ipsec_proc.c


示例10: video_proc_write

static ssize_t video_proc_write(struct file *file, const char __user *buf,
				size_t count, loff_t *pos)
{
	struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file));
	char *cmd, *buffer;
	int ret;
	int value;
	int remain = count;
	int lcd_out = -1;
	int crt_out = -1;
	int tv_out = -1;
	u32 video_out;

	cmd = kmalloc(count + 1, GFP_KERNEL);
	if (!cmd)
		return -ENOMEM;
	if (copy_from_user(cmd, buf, count)) {
		kfree(cmd);
		return -EFAULT;
	}
	cmd[count] = '\0';

	buffer = cmd;

	/* scan expression.  Multiple expressions may be delimited with ;
	 *
	 *  NOTE: to keep scanning simple, invalid fields are ignored
	 */
	while (remain) {
		if (sscanf(buffer, " lcd_out : %i", &value) == 1)
			lcd_out = value & 1;
		else if (sscanf(buffer, " crt_out : %i", &value) == 1)
			crt_out = value & 1;
		else if (sscanf(buffer, " tv_out : %i", &value) == 1)
			tv_out = value & 1;
		/* advance to one character past the next ; */
		do {
			++buffer;
			--remain;
		}
		while (remain && *(buffer - 1) != ';');
	}

	kfree(cmd);

	ret = get_video_status(dev, &video_out);
	if (!ret) {
		unsigned int new_video_out = video_out;
		if (lcd_out != -1)
			_set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out);
		if (crt_out != -1)
			_set_bit(&new_video_out, HCI_VIDEO_OUT_CRT, crt_out);
		if (tv_out != -1)
			_set_bit(&new_video_out, HCI_VIDEO_OUT_TV, tv_out);
		/* To avoid unnecessary video disruption, only write the new
		 * video setting if something changed. */
		if (new_video_out != video_out)
			ret = write_acpi_int(METHOD_VIDEO_OUT, new_video_out);
	}

	return ret ? ret : count;
}
开发者ID:Astralix,项目名称:mainline-dss11,代码行数:62,代码来源:toshiba_acpi.c


示例11: proc_fasttimer_open

static int proc_fasttimer_open(struct inode *inode, struct file *file)
{
	return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
}
开发者ID:Blopeur,项目名称:linux-heca,代码行数:4,代码来源:fasttimer.c


示例12: mdc_kuc_open

static int mdc_kuc_open(struct inode *inode, struct file *file)
{
	return single_open(file, NULL, PDE_DATA(inode));
}
开发者ID:Abioy,项目名称:kasan,代码行数:4,代码来源:lproc_mdc.c


示例13: proc_bus_pci_read

static ssize_t
proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
    struct pci_dev *dev = PDE_DATA(file_inode(file));
    unsigned int pos = *ppos;
    unsigned int cnt, size;

    /*
     * Normal users can read only the standardized portion of the
     * configuration space as several chips lock up when trying to read
     * undefined locations (think of Intel PIIX4 as a typical example).
     */

    if (capable(CAP_SYS_ADMIN))
        size = dev->cfg_size;
    else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
        size = 128;
    else
        size = 64;

    if (pos >= size)
        return 0;
    if (nbytes >= size)
        nbytes = size;
    if (pos + nbytes > size)
        nbytes = size - pos;
    cnt = nbytes;

    if (!access_ok(VERIFY_WRITE, buf, cnt))
        return -EINVAL;

    pci_config_pm_runtime_get(dev);

    if ((pos & 1) && cnt) {
        unsigned char val;
        pci_user_read_config_byte(dev, pos, &val);
        __put_user(val, buf);
        buf++;
        pos++;
        cnt--;
    }

    if ((pos & 3) && cnt > 2) {
        unsigned short val;
        pci_user_read_config_word(dev, pos, &val);
        __put_user(cpu_to_le16(val), (__le16 __user *) buf);
        buf += 2;
        pos += 2;
        cnt -= 2;
    }

    while (cnt >= 4) {
        unsigned int val;
        pci_user_read_config_dword(dev, pos, &val);
        __put_user(cpu_to_le32(val), (__le32 __user *) buf);
        buf += 4;
        pos += 4;
        cnt -= 4;
    }

    if (cnt >= 2) {
        unsigned short val;
        pci_user_read_config_word(dev, pos, &val);
        __put_user(cpu_to_le16(val), (__le16 __user *) buf);
        buf += 2;
        pos += 2;
        cnt -= 2;
    }

    if (cnt) {
        unsigned char val;
        pci_user_read_config_byte(dev, pos, &val);
        __put_user(val, buf);
        buf++;
        pos++;
        cnt--;
    }

    pci_config_pm_runtime_put(dev);

    *ppos = pos;
    return nbytes;
}
开发者ID:ricardoanguiano,项目名称:linux-xlnx,代码行数:83,代码来源:proc.c


示例14: proc_bus_pci_lseek

static loff_t
proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
{
    struct pci_dev *dev = PDE_DATA(file_inode(file));
    return fixed_size_llseek(file, off, whence, dev->cfg_size);
}
开发者ID:ricardoanguiano,项目名称:linux-xlnx,代码行数:6,代码来源:proc.c


示例15: bluesleep_open_proc_btwrite

static int bluesleep_open_proc_btwrite(struct inode *inode, struct file *file)
{
	return single_open(file, btwrite_proc_show, PDE_DATA(inode));

}
开发者ID:Eyeless95,项目名称:samsung_g531h_kernel,代码行数:5,代码来源:sprd_lpm.c


示例16: activity_stats_open

static int activity_stats_open(struct inode *inode, struct file *file)
{
    return single_open(file, activity_stats_show, PDE_DATA(inode));
}
开发者ID:qtekfun,项目名称:kernel_htc_msm8939,代码行数:4,代码来源:activity_stats.c


示例17: _mtk_cl_sd_rst_open

static int _mtk_cl_sd_rst_open(struct inode *inode, struct file *file)
{
	return single_open(file, _mtk_cl_sd_rst_read, PDE_DATA(inode));
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:4,代码来源:mtk_cooler_shutdown.c


示例18: r_open

static int r_open(struct inode *inode, struct file *file)
{
	return single_open(file, PDE_DATA(inode), 
				proc_get_parent_data(inode));
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:5,代码来源:procfs.c


示例19: segment_info_open_fs

static int segment_info_open_fs(struct inode *inode, struct file *file)
{
	return single_open(file, segment_info_seq_show, PDE_DATA(inode));
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:4,代码来源:super.c


示例20: fld_proc_cache_flush_open

static int fld_proc_cache_flush_open(struct inode *inode, struct file *file)
{
	file->private_data = PDE_DATA(inode);
	return 0;
}
开发者ID:7799,项目名称:linux,代码行数:5,代码来源:lproc_fld.c



注:本文中的PDE_DATA函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PDF_NAME函数代码示例发布时间:2022-05-30
下一篇:
C++ PDEBUG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap