⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 params.c

📁 linux下的pci设备浏览工具
💻 C
字号:
/* *	The PCI Library -- Parameters * *	Copyright (c) 2008 Martin Mares <mj@ucw.cz> * *	Can be freely distributed and used under the terms of the GNU GPL. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include "internal.h"char *pci_get_param(struct pci_access *acc, char *param){  struct pci_param *p;  for (p=acc->params; p; p=p->next)    if (!strcmp(p->param, param))      return p->value;  return NULL;}voidpci_define_param(struct pci_access *acc, char *param, char *value, char *help){  struct pci_param *p = pci_malloc(acc, sizeof(*p));  p->next = acc->params;  acc->params = p;  p->param = param;  p->value = value;  p->value_malloced = 0;  p->help = help;}intpci_set_param_internal(struct pci_access *acc, char *param, char *value, int copy){  struct pci_param *p;  for (p=acc->params; p; p=p->next)    if (!strcmp(p->param, param))      {	if (p->value_malloced)	  pci_mfree(p->value);	p->value_malloced = copy;	if (copy)	  p->value = pci_strdup(acc, value);	else	  p->value = value;	return 0;      }  return -1;}intpci_set_param(struct pci_access *acc, char *param, char *value){  return pci_set_param_internal(acc, param, value, 1);}voidpci_free_params(struct pci_access *acc){  struct pci_param *p;  while (p = acc->params)    {      acc->params = p->next;      if (p->value_malloced)	pci_mfree(p->value);      pci_mfree(p);    }}struct pci_param *pci_walk_params(struct pci_access *acc, struct pci_param *prev){  /* So far, the params form a simple linked list, but this can change in the future */  if (!prev)    return acc->params;  else    return prev->next;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -