这篇教程C++ test_opt函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中test_opt函数的典型用法代码示例。如果您正苦于以下问题:C++ test_opt函数的具体用法?C++ test_opt怎么用?C++ test_opt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了test_opt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: f2fs_createstatic int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl){ struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct inode *inode; nid_t ino = 0; int err; err = dquot_initialize(dir); if (err) return err; inode = f2fs_new_inode(dir, mode); if (IS_ERR(inode)) return PTR_ERR(inode); if (!test_opt(sbi, DISABLE_EXT_IDENTIFY)) set_cold_files(sbi, inode, dentry->d_name.name); inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; ino = inode->i_ino; f2fs_lock_op(sbi); err = f2fs_add_link(dentry, inode); if (err) goto out; f2fs_unlock_op(sbi); alloc_nid_done(sbi, ino); d_instantiate(dentry, inode); unlock_new_inode(inode); if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); f2fs_balance_fs(sbi, true); return 0;out: handle_failed_inode(inode); return err;}
开发者ID:mdamt,项目名称:linux,代码行数:44,
示例2: ext2_setup_superstatic int ext2_setup_super (struct super_block * sb, struct ext2_super_block * es, int read_only){ int res = 0; struct ext2_sb_info *sbi = EXT2_SB(sb); if (le32_to_cpu(es->s_rev_level) > EXT2_MAX_SUPP_REV) { printk ("EXT2-fs warning: revision level too high, " "forcing read-only mode/n"); res = MS_RDONLY; } if (read_only) return res; if (!(sbi->s_mount_state & EXT2_VALID_FS)) printk ("EXT2-fs warning: mounting unchecked fs, " "running e2fsck is recommended/n"); else if ((sbi->s_mount_state & EXT2_ERROR_FS)) printk ("EXT2-fs warning: mounting fs with errors, " "running e2fsck is recommended/n"); else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && le16_to_cpu(es->s_mnt_count) >= (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) printk ("EXT2-fs warning: maximal mount count reached, " "running e2fsck is recommended/n"); else if (le32_to_cpu(es->s_checkinterval) && (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= get_seconds())) printk ("EXT2-fs warning: checktime reached, " "running e2fsck is recommended/n"); if (!le16_to_cpu(es->s_max_mnt_count)) es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); le16_add_cpu(&es->s_mnt_count, 1); ext2_write_super(sb); if (test_opt (sb, DEBUG)) printk ("[EXT II FS %s, %s, bs=%lu, fs=%lu, gc=%lu, " "bpg=%lu, ipg=%lu, mo=%04lx]/n", EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, sbi->s_frag_size, sbi->s_groups_count, EXT2_BLOCKS_PER_GROUP(sb), EXT2_INODES_PER_GROUP(sb), sbi->s_mount_opt); return res;}
开发者ID:sushengloong,项目名称:comp3301-s4239799,代码行数:44,
示例3: f2fs_show_optionsstatic int f2fs_show_options(struct seq_file *seq, struct vfsmount *vfs){ struct f2fs_sb_info *sbi = F2FS_SB(vfs->mnt_sb); if (!(vfs->mnt_sb->s_flags & MS_RDONLY) && test_opt(sbi, BG_GC)) seq_printf(seq, ",background_gc=%s", "on"); else seq_printf(seq, ",background_gc=%s", "off"); if (test_opt(sbi, DISABLE_ROLL_FORWARD)) seq_puts(seq, ",disable_roll_forward"); if (test_opt(sbi, DISCARD)) seq_puts(seq, ",discard"); if (test_opt(sbi, NOHEAP)) seq_puts(seq, ",no_heap_alloc");#ifdef CONFIG_F2FS_FS_XATTR if (test_opt(sbi, XATTR_USER)) seq_puts(seq, ",user_xattr"); else seq_puts(seq, ",nouser_xattr"); if (test_opt(sbi, INLINE_XATTR)) seq_puts(seq, ",inline_xattr");#endif#ifdef CONFIG_F2FS_FS_POSIX_ACL if (test_opt(sbi, POSIX_ACL)) seq_puts(seq, ",acl"); else seq_puts(seq, ",noacl");#endif if (test_opt(sbi, DISABLE_EXT_IDENTIFY)) seq_puts(seq, ",disable_ext_identify"); if (test_opt(sbi, INLINE_DATA)) seq_puts(seq, ",inline_data"); seq_printf(seq, ",active_logs=%u", sbi->active_logs); return 0;}
开发者ID:achaykin,项目名称:android_kernel_huawei_viva,代码行数:36,
示例4: ext2_tmpfilestatic int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode){ struct inode *inode = ext2_new_inode(dir, mode, NULL); if (IS_ERR(inode)) return PTR_ERR(inode); inode->i_op = &ext2_file_inode_operations; if (test_opt(inode->i_sb, NOBH)) { inode->i_mapping->a_ops = &ext2_nobh_aops; inode->i_fop = &ext2_file_operations; } else { inode->i_mapping->a_ops = &ext2_aops; inode->i_fop = &ext2_file_operations; } mark_inode_dirty(inode); d_tmpfile(dentry, inode); unlock_new_inode(inode); return 0;}
开发者ID:RealJohnGalt,项目名称:linux,代码行数:19,
示例5: f2fs_may_inline_databool f2fs_may_inline_data(struct inode *inode){ if (!test_opt(F2FS_I_SB(inode), INLINE_DATA)) return false; if (f2fs_is_atomic_file(inode)) return false; if (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode)) return false; if (i_size_read(inode) > MAX_INLINE_DATA) return false; if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode)) return false; return true;}
开发者ID:ench0,项目名称:android_kernel_samsung_hltet,代码行数:19,
示例6: ext4_xattr_set_aclstatic intext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, size_t size, int flags, int type){ struct inode *inode = dentry->d_inode; handle_t *handle; struct posix_acl *acl; int error, retries = 0; if (strcmp(name, "") != 0) return -EINVAL; if (!test_opt(inode->i_sb, POSIX_ACL)) return -EOPNOTSUPP; if (!inode_owner_or_capable(inode)) return -EPERM; if (value) { acl = posix_acl_from_xattr(value, size); if (IS_ERR(acl)) return PTR_ERR(acl); else if (acl) { error = posix_acl_valid(acl); if (error) goto release_and_out; } } else acl = NULL;retry: handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb)); if (IS_ERR(handle)) { error = PTR_ERR(handle); goto release_and_out; } error = ext4_set_acl(handle, inode, type, acl); ext4_journal_stop(handle); if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry;release_and_out: posix_acl_release(acl); return error;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:43,
示例7: f2fs_may_inlinebool f2fs_may_inline(struct inode *inode){ struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); block_t nr_blocks; loff_t i_size; if (!test_opt(sbi, INLINE_DATA)) return false; nr_blocks = F2FS_I(inode)->i_xattr_nid ? 3 : 2; if (inode->i_blocks > nr_blocks) return false; i_size = i_size_read(inode); if (i_size > MAX_INLINE_DATA) return false; return true;}
开发者ID:7799,项目名称:linux,代码行数:19,
示例8: f2fs_createstatic int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl){ struct super_block *sb = dir->i_sb; struct f2fs_sb_info *sbi = F2FS_SB(sb); struct inode *inode; nid_t ino = 0; int err; f2fs_balance_fs(sbi); inode = f2fs_new_inode(dir, mode); if (IS_ERR(inode)) return PTR_ERR(inode); if (!test_opt(sbi, DISABLE_EXT_IDENTIFY)) set_cold_files(sbi, inode, dentry->d_name.name); inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; ino = inode->i_ino; f2fs_lock_op(sbi); err = f2fs_add_link(dentry, inode); f2fs_unlock_op(sbi); if (err) goto out; alloc_nid_done(sbi, ino); d_instantiate(dentry, inode); unlock_new_inode(inode); return 0;out: clear_nlink(inode); unlock_new_inode(inode); make_bad_inode(inode); iput(inode); alloc_nid_failed(sbi, ino); return err;}
开发者ID:7799,项目名称:linux,代码行数:42,
示例9: ext3_xattr_user_setstatic intext3_xattr_user_set(struct inode *inode, const char *name, const void *value, size_t size, int flags){ int error; if (strcmp(name, "") == 0) return -EINVAL; if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; if ( !S_ISREG(inode->i_mode) && (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) return -EPERM; error = permission(inode, MAY_WRITE, NULL); if (error) return error; return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, value, size, flags);}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:20,
示例10: ext4_set_gps_locationlong ext4_set_gps_location(struct inode *inode){ struct gps_location loc; struct ext4_inode_info *iinfo = EXT4_I(inode); long ts; if (!test_opt(inode->i_sb, GPS_AWARE_INODE)) return -ENODEV; kget_gps_location(&loc, &ts); ts = CURRENT_TIME_SEC.tv_sec - ts; write_lock(&iinfo->i_gps_lock); memcpy(&iinfo->i_latitude, &loc.latitude, sizeof(long long)); memcpy(&iinfo->i_longitude, &loc.longitude, sizeof(long long)); memcpy(&iinfo->i_accuracy, &loc.accuracy, sizeof(long)); memcpy(&iinfo->i_coord_age, &ts, sizeof(long)); write_unlock(&iinfo->i_gps_lock); return 0;}
开发者ID:keyu-lai,项目名称:Geo-tagged-Filesystem,代码行数:20,
示例11: ext2_acl_chmod/* * Does chmod for an inode that may have an Access Control List. The * inode->i_mode field must be updated to the desired value by the caller * before calling this function. * Returns 0 on success, or a negative error number. * * We change the ACL rather than storing some ACL entries in the file * mode permission bits (which would be more efficient), because that * would break once additional permissions (like ACL_APPEND, ACL_DELETE * for directories) are added. There are no more bits available in the * file mode. * * inode->i_mutex: down */intext2_acl_chmod(struct inode *inode){ struct posix_acl *acl; int error; if (!test_opt(inode->i_sb, POSIX_ACL)) return 0; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl) || !acl) return PTR_ERR(acl); error = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); if (error) return error; error = ext2_set_acl(inode, ACL_TYPE_ACCESS, acl); posix_acl_release(acl); return error;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:34,
示例12: f2fs_may_inlinebool f2fs_may_inline(struct inode *inode){ block_t nr_blocks; loff_t i_size; if (!test_opt(F2FS_I_SB(inode), INLINE_DATA)) return false; if (f2fs_is_atomic_file(inode)) return false; nr_blocks = F2FS_I(inode)->i_xattr_nid ? 3 : 2; if (inode->i_blocks > nr_blocks) return false; i_size = i_size_read(inode); if (i_size > MAX_INLINE_DATA) return false; return true;}
开发者ID:3null,项目名称:linux,代码行数:21,
示例13: ext2_create/* * By the time this is called, we already have created * the directory cache entry for the new file, but it * is so far negative - it has no inode. * * If the create succeeds, we fill in the inode information * with d_instantiate(). */static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, bool excl){ struct inode *inode; dquot_initialize(dir); inode = ext2_new_inode(dir, mode, &dentry->d_name); if (IS_ERR(inode)) return PTR_ERR(inode); inode->i_op = &ext2_file_inode_operations; if (test_opt(inode->i_sb, NOBH)) { inode->i_mapping->a_ops = &ext2_nobh_aops; inode->i_fop = &ext2_file_operations; } else { inode->i_mapping->a_ops = &ext2_aops; inode->i_fop = &ext2_file_operations; } mark_inode_dirty(inode); return ext2_add_nondir(dentry, inode);}
开发者ID:RealJohnGalt,项目名称:linux,代码行数:29,
示例14: f2fs_submit_merged_biovoid f2fs_submit_merged_bio(struct f2fs_sb_info *sbi, enum page_type type, int rw){ enum page_type btype = PAGE_TYPE_OF_BIO(type); struct f2fs_bio_info *io; io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype]; down_write(&io->io_rwsem); /* change META to META_FLUSH in the checkpoint procedure */ if (type >= META_FLUSH) { io->fio.type = META_FLUSH; if (test_opt(sbi, NOBARRIER)) io->fio.rw = WRITE_FLUSH | REQ_META | REQ_PRIO; else io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO; } __submit_merged_bio(io); up_write(&io->io_rwsem);}
开发者ID:aejsmith,项目名称:linux,代码行数:21,
示例15: ext4_xattr_get_aclstatic intext4_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer, size_t size, int type){ struct posix_acl *acl; int error; if (strcmp(name, "") != 0) return -EINVAL; if (!test_opt(dentry->d_sb, POSIX_ACL)) return -EOPNOTSUPP; acl = ext4_get_acl(dentry->d_inode, type); if (IS_ERR(acl)) return PTR_ERR(acl); if (acl == NULL) return -ENODATA; error = posix_acl_to_xattr(acl, buffer, size); posix_acl_release(acl); return error;}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:22,
示例16: optvoid opt(char **av, char *tabb){ int i; int y; int bo; i = 1; my_bzero(tabb, 3); while (av[i] != NULL && av[i][0] == '-') { y = 0; if (av[i][y] == '-') bo = test_opt(av, tabb, y, i); if (bo == 1) { my_putstr(av[i], 1); if (av[i + 1] != NULL && tabb[2] != 's') my_putchar(' ', 1); } i++; }}
开发者ID:JimmyYezeguelian,项目名称:42sh,代码行数:22,
示例17: f2fs_xattr_get_aclstatic int f2fs_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer, size_t size, int type){ struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); struct posix_acl *acl; int error; if (strcmp(name, "") != 0) return -EINVAL; if (!test_opt(sbi, POSIX_ACL)) return -EOPNOTSUPP; acl = f2fs_get_acl(dentry->d_inode, type); if (IS_ERR(acl)) return PTR_ERR(acl); if (!acl) return -ENODATA; error = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); posix_acl_release(acl); return error;}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:22,
示例18: need_do_checkpointstatic inline bool need_do_checkpoint(struct inode *inode){ struct f2fs_sb_info *sbi = F2FS_I_SB(inode); bool need_cp = false; if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) need_cp = true; else if (file_wrong_pino(inode)) need_cp = true; else if (!space_for_roll_forward(sbi)) need_cp = true; else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) need_cp = true; else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) need_cp = true; else if (test_opt(sbi, FASTBOOT)) need_cp = true; else if (sbi->active_logs == 2) need_cp = true; return need_cp;}
开发者ID:davidnguyenwm,项目名称:Hulk-Kernel,代码行数:22,
示例19: f2fs_xattr_generic_getstatic int f2fs_xattr_generic_get(const struct xattr_handler *handler, struct dentry *unused, struct inode *inode, const char *name, void *buffer, size_t size){ struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); switch (handler->flags) { case F2FS_XATTR_INDEX_USER: if (!test_opt(sbi, XATTR_USER)) return -EOPNOTSUPP; break; case F2FS_XATTR_INDEX_TRUSTED: if (!capable(CAP_SYS_ADMIN)) return -EPERM; break; case F2FS_XATTR_INDEX_SECURITY: break; default: return -EINVAL; } return f2fs_getxattr(inode, handler->flags, name, buffer, size, NULL);}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:23,
示例20: ext2_acl_chmod/* * Does chmod for an inode that may have an Access Control List. The * inode->i_mode field must be updated to the desired value by the caller * before calling this function. * Returns 0 on success, or a negative error number. * * We change the ACL rather than storing some ACL entries in the file * mode permission bits (which would be more efficient), because that * would break once additional permissions (like ACL_APPEND, ACL_DELETE * for directories) are added. There are no more bits available in the * file mode. * * inode->i_mutex: down */intext2_acl_chmod(struct inode *inode){ struct posix_acl *acl, *clone; int error; if (!test_opt(inode->i_sb, POSIX_ACL)) return 0; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl) || !acl) return PTR_ERR(acl); clone = posix_acl_clone(acl, GFP_KERNEL); posix_acl_release(acl); if (!clone) return -ENOMEM; error = posix_acl_chmod_masq(clone, inode->i_mode); if (!error) error = ext2_set_acl(inode, ACL_TYPE_ACCESS, clone); posix_acl_release(clone); return error;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:37,
注:本文中的test_opt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ test_parsable函数代码示例 C++ test_open_file_or_die函数代码示例 |