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

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

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

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

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

示例1: dbg_gen

static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,				   unsigned int flags){	int err;	union ubifs_key key;	struct inode *inode = NULL;	struct ubifs_dent_node *dent;	struct ubifs_info *c = dir->i_sb->s_fs_info;	dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino);	if (dentry->d_name.len > UBIFS_MAX_NLEN)		return ERR_PTR(-ENAMETOOLONG);	dent = kmalloc(UBIFS_MAX_DENT_NODE_SZ, GFP_NOFS);	if (!dent)		return ERR_PTR(-ENOMEM);	dent_key_init(c, &key, dir->i_ino, &dentry->d_name);	err = ubifs_tnc_lookup_nm(c, &key, dent, &dentry->d_name);	if (err) {		if (err == -ENOENT) {			dbg_gen("not found");			goto done;		}		goto out;	}	if (dbg_check_name(c, dent, &dentry->d_name)) {		err = -EINVAL;		goto out;	}	inode = ubifs_iget(dir->i_sb, le64_to_cpu(dent->inum));	if (IS_ERR(inode)) {		/*		 * This should not happen. Probably the file-system needs		 * checking.		 */		err = PTR_ERR(inode);		ubifs_err(c, "dead directory entry '%pd', error %d",			  dentry, err);		ubifs_ro_mode(c, err);		goto out;	}done:	kfree(dent);	/*	 * Note, d_splice_alias() would be required instead if we supported	 * NFS.	 */	d_add(dentry, inode);	return NULL;out:	kfree(dent);	return ERR_PTR(err);}
开发者ID:DenisLug,项目名称:mptcp,代码行数:60,


示例2: ubifs_sync_wbufs_by_inode

/** * ubifs_sync_wbufs_by_inode - synchronize write-buffers for an inode. * @c: UBIFS file-system description object * @inode: inode to synchronize * * This function synchronizes write-buffers which contain nodes belonging to * @inode. Returns zero in case of success and a negative error code in case of * failure. */int ubifs_sync_wbufs_by_inode(struct ubifs_info *c, struct inode *inode){	int i, err = 0;	for (i = 0; i < c->jhead_cnt; i++) {		struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;		if (i == GCHD)			/*			 * GC head is special, do not look at it. Even if the			 * head contains something related to this inode, it is			 * a _copy_ of corresponding on-flash node which sits			 * somewhere else.			 */			continue;		if (!wbuf_has_ino(wbuf, inode->i_ino))			continue;		mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);		if (wbuf_has_ino(wbuf, inode->i_ino))			err = ubifs_wbuf_sync_nolock(wbuf);		mutex_unlock(&wbuf->io_mutex);		if (err) {			ubifs_ro_mode(c, err);			return err;		}	}	return 0;}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:40,


示例3: ubifs_jnl_write_2_inodes

/** * ubifs_jnl_write_2_inodes - write 2 inodes to the journal. * @c: UBIFS file-system description object * @inode1: first inode to write * @inode2: second inode to write * @sync: non-zero if the write-buffer has to be synchronized * * This function writes 2 inodes @inode1 and @inode2 to the journal (to the * base head - first @inode1, then @inode2). Returns zero in case of success * and a negative error code in case of failure. */int ubifs_jnl_write_2_inodes(struct ubifs_info *c, const struct inode *inode1,                             const struct inode *inode2, int sync){    int err, len1, len2, aligned_len, aligned_len1, lnum, offs;    struct ubifs_ino_node *ino;    union ubifs_key key;    dbg_jnl("ino %lu, ino %lu", inode1->i_ino, inode2->i_ino);    ubifs_assert(inode1->i_nlink > 0);    ubifs_assert(inode2->i_nlink > 0);    len1 = UBIFS_INO_NODE_SZ + ubifs_inode(inode1)->data_len;    len2 = UBIFS_INO_NODE_SZ + ubifs_inode(inode2)->data_len;    aligned_len1 = ALIGN(len1, 8);    aligned_len = aligned_len1 + ALIGN(len2, 8);    ino = kmalloc(aligned_len, GFP_NOFS);    if (!ino)        return -ENOMEM;    /* Make reservation before allocating sequence numbers */    err = make_reservation(c, BASEHD, aligned_len);    if (err)        goto out_free;    pack_inode(c, ino, inode1, 0, 0);    pack_inode(c, (void *)ino + aligned_len1, inode2, 1, 0);    err = write_head(c, BASEHD, ino, aligned_len, &lnum, &offs, 0);    if (!sync && !err) {        struct ubifs_wbuf *wbuf = &c->jheads[BASEHD].wbuf;        ubifs_wbuf_add_ino_nolock(wbuf, inode1->i_ino);        ubifs_wbuf_add_ino_nolock(wbuf, inode2->i_ino);    }    release_head(c, BASEHD);    if (err)        goto out_ro;    ino_key_init(c, &key, inode1->i_ino);    err = ubifs_tnc_add(c, &key, lnum, offs, len1);    if (err)        goto out_ro;    ino_key_init(c, &key, inode2->i_ino);    err = ubifs_tnc_add(c, &key, lnum, offs + aligned_len1, len2);    if (err)        goto out_ro;    finish_reservation(c);    kfree(ino);    return 0;out_ro:    ubifs_ro_mode(c, err);    finish_reservation(c);out_free:    kfree(ino);    return err;}
开发者ID:heroistired,项目名称:jzcode-x11,代码行数:71,


示例4: ubifs_bg_wbufs_sync

/** * ubifs_bg_wbufs_sync - synchronize write-buffers. * @c: UBIFS file-system description object * * This function is called by background thread to synchronize write-buffers. * Returns zero in case of success and a negative error code in case of * failure. */int ubifs_bg_wbufs_sync(struct ubifs_info *c){	int err, i;	ubifs_assert(!c->ro_media && !c->ro_mount);	if (!c->need_wbuf_sync)		return 0;	c->need_wbuf_sync = 0;	if (c->ro_error) {		err = -EROFS;		goto out_timers;	}	dbg_io("synchronize");	for (i = 0; i < c->jhead_cnt; i++) {		struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;		cond_resched();		/*		 * If the mutex is locked then wbuf is being changed, so		 * synchronization is not necessary.		 */		if (mutex_is_locked(&wbuf->io_mutex))			continue;		mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);		if (!wbuf->need_sync) {			mutex_unlock(&wbuf->io_mutex);			continue;		}		err = ubifs_wbuf_sync_nolock(wbuf);		mutex_unlock(&wbuf->io_mutex);		if (err) {			ubifs_err("cannot sync write-buffer, error %d", err);			ubifs_ro_mode(c, err);			goto out_timers;		}	}	return 0;out_timers:	/* Cancel all timers to prevent repeated errors */	for (i = 0; i < c->jhead_cnt; i++) {		struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;		mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);		cancel_wbuf_timer_nolock(wbuf);		mutex_unlock(&wbuf->io_mutex);	}	return err;}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:63,


示例5: ubifs_leb_map

int ubifs_leb_map(struct ubifs_info *c, int lnum){	int err;	ubifs_assert(!c->ro_media && !c->ro_mount);	if (c->ro_error)		return -EROFS;	if (!dbg_is_tst_rcvry(c))		err = ubi_leb_map(c->ubi, lnum);	else		err = dbg_leb_map(c, lnum);	if (err) {		ubifs_err("mapping LEB %d failed, error %d", lnum, err);		ubifs_ro_mode(c, err);		dbg_dump_stack();	}	return err;}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:18,


示例6: ubifs_bg_thread

/** * ubifs_bg_thread - UBIFS background thread function. * @info: points to the file-system description object * * This function implements various file-system background activities: * o when a write-buffer timer expires it synchronizes the appropriate *   write-buffer; * o when the journal is about to be full, it starts in-advance commit. * * Note, other stuff like background garbage collection may be added here in * future. */int ubifs_bg_thread(void *info){    int err;    struct ubifs_info *c = info;    ubifs_msg("background thread /"%s/" started, PID %d", c->vi.ubi_num,              c->bgt_name, current->pid);    set_freezable();    while (1) {        if (kthread_should_stop())            break;        if (try_to_freeze())            continue;        set_current_state(TASK_INTERRUPTIBLE);        /* Check if there is something to do */        if (!c->need_bgt) {            /*             * Nothing prevents us from going sleep now and             * be never woken up and block the task which             * could wait in 'kthread_stop()' forever.             */            if (kthread_should_stop())                break;            schedule();            continue;        } else            __set_current_state(TASK_RUNNING);        c->need_bgt = 0;        err = ubifs_bg_wbufs_sync(c);        if (err)            ubifs_ro_mode(c, err);        run_bg_commit(c);        cond_resched();    }    ubifs_msg("background thread /"%s/" stops", c->vi.ubi_num,              c->bgt_name);    return 0;}
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:56,


示例7: ubifs_leb_change

int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len){	int err;	ubifs_assert(!c->ro_media && !c->ro_mount);	if (c->ro_error)		return -EROFS;	if (!dbg_is_tst_rcvry(c))		err = ubi_leb_change(c->ubi, lnum, buf, len);	else		err = dbg_leb_change(c, lnum, buf, len);	if (err) {		ubifs_err("changing %d bytes in LEB %d failed, error %d",			  len, lnum, err);		ubifs_ro_mode(c, err);		dbg_dump_stack();	}	return err;}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:19,


示例8: next_sqnum

/** * next_sqnum - get next sequence number. * @c: UBIFS file-system description object */static unsigned long long next_sqnum(struct ubifs_info *c){	unsigned long long sqnum;	spin_lock(&c->cnt_lock);	sqnum = ++c->max_sqnum;	spin_unlock(&c->cnt_lock);	if (unlikely(sqnum >= SQNUM_WARN_WATERMARK)) {		if (sqnum >= SQNUM_WATERMARK) {			ubifs_err("sequence number overflow %llu, end of life",				  sqnum);			ubifs_ro_mode(c, -EINVAL);		}		ubifs_warn("running out of sequence numbers, end of life soon");	}	return sqnum;}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:23,


示例9: ubifs_leb_write

int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,		    int len, int dtype){	int err;	ubifs_assert(!c->ro_media && !c->ro_mount);	if (c->ro_error)		return -EROFS;	if (!dbg_is_tst_rcvry(c))		err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype);	else		err = dbg_leb_write(c, lnum, buf, offs, len, dtype);	if (err) {		ubifs_err("writing %d bytes to LEB %d:%d failed, error %d",			  len, lnum, offs, err);		ubifs_ro_mode(c, err);		dbg_dump_stack();	}	return err;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:20,


示例10: do_commit

//.........这里部分代码省略.........	err = dbg_check_lprops(c);	if (err)		goto out_up;	err = ubifs_log_start_commit(c, &new_ltail_lnum);	if (err)		goto out_up;	err = ubifs_tnc_start_commit(c, &zroot);	if (err)		goto out_up;	err = ubifs_lpt_start_commit(c);	if (err)		goto out_up;	err = ubifs_orphan_start_commit(c);	if (err)		goto out_up;	ubifs_get_lp_stats(c, &lst);	up_write(&c->commit_sem);	err = ubifs_tnc_end_commit(c);	if (err)		goto out;	err = ubifs_lpt_end_commit(c);	if (err)		goto out;	err = ubifs_orphan_end_commit(c);	if (err)		goto out;	old_ltail_lnum = c->ltail_lnum;	err = ubifs_log_end_commit(c, new_ltail_lnum);	if (err)		goto out;	err = dbg_check_old_index(c, &zroot);	if (err)		goto out;	mutex_lock(&c->mst_mutex);	c->mst_node->cmt_no      = cpu_to_le64(c->cmt_no);	c->mst_node->log_lnum    = cpu_to_le32(new_ltail_lnum);	c->mst_node->root_lnum   = cpu_to_le32(zroot.lnum);	c->mst_node->root_offs   = cpu_to_le32(zroot.offs);	c->mst_node->root_len    = cpu_to_le32(zroot.len);	c->mst_node->ihead_lnum  = cpu_to_le32(c->ihead_lnum);	c->mst_node->ihead_offs  = cpu_to_le32(c->ihead_offs);	c->mst_node->index_size  = cpu_to_le64(c->old_idx_sz);	c->mst_node->lpt_lnum    = cpu_to_le32(c->lpt_lnum);	c->mst_node->lpt_offs    = cpu_to_le32(c->lpt_offs);	c->mst_node->nhead_lnum  = cpu_to_le32(c->nhead_lnum);	c->mst_node->nhead_offs  = cpu_to_le32(c->nhead_offs);	c->mst_node->ltab_lnum   = cpu_to_le32(c->ltab_lnum);	c->mst_node->ltab_offs   = cpu_to_le32(c->ltab_offs);	c->mst_node->lsave_lnum  = cpu_to_le32(c->lsave_lnum);	c->mst_node->lsave_offs  = cpu_to_le32(c->lsave_offs);	c->mst_node->lscan_lnum  = cpu_to_le32(c->lscan_lnum);	c->mst_node->empty_lebs  = cpu_to_le32(lst.empty_lebs);	c->mst_node->idx_lebs    = cpu_to_le32(lst.idx_lebs);	c->mst_node->total_free  = cpu_to_le64(lst.total_free);	c->mst_node->total_dirty = cpu_to_le64(lst.total_dirty);	c->mst_node->total_used  = cpu_to_le64(lst.total_used);	c->mst_node->total_dead  = cpu_to_le64(lst.total_dead);	c->mst_node->total_dark  = cpu_to_le64(lst.total_dark);	if (c->no_orphs)		c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);	else		c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_NO_ORPHS);	err = ubifs_write_master(c);	mutex_unlock(&c->mst_mutex);	if (err)		goto out;	err = ubifs_log_post_commit(c, old_ltail_lnum);	if (err)		goto out;	err = ubifs_gc_end_commit(c);	if (err)		goto out;	err = ubifs_lpt_post_commit(c);	if (err)		goto out;	spin_lock(&c->cs_lock);	c->cmt_state = COMMIT_RESTING;	wake_up(&c->cmt_wq);	dbg_cmt("commit end");	spin_unlock(&c->cs_lock);	return 0;out_up:	up_write(&c->commit_sem);out:	ubifs_err("commit failed, error %d", err);	spin_lock(&c->cs_lock);	c->cmt_state = COMMIT_BROKEN;	wake_up(&c->cmt_wq);	spin_unlock(&c->cs_lock);	ubifs_ro_mode(c, err);	return err;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:101,


示例11: dbg_gen

static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,				   unsigned int flags){	int err;	union ubifs_key key;	struct inode *inode = NULL;	struct ubifs_dent_node *dent;	struct ubifs_info *c = dir->i_sb->s_fs_info;	struct fscrypt_name nm;	dbg_gen("'%pd' in dir ino %lu", dentry, dir->i_ino);	if (ubifs_crypt_is_encrypted(dir)) {		err = fscrypt_get_encryption_info(dir);		/*		 * DCACHE_ENCRYPTED_WITH_KEY is set if the dentry is		 * created while the directory was encrypted and we		 * have access to the key.		 */		if (fscrypt_has_encryption_key(dir))			fscrypt_set_encrypted_dentry(dentry);		fscrypt_set_d_op(dentry);		if (err && err != -ENOKEY)			return ERR_PTR(err);	}	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);	if (err)		return ERR_PTR(err);	if (fname_len(&nm) > UBIFS_MAX_NLEN) {		err = -ENAMETOOLONG;		goto out_fname;	}	dent = kmalloc(UBIFS_MAX_DENT_NODE_SZ, GFP_NOFS);	if (!dent) {		err = -ENOMEM;		goto out_fname;	}	if (nm.hash) {		ubifs_assert(fname_len(&nm) == 0);		ubifs_assert(fname_name(&nm) == NULL);		dent_key_init_hash(c, &key, dir->i_ino, nm.hash);		err = ubifs_tnc_lookup_dh(c, &key, dent, nm.minor_hash);	} else {		dent_key_init(c, &key, dir->i_ino, &nm);		err = ubifs_tnc_lookup_nm(c, &key, dent, &nm);	}	if (err) {		if (err == -ENOENT) {			dbg_gen("not found");			goto done;		}		goto out_dent;	}	if (dbg_check_name(c, dent, &nm)) {		err = -EINVAL;		goto out_dent;	}	inode = ubifs_iget(dir->i_sb, le64_to_cpu(dent->inum));	if (IS_ERR(inode)) {		/*		 * This should not happen. Probably the file-system needs		 * checking.		 */		err = PTR_ERR(inode);		ubifs_err(c, "dead directory entry '%pd', error %d",			  dentry, err);		ubifs_ro_mode(c, err);		goto out_dent;	}	if (ubifs_crypt_is_encrypted(dir) &&	    (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&	    !fscrypt_has_permitted_context(dir, inode)) {		ubifs_warn(c, "Inconsistent encryption contexts: %lu/%lu",			   dir->i_ino, inode->i_ino);		err = -EPERM;		goto out_inode;	}done:	kfree(dent);	fscrypt_free_filename(&nm);	/*	 * Note, d_splice_alias() would be required instead if we supported	 * NFS.	 */	d_add(dentry, inode);	return NULL;out_inode:	iput(inode);out_dent://.........这里部分代码省略.........
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:101,



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


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