您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ubi_put_device函数代码示例

51自学网 2021-06-03 09:04:53
  C++
这篇教程C++ ubi_put_device函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ubi_close_volume

/** * ubi_close_volume - close UBI volume. * @desc: volume descriptor */void ubi_close_volume(struct ubi_volume_desc *desc){	struct ubi_volume *vol = desc->vol;	struct ubi_device *ubi = vol->ubi;	dbg_gen("close device %d, volume %d, mode %d",		ubi->ubi_num, vol->vol_id, desc->mode);	spin_lock(&ubi->volumes_lock);	switch (desc->mode) {	case UBI_READONLY:		vol->readers -= 1;		break;	case UBI_READWRITE:		vol->writers -= 1;		break;	case UBI_EXCLUSIVE:		vol->exclusive = 0;	}	vol->ref_count -= 1;	spin_unlock(&ubi->volumes_lock);	kfree(desc);	put_device(&vol->dev);	ubi_put_device(ubi);	module_put(THIS_MODULE);}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:31,


示例2: ubi_sync

/** * ubi_sync - synchronize UBI device buffers. * @ubi_num: UBI device to synchronize * * The underlying MTD device may cache data in hardware or in software. This * function ensures the caches are flushed. Returns zero in case of success and * a negative error code in case of failure. */int ubi_sync(int ubi_num){	struct ubi_device *ubi;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	mtd_sync(ubi->mtd);	ubi_put_device(ubi);	return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:20,


示例3: ubi_get_device_info

/** * ubi_get_device_info - get information about UBI device. * @ubi_num: UBI device number * @di: the information is stored here * * This function returns %0 in case of success, %-EINVAL if the UBI device * number is invalid, and %-ENODEV if there is no such UBI device. */int ubi_get_device_info(int ubi_num, struct ubi_device_info *di){	struct ubi_device *ubi;	if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)		return -EINVAL;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	ubi_do_get_device_info(ubi, di);	ubi_put_device(ubi);	return 0;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:21,


示例4: ubi_flush

/** * ubi_flush - flush UBI work queue. * @ubi_num: UBI device to flush work queue * @vol_id: volume id to flush for * @lnum: logical eraseblock number to flush for * * This function executes all pending works for a particular volume id / logical * eraseblock number pair. If either value is set to %UBI_ALL, then it acts as * a wildcard for all of the corresponding volume numbers or logical * eraseblock numbers. It returns zero in case of success and a negative error * code in case of failure. */int ubi_flush(int ubi_num, int vol_id, int lnum){	struct ubi_device *ubi;	int err = 0;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	err = ubi_wl_flush(ubi, vol_id, lnum);	ubi_put_device(ubi);	return err;}
开发者ID:Noltari,项目名称:u-boot,代码行数:25,


示例5: dfs_file_write

/* Write an UBI debugfs file */static ssize_t dfs_file_write(struct file *file, const char __user *user_buf,			      size_t count, loff_t *ppos){	unsigned long ubi_num = (unsigned long)file->private_data;	struct dentry *dent = file->f_path.dentry;	struct ubi_device *ubi;	struct ubi_debug_info *d;	size_t buf_size;	char buf[8];	int val;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	d = ubi->dbg;	buf_size = min_t(size_t, count, (sizeof(buf) - 1));	if (copy_from_user(buf, user_buf, buf_size)) {		count = -EFAULT;		goto out;	}	if (buf[0] == '1')		val = 1;	else if (buf[0] == '0')		val = 0;	else {		count = -EINVAL;		goto out;	}	if (dent == d->dfs_chk_gen)		d->chk_gen = val;	else if (dent == d->dfs_chk_io)		d->chk_io = val;	else if (dent == d->dfs_disable_bgt)		d->disable_bgt = val;	else if (dent == d->dfs_emulate_bitflips)		d->emulate_bitflips = val;	else if (dent == d->dfs_emulate_io_failures)		d->emulate_io_failures = val;	else		count = -EINVAL;out:	ubi_put_device(ubi);	return count;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:49,


示例6: ubi_sync

/** * ubi_sync - synchronize UBI device buffers. * @ubi_num: UBI device to synchronize * * The underlying MTD device may cache data in hardware or in software. This * function ensures the caches are flushed. Returns zero in case of success and * a negative error code in case of failure. */int ubi_sync(int ubi_num){	struct ubi_device *ubi;	dbg_gen("sync device %d", ubi_num);	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	if (ubi->mtd->sync)		ubi->mtd->sync(ubi->mtd);	ubi_put_device(ubi);	return 0;}
开发者ID:MrTomasz,项目名称:kogan-tv-gpl,代码行数:24,


示例7: dbg_gen

/** * ubi_open_volume_nm - open UBI volume by name. * @ubi_num: UBI device number * @name: volume name * @mode: open mode * * This function is similar to 'ubi_open_volume()', but opens a volume by name. */struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,					   int mode){	int i, vol_id = -1, len;	struct ubi_device *ubi;	struct ubi_volume_desc *ret;	dbg_gen("open device %d, volume %s, mode %d", ubi_num, name, mode);	if (!name)		return ERR_PTR(-EINVAL);	len = strnlen(name, UBI_VOL_NAME_MAX + 1);	if (len > UBI_VOL_NAME_MAX)		return ERR_PTR(-EINVAL);	if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)		return ERR_PTR(-EINVAL);	ubi = ubi_get_device(ubi_num);	if (!ubi)		return ERR_PTR(-ENODEV);	spin_lock(&ubi->volumes_lock);	/* Walk all volumes of this UBI device */	for (i = 0; i < ubi->vtbl_slots; i++) {		struct ubi_volume *vol = ubi->volumes[i];		if (vol && len == vol->name_len && !strcmp(name, vol->name)) {			vol_id = i;			break;		}	}	spin_unlock(&ubi->volumes_lock);	if (vol_id >= 0)		ret = ubi_open_volume(ubi_num, vol_id, mode);	else		ret = ERR_PTR(-ENODEV);	/*	 * We should put the UBI device even in case of success, because	 * 'ubi_open_volume()' took a reference as well.	 */	ubi_put_device(ubi);	return ret;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:55,


示例8: dfs_file_read

/* Read an UBI debugfs file */static ssize_t dfs_file_read(struct file *file, char __user *user_buf,			     size_t count, loff_t *ppos){	unsigned long ubi_num = (unsigned long)file->private_data;	struct dentry *dent = file->f_path.dentry;	struct ubi_device *ubi;	struct ubi_debug_info *d;	char buf[3];	int val;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	d = ubi->dbg;	if (dent == d->dfs_chk_gen)		val = d->chk_gen;	else if (dent == d->dfs_chk_io)		val = d->chk_io;	else if (dent == d->dfs_disable_bgt)		val = d->disable_bgt;	else if (dent == d->dfs_emulate_bitflips)		val = d->emulate_bitflips;	else if (dent == d->dfs_emulate_io_failures)		val = d->emulate_io_failures;	else {		count = -EINVAL;		goto out;	}	if (val)		buf[0] = '1';	else		buf[0] = '0';	buf[1] = '/n';	buf[2] = 0x00;	count = simple_read_from_buffer(user_buf, count, ppos, buf, 2);out:	ubi_put_device(ubi);	return count;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:44,


示例9: ubi_get_device_info

/** * ubi_get_device_info - get information about UBI device. * @ubi_num: UBI device number * @di: the information is stored here * * This function returns %0 in case of success, %-EINVAL if the UBI device * number is invalid, and %-ENODEV if there is no such UBI device. */int ubi_get_device_info(int ubi_num, struct ubi_device_info *di){	struct ubi_device *ubi;	if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)		return -EINVAL;	ubi = ubi_get_device(ubi_num);	if (!ubi)		return -ENODEV;	di->ubi_num = ubi->ubi_num;	di->leb_size = ubi->leb_size;	di->min_io_size = ubi->min_io_size;	di->ro_mode = ubi->ro_mode;	di->cdev = ubi->cdev.dev;	ubi_put_device(ubi);	return 0;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:28,


示例10: ubi_cdev_ioctl

//.........这里部分代码省略.........		dbg_msg("create volume");		err = copy_from_user(&req, argp, sizeof(struct ubi_mkvol_req));		if (err) {			err = -EFAULT;			break;		}		err = verify_mkvol_req(ubi, &req);		if (err)			break;		req.name[req.name_len] = '/0';		mutex_lock(&ubi->volumes_mutex);		err = ubi_create_volume(ubi, &req);		mutex_unlock(&ubi->volumes_mutex);		if (err)			break;		err = put_user(req.vol_id, (__user int32_t *)argp);		if (err)			err = -EFAULT;		break;	}	/* Remove volume command */	case UBI_IOCRMVOL:	{		int vol_id;		dbg_msg("remove volume");		err = get_user(vol_id, (__user int32_t *)argp);		if (err) {			err = -EFAULT;			break;		}		desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_EXCLUSIVE);		if (IS_ERR(desc)) {			err = PTR_ERR(desc);			break;		}		mutex_lock(&ubi->volumes_mutex);		err = ubi_remove_volume(desc);		mutex_unlock(&ubi->volumes_mutex);		/*		 * The volume is deleted (unless an error occurred), and the		 * 'struct ubi_volume' object will be freed when		 * 'ubi_close_volume()' will call 'put_device()'.		 */		ubi_close_volume(desc);		break;	}	/* Re-size volume command */	case UBI_IOCRSVOL:	{		int pebs;		uint64_t tmp;		struct ubi_rsvol_req req;		dbg_msg("re-size volume");		err = copy_from_user(&req, argp, sizeof(struct ubi_rsvol_req));		if (err) {			err = -EFAULT;			break;		}		err = verify_rsvol_req(ubi, &req);		if (err)			break;		desc = ubi_open_volume(ubi->ubi_num, req.vol_id, UBI_EXCLUSIVE);		if (IS_ERR(desc)) {			err = PTR_ERR(desc);			break;		}		tmp = req.bytes;		pebs = !!do_div(tmp, desc->vol->usable_leb_size);		pebs += tmp;		mutex_lock(&ubi->volumes_mutex);		err = ubi_resize_volume(desc, pebs);		mutex_unlock(&ubi->volumes_mutex);		ubi_close_volume(desc);		break;	}	default:		err = -ENOTTY;		break;	}	ubi_put_device(ubi);	return err;}
开发者ID:maraz,项目名称:linux-2.6,代码行数:101,


示例11: dbg_msg

/** * ubi_open_volume_nm - open UBI volume by name. * @ubi_num: UBI device number * @name: volume name * @mode: open mode * * This function is similar to 'ubi_open_volume()', but opens a volume by name. */struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,					   int mode){	int i, vol_id = -1, len;	struct ubi_device *ubi;	struct ubi_volume_desc *ret;	int k;	dbg_msg("open volume %s, mode %d", name, mode);	if (!name)		return ERR_PTR(-EINVAL);	len = strnlen(name, UBI_VOL_NAME_MAX + 1);	if (len > UBI_VOL_NAME_MAX)		return ERR_PTR(-EINVAL);	if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES)		return ERR_PTR(-EINVAL);	ubi = ubi_get_device(ubi_num);	if (!ubi)		return ERR_PTR(-ENODEV);	for( k=0; k<(UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT); k++)	{		if (ubi->volumes[i]) {			printf("ubi volume name = %s/n", ubi->volumes[i]->name);		}	}		spin_lock(&ubi->volumes_lock);	/* Walk all volumes of this UBI device */	for (i = 0; i < (ubi->vtbl_slots+UBI_INT_VOL_COUNT); i++) {		struct ubi_volume *vol = ubi->volumes[i];		if (vol) {//		   printf("ubi_open_volume_nm found i=%d/n", i);//		   printf("ubi_open_volume_nm found volume vol->name=%s/n", vol->name);//		   printf("ubi_open_volume_nm found volume name=%s/n", name);//		   printf("ubi_open_volume_nm found len=%d/n", len);//		   printf("ubi_open_volume_nm found vol->name_len=%d/n", vol->name_len);		   k = strcmp(name, vol->name);		   if (0==k) {			   vol_id=i;//			   printf("ubi_open_volume_nm found strings are compared/n");		   }		   break;		}	}	spin_unlock(&ubi->volumes_lock);	if (vol_id >= 0)		ret = ubi_open_volume(ubi_num, vol_id, mode);	else		ret = ERR_PTR(-ENODEV);//	printf("ubi_open_volume_nm  volume =%d!/n", i);	/*	 * We should put the UBI device even in case of success, because	 * 'ubi_open_volume()' took a reference as well.	 */	ubi_put_device(ubi);	return ret;}
开发者ID:Micronet-Ltd,项目名称:A3xx-Uboot,代码行数:77,



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


C++ ubi_warn函数代码示例
C++ ubi_msg函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。