这篇教程C++ AFFS_SB函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AFFS_SB函数的典型用法代码示例。如果您正苦于以下问题:C++ AFFS_SB函数的具体用法?C++ AFFS_SB怎么用?C++ AFFS_SB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AFFS_SB函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: affs_notify_changeintaffs_notify_change(struct dentry *dentry, struct iattr *attr){ struct inode *inode = dentry->d_inode; int error; pr_debug("AFFS: notify_change(%lu,0x%x)/n",inode->i_ino,attr->ia_valid); error = inode_change_ok(inode,attr); if (error) goto out; if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) || ((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) || ((attr->ia_valid & ATTR_MODE) && (AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) { if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET)) error = -EPERM; goto out; } error = inode_setattr(inode, attr); if (!error && (attr->ia_valid & ATTR_MODE)) mode_to_prot(inode);out: return error;}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:27,
示例2: affs_symlink_readpagestatic int affs_symlink_readpage(struct file *file, struct page *page){ struct buffer_head *bh; struct inode *inode = page->mapping->host; char *link = kmap(page); struct slink_front *lf; int err; int i, j; char c; char lc; char *pf; pr_debug("AFFS: follow_link(ino=%lu)/n",inode->i_ino); err = -EIO; bh = affs_bread(inode->i_sb, inode->i_ino); if (!bh) goto fail; i = 0; j = 0; lf = (struct slink_front *)bh->b_data; lc = 0; pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/"; if (strchr(lf->symname,':')) { /* Handle assign or volume name */ while (i < 1023 && (c = pf[i])) link[i++] = c; while (i < 1023 && lf->symname[j] != ':') link[i++] = lf->symname[j++]; if (i < 1023) link[i++] = '/'; j++; lc = '/'; } while (i < 1023 && (c = lf->symname[j])) { if (c == '/' && lc == '/' && i < 1020) { /* parent dir */ link[i++] = '.'; link[i++] = '.'; } link[i++] = c; lc = c; j++; } link[i] = '/0'; affs_brelse(bh); SetPageUptodate(page); kunmap(page); unlock_page(page); return 0;fail: SetPageError(page); kunmap(page); unlock_page(page); return err;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:55,
示例3: affs_write_inodeintaffs_write_inode(struct inode *inode, struct writeback_control *wbc){ struct super_block *sb = inode->i_sb; struct buffer_head *bh; struct affs_tail *tail; uid_t uid; gid_t gid; pr_debug("write_inode(%lu)/n", inode->i_ino); if (!inode->i_nlink) // possibly free block return 0; bh = affs_bread(sb, inode->i_ino); if (!bh) { affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); return -EIO; } tail = AFFS_TAIL(sb, bh); if (tail->stype == cpu_to_be32(ST_ROOT)) { affs_secs_to_datestamp(inode->i_mtime.tv_sec, &AFFS_ROOT_TAIL(sb, bh)->root_change); } else { tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect); tail->size = cpu_to_be32(inode->i_size); affs_secs_to_datestamp(inode->i_mtime.tv_sec, &tail->change); if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { uid = i_uid_read(inode); gid = i_gid_read(inode); if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_MUFS)) { if (uid == 0 || uid == 0xFFFF) uid = uid ^ ~0; if (gid == 0 || gid == 0xFFFF) gid = gid ^ ~0; } if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETUID)) tail->uid = cpu_to_be16(uid); if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETGID)) tail->gid = cpu_to_be16(gid); } } affs_fix_checksum(sb, bh); mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); affs_free_prealloc(inode); return 0;}
开发者ID:BWhitten,项目名称:linux-stable,代码行数:48,
示例4: affs_statfsstatic intaffs_statfs(struct super_block *sb, struct kstatfs *buf){ int free; pr_debug("AFFS: statfs() partsize=%d, reserved=%d/n",AFFS_SB(sb)->s_partition_size, AFFS_SB(sb)->s_reserved); free = affs_count_free_blocks(sb); buf->f_type = AFFS_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; buf->f_blocks = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved; buf->f_bfree = free; buf->f_bavail = free; return 0;}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:16,
示例5: affs_lookupstruct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd){ struct super_block *sb = dir->i_sb; struct buffer_head *bh; struct inode *inode = NULL; pr_debug("AFFS: lookup(/"%.*s/")/n",(int)dentry->d_name.len,dentry->d_name.name); affs_lock_dir(dir); bh = affs_find_entry(dir, dentry); affs_unlock_dir(dir); if (IS_ERR(bh)) return ERR_CAST(bh); if (bh) { u32 ino = bh->b_blocknr; /* store the real header ino in d_fsdata for faster lookups */ dentry->d_fsdata = (void *)(long)ino; switch (be32_to_cpu(AFFS_TAIL(sb, bh)->stype)) { //link to dirs disabled //case ST_LINKDIR: case ST_LINKFILE: ino = be32_to_cpu(AFFS_TAIL(sb, bh)->original); } affs_brelse(bh); inode = affs_iget(sb, ino); if (IS_ERR(inode)) return ERR_PTR(PTR_ERR(inode)); } dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations; d_add(dentry, inode); return NULL;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:34,
示例6: affs_createintaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl){ struct super_block *sb = dir->i_sb; struct inode *inode; int error; pr_debug("%s(%lu,/"%pd/",0%ho)/n", __func__, dir->i_ino, dentry, mode); inode = affs_new_inode(dir); if (!inode) return -ENOSPC; inode->i_mode = mode; mode_to_prot(inode); mark_inode_dirty(inode); inode->i_op = &affs_file_inode_operations; inode->i_fop = &affs_file_operations; inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops; error = affs_add_entry(dir, inode, dentry, ST_FILE); if (error) { clear_nlink(inode); iput(inode); return error; } return 0;}
开发者ID:Abioy,项目名称:kasan,代码行数:29,
示例7: affs_createintaffs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd){ struct super_block *sb = dir->i_sb; struct inode *inode; int error; pr_debug("AFFS: create(%lu,/"%.*s/",0%o)/n",dir->i_ino,(int)dentry->d_name.len, dentry->d_name.name,mode); inode = affs_new_inode(dir); if (!inode) return -ENOSPC; inode->i_mode = mode; mode_to_prot(inode); mark_inode_dirty(inode); inode->i_op = &affs_file_inode_operations; inode->i_fop = &affs_file_operations; inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops; error = affs_add_entry(dir, inode, dentry, ST_FILE); if (error) { inode->i_nlink = 0; iput(inode); return error; } return 0;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:29,
示例8: affs_remountstatic intaffs_remount(struct super_block *sb, int *flags, char *data){ struct affs_sb_info *sbi = AFFS_SB(sb); int blocksize; uid_t uid; gid_t gid; int mode; int reserved; int root_block; unsigned long mount_flags; int res = 0; char *new_opts = kstrdup(data, GFP_KERNEL); char volume[32]; char *prefix = NULL; pr_debug("AFFS: remount(flags=0x%x,opts=/"%s/")/n",*flags,data); *flags |= MS_NODIRATIME; memcpy(volume, sbi->s_volume, 32); if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block, &blocksize, &prefix, volume, &mount_flags)) { kfree(prefix); kfree(new_opts); return -EINVAL; } lock_kernel(); replace_mount_options(sb, new_opts); sbi->s_flags = mount_flags; sbi->s_mode = mode; sbi->s_uid = uid; sbi->s_gid = gid; /* protect against readers */ spin_lock(&sbi->symlink_lock); if (prefix) { kfree(sbi->s_prefix); sbi->s_prefix = prefix; } memcpy(sbi->s_volume, volume, 32); spin_unlock(&sbi->symlink_lock); if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { unlock_kernel(); return 0; } if (*flags & MS_RDONLY) { sb->s_dirt = 1; while (sb->s_dirt) affs_write_super(sb); affs_free_bitmap(sb); } else res = affs_init_bitmap(sb, flags); unlock_kernel(); return res;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:59,
示例9: affs_put_superstatic voidaffs_put_super(struct super_block *sb){ struct affs_sb_info *sbi = AFFS_SB(sb); pr_debug("AFFS: put_super()/n"); cancel_delayed_work_sync(&sbi->sb_work);}
开发者ID:908626950,项目名称:linux,代码行数:8,
示例10: affs_notify_changeintaffs_notify_change(struct dentry *dentry, struct iattr *attr){ struct inode *inode = d_inode(dentry); int error; pr_debug("notify_change(%lu,0x%x)/n", inode->i_ino, attr->ia_valid); error = setattr_prepare(dentry, attr); if (error) goto out; if (((attr->ia_valid & ATTR_UID) && affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETUID)) || ((attr->ia_valid & ATTR_GID) && affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETGID)) || ((attr->ia_valid & ATTR_MODE) && (AFFS_SB(inode->i_sb)->s_flags & (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) { if (!affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_QUIET)) error = -EPERM; goto out; } if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size != i_size_read(inode)) { error = inode_newsize_ok(inode, attr->ia_size); if (error) return error; truncate_setsize(inode, attr->ia_size); affs_truncate(inode); } setattr_copy(inode, attr); mark_inode_dirty(inode); if (attr->ia_valid & ATTR_MODE) affs_mode_to_prot(inode);out: return error;}
开发者ID:BWhitten,项目名称:linux-stable,代码行数:42,
示例11: affs_kill_sbstatic void affs_kill_sb(struct super_block *sb){ struct affs_sb_info *sbi = AFFS_SB(sb); kill_block_super(sb); if (sbi) { affs_free_bitmap(sb); affs_brelse(sbi->s_root_bh); kfree(sbi->s_prefix); kfree(sbi); }}
开发者ID:908626950,项目名称:linux,代码行数:11,
示例12: affs_hash_nameintaffs_hash_name(struct super_block *sb, const u8 *name, unsigned int len){ toupper_t toupper = affs_get_toupper(sb); int hash; hash = len = min(len, 30u); for (; len > 0; len--) hash = (hash * 13 + toupper(*name++)) & 0x7ff; return hash % AFFS_SB(sb)->s_hashsize;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:12,
示例13: affs_statfsstatic intaffs_statfs(struct dentry *dentry, struct kstatfs *buf){ struct super_block *sb = dentry->d_sb; int free; u64 id = huge_encode_dev(sb->s_bdev->bd_dev); pr_debug("AFFS: statfs() partsize=%d, reserved=%d/n",AFFS_SB(sb)->s_partition_size, AFFS_SB(sb)->s_reserved); free = affs_count_free_blocks(sb); buf->f_type = AFFS_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; buf->f_blocks = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved; buf->f_bfree = free; buf->f_bavail = free; buf->f_fsid.val[0] = (u32)id; buf->f_fsid.val[1] = (u32)(id >> 32); buf->f_namelen = 30; return 0;}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:21,
示例14: affs_commit_superstatic voidaffs_commit_super(struct super_block *sb, int clean){ struct affs_sb_info *sbi = AFFS_SB(sb); struct buffer_head *bh = sbi->s_root_bh; struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); tail->bm_flag = cpu_to_be32(clean); secs_to_datestamp(get_seconds(), &tail->disk_change); affs_fix_checksum(sb, bh); mark_buffer_dirty(bh);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:12,
示例15: affs_put_superstatic voidaffs_put_super(struct super_block *sb){ struct affs_sb_info *sbi = AFFS_SB(sb); pr_debug("AFFS: put_super()/n"); if (!(sb->s_flags & MS_RDONLY) && sb->s_dirt) affs_commit_super(sb, 1, 1); kfree(sbi->s_prefix); affs_free_bitmap(sb); affs_brelse(sbi->s_root_bh); kfree(sbi); sb->s_fs_info = NULL;}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:15,
示例16: affs_mark_sb_dirtyvoid affs_mark_sb_dirty(struct super_block *sb){ struct affs_sb_info *sbi = AFFS_SB(sb); unsigned long delay; if (sb->s_flags & MS_RDONLY) return; spin_lock(&sbi->work_lock); if (!sbi->work_queued) { delay = msecs_to_jiffies(dirty_writeback_interval * 10); queue_delayed_work(system_long_wq, &sbi->sb_work, delay); sbi->work_queued = 1; } spin_unlock(&sbi->work_lock);}
开发者ID:908626950,项目名称:linux,代码行数:16,
示例17: affs_commit_superstatic voidaffs_commit_super(struct super_block *sb, int wait){ struct affs_sb_info *sbi = AFFS_SB(sb); struct buffer_head *bh = sbi->s_root_bh; struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); lock_buffer(bh); secs_to_datestamp(get_seconds(), &tail->disk_change); affs_fix_checksum(sb, bh); unlock_buffer(bh); mark_buffer_dirty(bh); if (wait) sync_dirty_buffer(bh);}
开发者ID:908626950,项目名称:linux,代码行数:16,
示例18: affs_remountstatic intaffs_remount(struct super_block *sb, int *flags, char *data){ struct affs_sb_info *sbi = AFFS_SB(sb); int blocksize; uid_t uid; gid_t gid; int mode; int reserved; int root_block; unsigned long mount_flags; int res = 0; char *new_opts = kstrdup(data, GFP_KERNEL); pr_debug("AFFS: remount(flags=0x%x,opts=/"%s/")/n",*flags,data); *flags |= MS_NODIRATIME; if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block, &blocksize, &sbi->s_prefix, sbi->s_volume, &mount_flags)) { kfree(new_opts); return -EINVAL; } kfree(sb->s_options); sb->s_options = new_opts; sbi->s_flags = mount_flags; sbi->s_mode = mode; sbi->s_uid = uid; sbi->s_gid = gid; if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) return 0; if (*flags & MS_RDONLY) { sb->s_dirt = 1; while (sb->s_dirt) affs_write_super(sb); affs_free_bitmap(sb); } else res = affs_init_bitmap(sb, flags); return res;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:44,
示例19: affs_put_superstatic voidaffs_put_super(struct super_block *sb){ struct affs_sb_info *sbi = AFFS_SB(sb); pr_debug("AFFS: put_super()/n"); if (!(sb->s_flags & MS_RDONLY)) { AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); mark_buffer_dirty(sbi->s_root_bh); } kfree(sbi->s_prefix); affs_free_bitmap(sb); affs_brelse(sbi->s_root_bh); kfree(sbi); sb->s_fs_info = NULL; return;}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:21,
示例20: affs_write_superstatic voidaffs_write_super(struct super_block *sb){ int clean = 2; struct affs_sb_info *sbi = AFFS_SB(sb); if (!(sb->s_flags & MS_RDONLY)) { // if (sbi->s_bitmap[i].bm_bh) { // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) { // clean = 0; AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(clean); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); mark_buffer_dirty(sbi->s_root_bh); sb->s_dirt = !clean; /* redo until bitmap synced */ } else sb->s_dirt = 0; pr_debug("AFFS: write_super() at %lu, clean=%d/n", get_seconds(), clean);}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:21,
示例21: affs_empty_dirstatic intaffs_empty_dir(struct inode *inode){ struct super_block *sb = inode->i_sb; struct buffer_head *bh; int retval, size; retval = -EIO; bh = affs_bread(sb, inode->i_ino); if (!bh) goto done; retval = -ENOTEMPTY; for (size = AFFS_SB(sb)->s_hashsize - 1; size >= 0; size--) if (AFFS_HEAD(bh)->table[size]) goto not_empty; retval = 0;not_empty: affs_brelse(bh);done: return retval;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:22,
示例22: affs_remountstatic intaffs_remount(struct super_block *sb, int *flags, char *data){ struct affs_sb_info *sbi = AFFS_SB(sb); int blocksize; uid_t uid; gid_t gid; int mode; int reserved; int root_block; unsigned long mount_flags; unsigned long read_only = sbi->s_flags & SF_READONLY; pr_debug("AFFS: remount(flags=0x%x,opts=/"%s/")/n",*flags,data); if (!parse_options(data,&uid,&gid,&mode,&reserved,&root_block, &blocksize,&sbi->s_prefix,sbi->s_volume,&mount_flags)) return -EINVAL; sbi->s_flags = mount_flags | read_only; sbi->s_mode = mode; sbi->s_uid = uid; sbi->s_gid = gid; if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) return 0; if (*flags & MS_RDONLY) { sb->s_dirt = 1; while (sb->s_dirt) affs_write_super(sb); sb->s_flags |= MS_RDONLY; } else if (!(sbi->s_flags & SF_READONLY)) { sb->s_flags &= ~MS_RDONLY; } else { affs_warning(sb,"remount","Cannot remount fs read/write because of errors"); return -EINVAL; } return 0;}
开发者ID:xricson,项目名称:knoppix,代码行数:38,
示例23: affs_readdirstatic intaffs_readdir(struct file *file, struct dir_context *ctx){ struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; struct buffer_head *dir_bh = NULL; struct buffer_head *fh_bh = NULL; unsigned char *name; int namelen; u32 i; int hash_pos; int chain_pos; u32 ino; int error = 0; pr_debug("%s(ino=%lu,f_pos=%llx)/n", __func__, inode->i_ino, ctx->pos); if (ctx->pos < 2) { file->private_data = (void *)0; if (!dir_emit_dots(file, ctx)) return 0; } affs_lock_dir(inode); chain_pos = (ctx->pos - 2) & 0xffff; hash_pos = (ctx->pos - 2) >> 16; if (chain_pos == 0xffff) { affs_warning(sb, "readdir", "More than 65535 entries in chain"); chain_pos = 0; hash_pos++; ctx->pos = ((hash_pos << 16) | chain_pos) + 2; } dir_bh = affs_bread(sb, inode->i_ino); if (!dir_bh) goto out_unlock_dir; /* If the directory hasn't changed since the last call to readdir(), * we can jump directly to where we left off. */ ino = (u32)(long)file->private_data; if (ino && file->f_version == inode->i_version) { pr_debug("readdir() left off=%d/n", ino); goto inside; } ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]); for (i = 0; ino && i < chain_pos; i++) { fh_bh = affs_bread(sb, ino); if (!fh_bh) { affs_error(sb, "readdir","Cannot read block %d", i); error = -EIO; goto out_brelse_dir; } ino = be32_to_cpu(AFFS_TAIL(sb, fh_bh)->hash_chain); affs_brelse(fh_bh); fh_bh = NULL; } if (ino) goto inside; hash_pos++; for (; hash_pos < AFFS_SB(sb)->s_hashsize; hash_pos++) { ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]); if (!ino) continue; ctx->pos = (hash_pos << 16) + 2;inside: do { fh_bh = affs_bread(sb, ino); if (!fh_bh) { affs_error(sb, "readdir", "Cannot read block %d", ino); break; } namelen = min(AFFS_TAIL(sb, fh_bh)->name[0], (u8)AFFSNAMEMAX); name = AFFS_TAIL(sb, fh_bh)->name + 1; pr_debug("readdir(): dir_emit(/"%.*s/", ino=%u), hash=%d, f_pos=%llx/n", namelen, name, ino, hash_pos, ctx->pos); if (!dir_emit(ctx, name, namelen, ino, DT_UNKNOWN)) goto done; ctx->pos++; ino = be32_to_cpu(AFFS_TAIL(sb, fh_bh)->hash_chain); affs_brelse(fh_bh); fh_bh = NULL; } while (ino); }done: file->f_version = inode->i_version; file->private_data = (void *)(long)ino; affs_brelse(fh_bh);out_brelse_dir: affs_brelse(dir_bh);out_unlock_dir: affs_unlock_dir(inode); return error;//.........这里部分代码省略.........
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:101,
示例24: affs_get_toupperstatic inline toupper_taffs_get_toupper(struct super_block *sb){ return affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL) ? affs_intl_toupper : affs_toupper;}
开发者ID:020gzh,项目名称:linux,代码行数:6,
示例25: affs_get_toupperstatic inline toupper_taffs_get_toupper(struct super_block *sb){ return AFFS_SB(sb)->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:5,
示例26: affs_symlinkintaffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname){ struct super_block *sb = dir->i_sb; struct buffer_head *bh; struct inode *inode; char *p; int i, maxlen, error; char c, lc; pr_debug("AFFS: symlink(%lu,/"%.*s/" -> /"%s/")/n",dir->i_ino, (int)dentry->d_name.len,dentry->d_name.name,symname); maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; inode = affs_new_inode(dir); if (!inode) return -ENOSPC; inode->i_op = &affs_symlink_inode_operations; inode->i_data.a_ops = &affs_symlink_aops; inode->i_mode = S_IFLNK | 0777; mode_to_prot(inode); error = -EIO; bh = affs_bread(sb, inode->i_ino); if (!bh) goto err; i = 0; p = (char *)AFFS_HEAD(bh)->table; lc = '/'; if (*symname == '/') { struct affs_sb_info *sbi = AFFS_SB(sb); while (*symname == '/') symname++; spin_lock(&sbi->symlink_lock); while (sbi->s_volume[i]) /* Cannot overflow */ *p++ = sbi->s_volume[i++]; spin_unlock(&sbi->symlink_lock); } while (i < maxlen && (c = *symname++)) { if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') { *p++ = '/'; i++; symname += 2; lc = '/'; } else if (c == '.' && lc == '/' && *symname == '/') { symname++; lc = '/'; } else { *p++ = c; lc = c; i++; } if (lc == '/') while (*symname == '/') symname++; } *p = 0; mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); mark_inode_dirty(inode); error = affs_add_entry(dir, inode, dentry, ST_SOFTLINK); if (error) goto err; return 0;err: inode->i_nlink = 0; mark_inode_dirty(inode); iput(inode); return error;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:74,
示例27: affs_fill_super//.........这里部分代码省略......... /* Keep super block in cache */ sbi->s_root_bh = root_bh; root_block = sbi->s_root_block; /* Find out which kind of FS we have */ boot_bh = sb_bread(sb, 0); if (!boot_bh) { printk(KERN_ERR "AFFS: Cannot read boot block/n"); return -EINVAL; } memcpy(sig, boot_bh->b_data, 4); brelse(boot_bh); chksum = be32_to_cpu(*(__be32 *)sig); /* Dircache filesystems are compatible with non-dircache ones * when reading. As long as they aren't supported, writing is * not recommended. */ if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS || chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) { printk(KERN_NOTICE "AFFS: Dircache FS - mounting %s read only/n", sb->s_id); sb->s_flags |= MS_RDONLY; } switch (chksum) { case MUFS_FS: case MUFS_INTLFFS: case MUFS_DCFFS: sbi->s_flags |= SF_MUFS; /* fall thru */ case FS_INTLFFS: case FS_DCFFS: sbi->s_flags |= SF_INTL; break; case MUFS_FFS: sbi->s_flags |= SF_MUFS; break; case FS_FFS: break; case MUFS_OFS: sbi->s_flags |= SF_MUFS; /* fall thru */ case FS_OFS: sbi->s_flags |= SF_OFS; sb->s_flags |= MS_NOEXEC; break; case MUFS_DCOFS: case MUFS_INTLOFS: sbi->s_flags |= SF_MUFS; case FS_DCOFS: case FS_INTLOFS: sbi->s_flags |= SF_INTL | SF_OFS; sb->s_flags |= MS_NOEXEC; break; default: printk(KERN_ERR "AFFS: Unknown filesystem on device %s: %08X/n", sb->s_id, chksum); return -EINVAL; } if (mount_flags & SF_VERBOSE) { u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; printk(KERN_NOTICE "AFFS: Mounting volume /"%.*s/": Type=%.3s//%c, Blocksize=%d/n", len > 31 ? 31 : len, AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1, sig, sig[3] + '0', blocksize); } sb->s_flags |= MS_NODEV | MS_NOSUID; sbi->s_data_blksize = sb->s_blocksize; if (sbi->s_flags & SF_OFS) sbi->s_data_blksize -= 24; tmp_flags = sb->s_flags; ret = affs_init_bitmap(sb, &tmp_flags); if (ret) return ret; sb->s_flags = tmp_flags; /* set up enough so that it can read an inode */ root_inode = affs_iget(sb, root_block); if (IS_ERR(root_inode)) return PTR_ERR(root_inode); if (AFFS_SB(sb)->s_flags & SF_INTL) sb->s_d_op = &affs_intl_dentry_operations; else sb->s_d_op = &affs_dentry_operations; sb->s_root = d_make_root(root_inode); if (!sb->s_root) { printk(KERN_ERR "AFFS: Get root inode failed/n"); return -ENOMEM; } pr_debug("AFFS: s_flags=%lX/n",sb->s_flags); return 0;}
开发者ID:908626950,项目名称:linux,代码行数:101,
示例28: affs_readdirstatic intaffs_readdir(struct file *filp, void *dirent, filldir_t filldir){ struct inode *inode = filp->f_path.dentry->d_inode; struct super_block *sb = inode->i_sb; struct buffer_head *dir_bh; struct buffer_head *fh_bh; unsigned char *name; int namelen; u32 i; int hash_pos; int chain_pos; u32 f_pos; u32 ino; int stored; int res; pr_debug("AFFS: readdir(ino=%lu,f_pos=%lx)/n",inode->i_ino,(unsigned long)filp->f_pos); stored = 0; res = -EIO; dir_bh = NULL; fh_bh = NULL; f_pos = filp->f_pos; if (f_pos == 0) { filp->private_data = (void *)0; if (filldir(dirent, ".", 1, f_pos, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = f_pos = 1; stored++; } if (f_pos == 1) { if (filldir(dirent, "..", 2, f_pos, parent_ino(filp->f_path.dentry), DT_DIR) < 0) return stored; filp->f_pos = f_pos = 2; stored++; } affs_lock_dir(inode); chain_pos = (f_pos - 2) & 0xffff; hash_pos = (f_pos - 2) >> 16; if (chain_pos == 0xffff) { affs_warning(sb, "readdir", "More than 65535 entries in chain"); chain_pos = 0; hash_pos++; filp->f_pos = ((hash_pos << 16) | chain_pos) + 2; } dir_bh = affs_bread(sb, inode->i_ino); if (!dir_bh) goto readdir_out; ino = (u32)(long)filp->private_data; if (ino && filp->f_version == inode->i_version) { pr_debug("AFFS: readdir() left off=%d/n", ino); goto inside; } ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]); for (i = 0; ino && i < chain_pos; i++) { fh_bh = affs_bread(sb, ino); if (!fh_bh) { affs_error(sb, "readdir","Cannot read block %d", i); goto readdir_out; } ino = be32_to_cpu(AFFS_TAIL(sb, fh_bh)->hash_chain); affs_brelse(fh_bh); fh_bh = NULL; } if (ino) goto inside; hash_pos++; for (; hash_pos < AFFS_SB(sb)->s_hashsize; hash_pos++) { ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]); if (!ino) continue; f_pos = (hash_pos << 16) + 2;inside: do { fh_bh = affs_bread(sb, ino); if (!fh_bh) { affs_error(sb, "readdir","Cannot read block %d", ino); goto readdir_done; } namelen = min(AFFS_TAIL(sb, fh_bh)->name[0], (u8)30); name = AFFS_TAIL(sb, fh_bh)->name + 1; pr_debug("AFFS: readdir(): filldir(/"%.*s/", ino=%u), hash=%d, f_pos=%x/n", namelen, name, ino, hash_pos, f_pos); if (filldir(dirent, name, namelen, f_pos, ino, DT_UNKNOWN) < 0) goto readdir_done; stored++; f_pos++; ino = be32_to_cpu(AFFS_TAIL(sb, fh_bh)->hash_chain); affs_brelse(fh_bh); fh_bh = NULL; } while (ino); }readdir_done://.........这里部分代码省略.........
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:101,
注:本文中的AFFS_SB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AFREE函数代码示例 C++ AFD_DbgPrint函数代码示例 |