当前位置: 首页>>代码示例>>C++>>正文


C++ KERNEL_VERSION函数代码示例

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


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

示例1: afalg_chk_platform

static int afalg_chk_platform(void)
{
    int ret;
    int i;
    int kver[3] = { -1, -1, -1 };
    char *str;
    struct utsname ut;

    ret = uname(&ut);
    if (ret != 0) {
        AFALGerr(AFALG_F_AFALG_CHK_PLATFORM,
                 AFALG_R_FAILED_TO_GET_PLATFORM_INFO);
        return 0;
    }

    str = strtok(ut.release, ".");
    for (i = 0; i < 3 && str != NULL; i++) {
        kver[i] = atoi(str);
        str = strtok(NULL, ".");
    }

    if (KERNEL_VERSION(kver[0], kver[1], kver[2])
        < KERNEL_VERSION(K_MAJ, K_MIN1, K_MIN2)) {
        ALG_ERR("ASYNC AFALG not supported this kernel(%d.%d.%d)\n",
                 kver[0], kver[1], kver[2]);
        ALG_ERR("ASYNC AFALG requires kernel version %d.%d.%d or later\n",
                 K_MAJ, K_MIN1, K_MIN2);
        AFALGerr(AFALG_F_AFALG_CHK_PLATFORM,
                 AFALG_R_KERNEL_DOES_NOT_SUPPORT_ASYNC_AFALG);
        return 0;
    }

    return 1;
}
开发者ID:AndyUI,项目名称:openssl,代码行数:34,代码来源:e_afalg.c

示例2: get_versiondep_info_x86_64

int
get_versiondep_info_x86_64(void)
{
	/*
	 * On linux-2.6.26, MAX_PHYSMEM_BITS is changed to 44 from 40.
	 */
	if (info->kernel_version < KERNEL_VERSION(2, 6, 26))
		info->max_physmem_bits  = _MAX_PHYSMEM_BITS_ORIG;
	else if (info->kernel_version < KERNEL_VERSION(2, 6, 31))
		info->max_physmem_bits  = _MAX_PHYSMEM_BITS_2_6_26;
	else
		info->max_physmem_bits  = _MAX_PHYSMEM_BITS_2_6_31;

	if (info->kernel_version < KERNEL_VERSION(2, 6, 27))
		info->page_offset = __PAGE_OFFSET_ORIG;
	else
		info->page_offset = __PAGE_OFFSET_2_6_27;

	if (info->kernel_version < KERNEL_VERSION(2, 6, 31)) {
		info->vmalloc_start = VMALLOC_START_ORIG;
		info->vmalloc_end   = VMALLOC_END_ORIG;
		info->vmemmap_start = VMEMMAP_START_ORIG;
		info->vmemmap_end   = VMEMMAP_END_ORIG;
	} else {
		info->vmalloc_start = VMALLOC_START_2_6_31;
		info->vmalloc_end   = VMALLOC_END_2_6_31;
		info->vmemmap_start = VMEMMAP_START_2_6_31;
		info->vmemmap_end   = VMEMMAP_END_2_6_31;
	}

	return TRUE;
}
开发者ID:karibou,项目名称:progit,代码行数:32,代码来源:x86_64.c

示例3: omap_v4l2_open

	INT32 omap_v4l2_open(struct inode *inode,struct file *file)
#endif
{
	INT32 err = 0;
	struct video_device *dev = video_devdata(file);
	cam_data *cam;
	FNRESLT ret_val;

	ret_val	= v4l2_base_struct(&cam,GET_ADDRESS);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		printk(KERN_ERR "Failed to get base node of camera device\n");
		TRACE_ERR_AND_RET(FAIL);		
	}
	
	if (cam	== NULL)
	{
		printk(KERN_ERR "Internal error, cam_data not found!\n");
		TRACE_ERR_AND_RET(-EBADF);
	}
	file->private_data = dev;

	strcpy(cam->v4l2_cap.driver, "omap_v4l2");
	cam->v4l2_cap.version		= KERNEL_VERSION(0, 1, 11);
	cam->v4l2_cap.capabilities 	=	V4L2_CAP_VIDEO_CAPTURE	|	\
						V4L2_CAP_READWRITE	|	\
						V4L2_CAP_STREAMING;

	cam->v4l2_cap.card[0]		= '\0';
	cam->v4l2_cap.bus_info[0]	= '\0';

	return err;
}
开发者ID:duns,项目名称:wpss-buildenv,代码行数:33,代码来源:omap_v4l2_fops_base.c

示例4: bb_init_module

int FAST_FUNC bb_init_module(const char *filename, const char *options)
{
	size_t len;
	char *image;
	int rc;

	if (!options)
		options = "";

#if ENABLE_FEATURE_2_4_MODULES
	if (get_linux_version_code() < KERNEL_VERSION(2,6,0))
		return bb_init_module_24(filename, options);
#endif

	/* Use the 2.6 way */
	len = INT_MAX - 4095;
	rc = ENOENT;
	image = xmalloc_open_zipped_read_close(filename, &len);
	if (image) {
		rc = 0;
		if (init_module(image, len, options) != 0)
			rc = errno;
		free(image);
	}

	return rc;
}
开发者ID:BackupTheBerlios,项目名称:openslx-svn,代码行数:27,代码来源:modutils.c

示例5: add_cmdline_param

static int add_cmdline_param(char *cmdline, uint64_t addr, char *cmdstr,
				char *byte)
{
	int cmdline_size, cmdlen, len, align = 1024;
	char str[COMMAND_LINE_SIZE], *ptr;

	/* Passing in =xxxK / =xxxM format. Saves space required in cmdline.*/
	switch (byte[0]) {
		case 'K':
			if (addr%align)
				return -1;
			addr = addr/align;
			break;
		case 'M':
			addr = addr/(align *align);
			break;
	}
	ptr = str;
	strcpy(str, cmdstr);
	ptr += strlen(str);
	ultoa(addr, ptr);
	strcat(str, byte);
	len = strlen(str);
	cmdlen = strlen(cmdline) + len;
	cmdline_size = (kernel_version() < KERNEL_VERSION(3, 15, 0) ?
			512 : COMMAND_LINE_SIZE);
	if (cmdlen > (cmdline_size - 1))
		die("Command line overflow\n");
	strcat(cmdline, str);
	dbgprintf("Command line after adding elfcorehdr: %s\n", cmdline);
	return 0;
}
开发者ID:horms,项目名称:kexec-tools,代码行数:32,代码来源:crashdump-ppc64.c

示例6: v4l_new_version

static OMX_BOOL v4l_new_version()
{
#if 0   // capability.version is not supported ???
	struct v4l2_capability v4l_cap;
	if (ioctl(NULL, VIDIOC_QUERYCAP, &v4l_cap) < 0)
	{
		LOG_ERROR("set output failed\n");
		return OMX_FALSE;
	}
	if(v4l_cap.version>=KERNEL_VERSION(2,6,38))
	{
		return OMX_TRUE;
	}
	else
	{
		return OMX_FALSE;
	}
#else  //FIMXE: find better way to identify the v4l version 
	OMX_S32 v4l_dev;
	v4l_dev=open("/dev/video17", O_RDWR | O_NONBLOCK, 0);
	if(v4l_dev>0)
	{
		close(v4l_dev);
		return OMX_TRUE;
	}
	else
	{
		return OMX_FALSE;
	}
#endif
}
开发者ID:hicks0074,项目名称:freescale_omx_framework,代码行数:31,代码来源:V4lRender.cpp

示例7: nxp_video_querycap

/* querycap: check capture, out, m2m */
static int nxp_video_querycap(struct file *file, void *fh,
        struct v4l2_capability *cap)
{
    struct nxp_video *me = file->private_data;

    strlcpy(cap->driver, me->name, sizeof(cap->driver));
    strlcpy(cap->card, me->vdev.name, sizeof(cap->card));
    strlcpy(cap->bus_info, "media", sizeof(cap->bus_info));
    cap->version = KERNEL_VERSION(1, 0, 0);

    pr_debug("%s: devname(%s)\n", __func__, cap->driver);

    switch(me->type) {
    case NXP_VIDEO_TYPE_CAPTURE:
        cap->capabilities = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING;
        break;
    case NXP_VIDEO_TYPE_OUT:
        cap->capabilities = V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING;
        break;
    case NXP_VIDEO_TYPE_M2M:
        cap->capabilities = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
            V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING;
        break;
    default:
        pr_err("%s: invalid type(%d)\n", __func__, me->type);
        return -EINVAL;
    }

    return 0;
}
开发者ID:iTOP4418,项目名称:kernel-3.4.39,代码行数:31,代码来源:nxp-video.c

示例8: camif_media_dev_init

/*
 * Media device
 */
static int camif_media_dev_init(struct camif_dev *camif)
{
	struct media_device *md = &camif->media_dev;
	struct v4l2_device *v4l2_dev = &camif->v4l2_dev;
	unsigned int ip_rev = camif->variant->ip_revision;
	int ret;

	memset(md, 0, sizeof(*md));
	snprintf(md->model, sizeof(md->model), "SAMSUNG S3C%s CAMIF",
		 ip_rev == S3C6410_CAMIF_IP_REV ? "6410" : "244X");
	strlcpy(md->bus_info, "platform", sizeof(md->bus_info));
	md->hw_revision = ip_rev;
	md->driver_version = KERNEL_VERSION(1, 0, 0);

	md->dev = camif->dev;

	strlcpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name));
	v4l2_dev->mdev = md;

	media_device_init(md);

	ret = v4l2_device_register(camif->dev, v4l2_dev);
	if (ret < 0)
		return ret;

	return ret;
}
开发者ID:513855417,项目名称:linux,代码行数:30,代码来源:camif-core.c

示例9: ipset_init

void ipset_init(void)
{
  struct utsname utsname;
  int version;
  char *split;
  
  if (uname(&utsname) < 0)
    die(_("failed to find kernel version: %s"), NULL, EC_MISC);
  
  split = strtok(utsname.release, ".");
  version = (split ? atoi(split) : 0);
  split = strtok(NULL, ".");
  version = version * 256 + (split ? atoi(split) : 0);
  split = strtok(NULL, ".");
  version = version * 256 + (split ? atoi(split) : 0);
  old_kernel = (version < KERNEL_VERSION(2,6,32));
  
  if (old_kernel && (ipset_sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) != -1)
    return;
  
  if (!old_kernel && 
      (buffer = safe_malloc(BUFF_SZ)) &&
      (ipset_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER)) != -1 &&
      (bind(ipset_sock, (struct sockaddr *)&snl, sizeof(snl)) != -1))
    return;
  
  die (_("failed to create IPset control socket: %s"), NULL, EC_MISC);
}
开发者ID:ANGERofWaR,项目名称:dnsmasq,代码行数:28,代码来源:ipset.c

示例10: emit_e820_device

static int emit_e820_device(int loglevel, struct ndctl_test *test)
{
	int err, fd;
	char path[256];
	const char *bdev;
	struct ndctl_ctx *ctx;
	struct ndctl_bus *bus;
	struct ndctl_region *region;
	struct ndctl_namespace *ndns;
	enum ndctl_namespace_mode mode;

	if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 3, 0)))
		return 77;

	err = ndctl_new(&ctx);
	if (err < 0)
		return err;

	ndctl_set_log_priority(ctx, loglevel);
	err = -ENXIO;
	bus = ndctl_bus_get_by_provider(ctx, "e820");
	if (!bus)
		goto out;

	region = ndctl_region_get_first(bus);
	if (!region)
		goto out;

	ndns = ndctl_namespace_get_first(region);
	if (!ndns)
		goto out;

	mode = ndctl_namespace_get_mode(ndns);
	if (mode >= 0 && mode != NDCTL_NS_MODE_MEMORY)
		goto out;

	bdev = ndctl_namespace_get_block_device(ndns);
	if (!bdev)
		goto out;

	if (snprintf(path, sizeof(path), "/dev/%s", bdev) >= (int) sizeof(path))
		goto out;

	/*
	 * Note, if the bdev goes active after this check we'll still
	 * clobber it in the following tests, see test/dax.sh.
	 */
	fd = open(path, O_RDWR | O_EXCL);
	if (fd < 0)
		goto out;
	err = 0;
	fprintf(stdout, "%s\n", path);

 out:
	if (err)
		fprintf(stderr, "%s: failed to find usable victim device\n",
				__func__);
	ndctl_unref(ctx);
	return err;
}
开发者ID:lakshminarayanand,项目名称:ndctl,代码行数:60,代码来源:dax-dev.c

示例11: hid_read_timeout

int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
{
	int bytes_read;

	if (milliseconds != 0) {
		/* milliseconds is -1 or > 0. In both cases, we want to
		   call poll() and wait for data to arrive. -1 means
		   INFINITE. */
		int ret;
		struct pollfd fds;

		fds.fd = dev->device_handle;
		fds.events = POLLIN;
		fds.revents = 0;
		ret = poll(&fds, 1, milliseconds);
		if (ret == -1 || ret == 0)
			/* Error or timeout */
			return ret;
	}

	bytes_read = read(dev->device_handle, data, length);
	if (bytes_read < 0 && errno == EAGAIN)
		bytes_read = 0;
	
	if (bytes_read >= 0 &&
	    kernel_version < KERNEL_VERSION(2,6,34) &&
	    dev->uses_numbered_reports) {
		/* Work around a kernel bug. Chop off the first byte. */
		memmove(data, data+1, bytes_read);
		bytes_read--;
	}

	return bytes_read;
}
开发者ID:Hassaanafzal,项目名称:Odroid-USBIO,代码行数:34,代码来源:hid.c

示例12: check_kernel_version

void check_kernel_version(kernel_version_t *version) {
	static struct utsname buf;
	static long major, minor, patch, ver = -1;
	if (ver == -1) {
		must_success(uname(&buf), "uname failed");
		if (buf.release[0] < '2')
			goto fail;
		sscanf(buf.release, "%d.%d.%d", &major, &minor, &patch);
		debugf("Kernel version: %d.%d.%d", major, minor, patch);
		ver = KERNEL_VERSION(major, minor, patch);
		if (ver < KERNEL_VERSION(2, 6, 32))
			goto fail;
	}
	*version = ver;
	return;
fail:
	fatalf("Kernel version < 2.6.32 is not supported!");
}
开发者ID:FudanICPC,项目名称:FastJudge,代码行数:18,代码来源:main.c

示例13: vidioc_querycap

static int vidioc_querycap(struct file *file, void *priv,
			   struct v4l2_capability *cap)
{
	strcpy(cap->driver, "dummy");
	strcpy(cap->card, "dummy");
	cap->version = KERNEL_VERSION(0, 0, 1);
	cap->capabilities = 0;
	return 0;
}
开发者ID:1587,项目名称:ltp,代码行数:9,代码来源:video_dummy.c

示例14: _get_num_sectors

static uint64_t
_get_num_sectors(int fd)
{
	int version = _get_linux_version();
	unsigned long	size;
	uint64_t bytes=0;

	if (version >= KERNEL_VERSION(2,5,4) ||
		(version <  KERNEL_VERSION(2,5,0) &&
		 version >= KERNEL_VERSION (2,4,18)))
	{
                if (ioctl(fd, BLKGETSIZE64, &bytes) == 0)
                        return bytes / _get_sector_size(fd);
	}
	if (ioctl (fd, BLKGETSIZE, &size))
		return 0;
	return size;
}
开发者ID:xxha,项目名称:util-linux-2.13.1,代码行数:18,代码来源:gpt.c

示例15: tapdisk_lio_check_resfd

static int
tapdisk_lio_check_resfd(void)
{
#if defined(__linux__)
	return tapdisk_linux_version() >= KERNEL_VERSION(2, 6, 22);
#else
	return 1;
#endif
}
开发者ID:0day-ci,项目名称:xen,代码行数:9,代码来源:tapdisk-queue.c


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