这篇教程C++ AFS_FS_I函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AFS_FS_I函数的典型用法代码示例。如果您正苦于以下问题:C++ AFS_FS_I函数的具体用法?C++ AFS_FS_I怎么用?C++ AFS_FS_I使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AFS_FS_I函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: afs_rmdir/* * remove a directory from an AFS filesystem */static int afs_rmdir(struct inode *dir, struct dentry *dentry){ struct afs_vnode *dvnode, *vnode; struct key *key; int ret; dvnode = AFS_FS_I(dir); _enter("{%x:%u},{%pd}", dvnode->fid.vid, dvnode->fid.vnode, dentry); key = afs_request_key(dvnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } ret = afs_vnode_remove(dvnode, key, dentry->d_name.name, true); if (ret < 0) goto rmdir_error; if (d_really_is_positive(dentry)) { vnode = AFS_FS_I(d_inode(dentry)); clear_nlink(&vnode->vfs_inode); set_bit(AFS_VNODE_DELETED, &vnode->flags); afs_discard_callback_on_delete(vnode); } key_put(key); _leave(" = 0"); return 0;rmdir_error: key_put(key);error: _leave(" = %d", ret); return ret;}
开发者ID:mdamt,项目名称:linux,代码行数:41,
示例2: afs_link/* * create a hard link between files in an AFS filesystem */static int afs_link(struct dentry *from, struct inode *dir, struct dentry *dentry){ struct afs_vnode *dvnode, *vnode; struct key *key; int ret; vnode = AFS_FS_I(d_inode(from)); dvnode = AFS_FS_I(dir); _enter("{%x:%u},{%x:%u},{%pd}", vnode->fid.vid, vnode->fid.vnode, dvnode->fid.vid, dvnode->fid.vnode, dentry); key = afs_request_key(dvnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } ret = afs_vnode_link(dvnode, vnode, key, dentry->d_name.name); if (ret < 0) goto link_error; ihold(&vnode->vfs_inode); d_instantiate(dentry, &vnode->vfs_inode); key_put(key); _leave(" = 0"); return 0;link_error: key_put(key);error: d_drop(dentry); _leave(" = %d", ret); return ret;}
开发者ID:513855417,项目名称:linux,代码行数:41,
示例3: afs_dir_open/* * open an AFS directory file */static int afs_dir_open(struct inode *inode, struct file *file){ _enter("{%lu}", inode->i_ino); BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048); BUILD_BUG_ON(sizeof(union afs_dirent) != 32); if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED) return -ENOENT; _leave(" = 0"); return 0;} /* end afs_dir_open() */
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:17,
示例4: afs_setattr/* * set the attributes of an inode */int afs_setattr(struct dentry *dentry, struct iattr *attr){ struct afs_fs_cursor fc; struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); struct key *key; int ret; _enter("{%x:%u},{n=%pd},%x", vnode->fid.vid, vnode->fid.vnode, dentry, attr->ia_valid); if (!(attr->ia_valid & (ATTR_SIZE | ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME))) { _leave(" = 0 [unsupported]"); return 0; } /* flush any dirty data outstanding on a regular file */ if (S_ISREG(vnode->vfs_inode.i_mode)) filemap_write_and_wait(vnode->vfs_inode.i_mapping); if (attr->ia_valid & ATTR_FILE) { key = afs_file_key(attr->ia_file); } else { key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } } ret = -ERESTARTSYS; if (afs_begin_vnode_operation(&fc, vnode, key)) { while (afs_select_fileserver(&fc)) { fc.cb_break = vnode->cb_break + vnode->cb_s_break; afs_fs_setattr(&fc, attr); } afs_check_for_remote_deletion(&fc, fc.vnode); afs_vnode_commit_status(&fc, vnode, fc.cb_break); ret = afs_end_vnode_operation(&fc); } if (!(attr->ia_valid & ATTR_FILE)) key_put(key);error: _leave(" = %d", ret); return ret;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:53,
示例5: afs_evict_inode/* * clear an AFS inode */void afs_evict_inode(struct inode *inode){ struct afs_permits *permits; struct afs_vnode *vnode; vnode = AFS_FS_I(inode); _enter("{%x:%u.%d} v=%u x=%u t=%u }", vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique, vnode->cb_version, vnode->cb_expiry, vnode->cb_type); _debug("CLEAR INODE %p", inode); ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode); truncate_inode_pages_final(&inode->i_data); clear_inode(inode); afs_give_up_callback(vnode); if (vnode->server) { spin_lock(&vnode->server->fs_lock); rb_erase(&vnode->server_rb, &vnode->server->fs_vnodes); spin_unlock(&vnode->server->fs_lock); afs_put_server(vnode->server); vnode->server = NULL; } ASSERT(list_empty(&vnode->writebacks)); ASSERT(!vnode->cb_promised);#ifdef CONFIG_AFS_FSCACHE fscache_relinquish_cookie(vnode->cache, 0); vnode->cache = NULL;#endif mutex_lock(&vnode->permits_lock); permits = vnode->permits; rcu_assign_pointer(vnode->permits, NULL); mutex_unlock(&vnode->permits_lock); if (permits) call_rcu(&permits->rcu, afs_zap_permits); _leave("");}
开发者ID:020gzh,项目名称:linux,代码行数:52,
示例6: afs_statfs/* * return information about an AFS volume */static int afs_statfs(struct dentry *dentry, struct kstatfs *buf){ struct afs_super_info *as = AFS_FS_S(dentry->d_sb); struct afs_fs_cursor fc; struct afs_volume_status vs; struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); struct key *key; int ret; buf->f_type = dentry->d_sb->s_magic; buf->f_bsize = AFS_BLOCK_SIZE; buf->f_namelen = AFSNAMEMAX - 1; if (as->dyn_root) { buf->f_blocks = 1; buf->f_bavail = 0; buf->f_bfree = 0; return 0; } key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) return PTR_ERR(key); ret = -ERESTARTSYS; if (afs_begin_vnode_operation(&fc, vnode, key)) { fc.flags |= AFS_FS_CURSOR_NO_VSLEEP; while (afs_select_fileserver(&fc)) { fc.cb_break = afs_calc_vnode_cb_break(vnode); afs_fs_get_volume_status(&fc, &vs); } afs_check_for_remote_deletion(&fc, fc.vnode); afs_vnode_commit_status(&fc, vnode, fc.cb_break); ret = afs_end_vnode_operation(&fc); } key_put(key); if (ret == 0) { if (vs.max_quota == 0) buf->f_blocks = vs.part_max_blocks; else buf->f_blocks = vs.max_quota; buf->f_bavail = buf->f_bfree = buf->f_blocks - vs.blocks_in_use; } return ret;}
开发者ID:Anjali05,项目名称:linux,代码行数:52,
示例7: afs_file_releasepage/* * release a page and cleanup its private data */static int afs_file_releasepage(struct page *page, gfp_t gfp_flags){ _enter("{%lu},%x", page->index, gfp_flags);#ifdef CONFIG_AFS_FSCACHE wait_on_page_fs_misc(page); fscache_uncache_page(AFS_FS_I(page->mapping->host)->cache, page); ClearPagePrivate(page);#endif /* indicate that the page can be released */ _leave(" = 1"); return 1;} /* end afs_file_releasepage() */
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:18,
示例8: afs_inode_fetch_status/* * attempt to fetch the status of an inode, coelescing multiple simultaneous * fetches */static int afs_inode_fetch_status(struct inode *inode){ struct afs_vnode *vnode; int ret; vnode = AFS_FS_I(inode); ret = afs_vnode_fetch_status(vnode); if (ret == 0) ret = afs_inode_map_status(vnode); return ret;} /* end afs_inode_fetch_status() */
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:19,
示例9: afs_write_end/* * finalise part of a write to a page */int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata){ struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); struct key *key = afs_file_key(file); loff_t i_size, maybe_i_size; int ret; _enter("{%x:%u},{%lx}", vnode->fid.vid, vnode->fid.vnode, page->index); maybe_i_size = pos + copied; i_size = i_size_read(&vnode->vfs_inode); if (maybe_i_size > i_size) { spin_lock(&vnode->wb_lock); i_size = i_size_read(&vnode->vfs_inode); if (maybe_i_size > i_size) i_size_write(&vnode->vfs_inode, maybe_i_size); spin_unlock(&vnode->wb_lock); } if (!PageUptodate(page)) { if (copied < len) { /* Try and load any missing data from the server. The * unmarshalling routine will take care of clearing any * bits that are beyond the EOF. */ ret = afs_fill_page(vnode, key, pos + copied, len - copied, page); if (ret < 0) goto out; } SetPageUptodate(page); } set_page_dirty(page); if (PageDirty(page)) _debug("dirtied"); ret = copied;out: unlock_page(page); put_page(page); return ret;}
开发者ID:krzk,项目名称:linux,代码行数:50,
示例10: afs_getattr/* * read the attributes of an inode */int afs_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags){ struct inode *inode = d_inode(path->dentry); struct afs_vnode *vnode = AFS_FS_I(inode); int seq = 0; _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); do { read_seqbegin_or_lock(&vnode->cb_lock, &seq); generic_fillattr(inode, stat); } while (need_seqretry(&vnode->cb_lock, seq)); done_seqretry(&vnode->cb_lock, seq); return 0;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:20,
示例11: afs_xattr_get_volume/* * Get the name of the volume on which a file resides. */static int afs_xattr_get_volume(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size){ struct afs_vnode *vnode = AFS_FS_I(inode); const char *volname = vnode->volume->name; size_t namelen; namelen = strlen(volname); if (size == 0) return namelen; if (namelen > size) return -ERANGE; memcpy(buffer, volname, size); return namelen;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:20,
示例12: afs_xattr_get_cell/* * Get the name of the cell on which a file resides. */static int afs_xattr_get_cell(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size){ struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_cell *cell = vnode->volume->cell; size_t namelen; namelen = cell->name_len; if (size == 0) return namelen; if (namelen > size) return -ERANGE; memcpy(buffer, cell->name, size); return namelen;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:20,
示例13: afs_xattr_get_fid/* * Get the volume ID, vnode ID and vnode uniquifier of a file as a sequence of * hex numbers separated by colons. */static int afs_xattr_get_fid(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size){ struct afs_vnode *vnode = AFS_FS_I(inode); char text[8 + 1 + 8 + 1 + 8 + 1]; size_t len; len = sprintf(text, "%llx:%llx:%x", vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); if (size == 0) return len; if (len > size) return -ERANGE; memcpy(buffer, text, len); return len;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:22,
示例14: afs_d_delete/* * allow the VFS to enquire as to whether a dentry should be unhashed (mustn't * sleep) * - called from dput() when d_count is going to 0. * - return 1 to request dentry be unhashed, 0 otherwise */static int afs_d_delete(struct dentry *dentry){ _enter("%s", dentry->d_name.name); if (dentry->d_flags & DCACHE_NFSFS_RENAMED) goto zap; if (dentry->d_inode && test_bit(AFS_VNODE_DELETED, &AFS_FS_I(dentry->d_inode)->flags)) goto zap; _leave(" = 0 [keep]"); return 0;zap: _leave(" = 1 [zap]"); return 1;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:24,
示例15: afs_releasepage/* * release a page and cleanup its private data */static int afs_releasepage(struct page *page, gfp_t gfp_flags){ struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); struct afs_writeback *wb; _enter("{{%x:%u}[%lu],%lx},%x", vnode->fid.vid, vnode->fid.vnode, page->index, page->flags, gfp_flags); if (PagePrivate(page)) { wb = (struct afs_writeback *) page_private(page); ASSERT(wb != NULL); set_page_private(page, 0); ClearPagePrivate(page); afs_put_writeback(wb); } _leave(" = 0"); return 0;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:23,
示例16: afs_show_options/* * Display the mount options in /proc/mounts. */static int afs_show_options(struct seq_file *m, struct dentry *root){ struct afs_super_info *as = AFS_FS_S(root->d_sb); const char *p = NULL; if (as->dyn_root) seq_puts(m, ",dyn"); if (test_bit(AFS_VNODE_AUTOCELL, &AFS_FS_I(d_inode(root))->flags)) seq_puts(m, ",autocell"); switch (as->flock_mode) { case afs_flock_mode_unset: break; case afs_flock_mode_local: p = "local"; break; case afs_flock_mode_openafs: p = "openafs"; break; case afs_flock_mode_strict: p = "strict"; break; case afs_flock_mode_write: p = "write"; break; } if (p) seq_printf(m, ",flock=%s", p); return 0;}
开发者ID:avagin,项目名称:linux,代码行数:24,
示例17: afs_setattr/* * set the attributes of an inode */int afs_setattr(struct dentry *dentry, struct iattr *attr){ struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); struct key *key; int ret; _enter("{%x:%u},{n=%pd},%x", vnode->fid.vid, vnode->fid.vnode, dentry, attr->ia_valid); if (!(attr->ia_valid & (ATTR_SIZE | ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME))) { _leave(" = 0 [unsupported]"); return 0; } /* flush any dirty data outstanding on a regular file */ if (S_ISREG(vnode->vfs_inode.i_mode)) { filemap_write_and_wait(vnode->vfs_inode.i_mapping); afs_writeback_all(vnode); } if (attr->ia_valid & ATTR_FILE) { key = attr->ia_file->private_data; } else { key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } } ret = afs_vnode_setattr(vnode, key, attr); if (!(attr->ia_valid & ATTR_FILE)) key_put(key);error: _leave(" = %d", ret); return ret;}
开发者ID:020gzh,项目名称:linux,代码行数:43,
示例18: afs_file_releasepage/* * release a page and cleanup its private data */static int afs_file_releasepage(struct page *page, gfp_t gfp_flags){ struct cachefs_page *pageio; _enter("{%lu},%x", page->index, gfp_flags); if (PagePrivate(page)) {#ifdef AFS_CACHING_SUPPORT struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); cachefs_uncache_page(vnode->cache, page);#endif pageio = (struct cachefs_page *) page_private(page); set_page_private(page, 0); ClearPagePrivate(page); kfree(pageio); } _leave(" = 0"); return 0;} /* end afs_file_releasepage() */
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:25,
示例19: _enterstatic struct afs_vnode *afs_get_auth_inode(struct afs_vnode *vnode, struct key *key){ struct afs_vnode *auth_vnode; struct inode *auth_inode; _enter(""); if (S_ISDIR(vnode->vfs_inode.i_mode)) { auth_inode = igrab(&vnode->vfs_inode); ASSERT(auth_inode != NULL); } else { auth_inode = afs_iget(vnode->vfs_inode.i_sb, key, &vnode->status.parent, NULL, NULL); if (IS_ERR(auth_inode)) return ERR_CAST(auth_inode); } auth_vnode = AFS_FS_I(auth_inode); _leave(" = {%x}", auth_vnode->fid.vnode); return auth_vnode;}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:22,
示例20: afs_releasepage/* * release a page and clean up its private state if it's not busy * - return true if the page can now be released, false if not */static int afs_releasepage(struct page *page, gfp_t gfp_flags){ struct afs_writeback *wb = (struct afs_writeback *) page_private(page); struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); _enter("{{%x:%u}[%lu],%lx},%x", vnode->fid.vid, vnode->fid.vnode, page->index, page->flags, gfp_flags); /* deny if page is being written to the cache and the caller hasn't * elected to wait */#ifdef CONFIG_AFS_FSCACHE if (PageFsCache(page)) { if (fscache_check_page_write(vnode->cache, page)) { if (!(gfp_flags & __GFP_WAIT)) { _leave(" = F [cache busy]"); return 0; } fscache_wait_on_page_write(vnode->cache, page); } fscache_uncache_page(vnode->cache, page); ClearPageFsCache(page); }#endif if (PagePrivate(page)) { if (wb) { set_page_private(page, 0); afs_put_writeback(wb); } ClearPagePrivate(page); } /* indicate that the page can be released */ _leave(" = T"); return 1;}
开发者ID:SSLab-NTHU,项目名称:linux-guest-armvisor,代码行数:42,
示例21: afs_evict_inode/* * clear an AFS inode */void afs_evict_inode(struct inode *inode){ struct afs_vnode *vnode; vnode = AFS_FS_I(inode); _enter("{%x:%u.%d}", vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique); _debug("CLEAR INODE %p", inode); ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode); truncate_inode_pages_final(&inode->i_data); clear_inode(inode); if (vnode->cb_interest) { afs_put_cb_interest(afs_i2net(inode), vnode->cb_interest); vnode->cb_interest = NULL; } while (!list_empty(&vnode->wb_keys)) { struct afs_wb_key *wbk = list_entry(vnode->wb_keys.next, struct afs_wb_key, vnode_link); list_del(&wbk->vnode_link); afs_put_wb_key(wbk); }#ifdef CONFIG_AFS_FSCACHE fscache_relinquish_cookie(vnode->cache, 0); vnode->cache = NULL;#endif afs_put_permits(vnode->permit_cache); _leave("");}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:41,
示例22: afs_kill_pages/* * kill all the pages in the given range */static void afs_kill_pages(struct address_space *mapping, pgoff_t first, pgoff_t last){ struct afs_vnode *vnode = AFS_FS_I(mapping->host); struct pagevec pv; unsigned count, loop; _enter("{%x:%u},%lx-%lx", vnode->fid.vid, vnode->fid.vnode, first, last); pagevec_init(&pv); do { _debug("kill %lx-%lx", first, last); count = last - first + 1; if (count > PAGEVEC_SIZE) count = PAGEVEC_SIZE; pv.nr = find_get_pages_contig(mapping, first, count, pv.pages); ASSERTCMP(pv.nr, ==, count); for (loop = 0; loop < count; loop++) { struct page *page = pv.pages[loop]; ClearPageUptodate(page); SetPageError(page); end_page_writeback(page); if (page->index >= first) first = page->index + 1; lock_page(page); generic_error_remove_page(mapping, page); } __pagevec_release(&pv); } while (first <= last); _leave("");}
开发者ID:krzk,项目名称:linux,代码行数:40,
示例23: afs_redirty_pages/* * Redirty all the pages in a given range. */static void afs_redirty_pages(struct writeback_control *wbc, struct address_space *mapping, pgoff_t first, pgoff_t last){ struct afs_vnode *vnode = AFS_FS_I(mapping->host); struct pagevec pv; unsigned count, loop; _enter("{%x:%u},%lx-%lx", vnode->fid.vid, vnode->fid.vnode, first, last); pagevec_init(&pv); do { _debug("redirty %lx-%lx", first, last); count = last - first + 1; if (count > PAGEVEC_SIZE) count = PAGEVEC_SIZE; pv.nr = find_get_pages_contig(mapping, first, count, pv.pages); ASSERTCMP(pv.nr, ==, count); for (loop = 0; loop < count; loop++) { struct page *page = pv.pages[loop]; redirty_page_for_writepage(wbc, page); end_page_writeback(page); if (page->index >= first) first = page->index + 1; } __pagevec_release(&pv); } while (first <= last); _leave("");}
开发者ID:krzk,项目名称:linux,代码行数:39,
示例24: afs_open/* * open an AFS file or directory and attach a key to it */int afs_open(struct inode *inode, struct file *file){ struct afs_vnode *vnode = AFS_FS_I(inode); struct key *key; int ret; _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) { _leave(" = %ld [key]", PTR_ERR(key)); return PTR_ERR(key); } ret = afs_validate(vnode, key); if (ret < 0) { _leave(" = %d [val]", ret); return ret; } file->private_data = key; _leave(" = 0"); return 0;}
开发者ID:SSLab-NTHU,项目名称:linux-guest-armvisor,代码行数:27,
示例25: afs_inode_getattr/* * read the attributes of an inode */int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat){ struct afs_vnode *vnode; struct inode *inode; int ret; inode = dentry->d_inode; _enter("{ ino=%lu v=%lu }", inode->i_ino, inode->i_version); vnode = AFS_FS_I(inode); ret = afs_inode_fetch_status(inode); if (ret == -ENOENT) { _leave(" = %d [%d %p]", ret, atomic_read(&dentry->d_count), dentry->d_inode); return ret; } else if (ret < 0) { make_bad_inode(inode); _leave(" = %d", ret); return ret; } /* transfer attributes from the inode structure to the stat * structure */ generic_fillattr(inode, stat); _leave(" = 0 CB { v=%u x=%u t=%u }", vnode->cb_version, vnode->cb_expiry, vnode->cb_type); return 0;} /* end afs_inode_getattr() */
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:39,
示例26: _enter/* * create a vfsmount to be automounted */static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt){ struct afs_super_info *as; struct vfsmount *mnt; struct afs_vnode *vnode; struct page *page; char *devname, *options; bool rwpath = false; int ret; _enter("{%pd}", mntpt); BUG_ON(!d_inode(mntpt)); ret = -ENOMEM; devname = (char *) get_zeroed_page(GFP_KERNEL); if (!devname) goto error_no_devname; options = (char *) get_zeroed_page(GFP_KERNEL); if (!options) goto error_no_options; vnode = AFS_FS_I(d_inode(mntpt)); if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) { /* if the directory is a pseudo directory, use the d_name */ static const char afs_root_cell[] = ":root.cell."; unsigned size = mntpt->d_name.len; ret = -ENOENT; if (size < 2 || size > AFS_MAXCELLNAME) goto error_no_page; if (mntpt->d_name.name[0] == '.') { devname[0] = '%'; memcpy(devname + 1, mntpt->d_name.name + 1, size - 1); memcpy(devname + size, afs_root_cell, sizeof(afs_root_cell)); rwpath = true; } else { devname[0] = '#'; memcpy(devname + 1, mntpt->d_name.name, size); memcpy(devname + size + 1, afs_root_cell, sizeof(afs_root_cell)); } } else { /* read the contents of the AFS special symlink */ loff_t size = i_size_read(d_inode(mntpt)); char *buf; ret = -EINVAL; if (size > PAGE_SIZE - 1) goto error_no_page; page = read_mapping_page(d_inode(mntpt)->i_mapping, 0, NULL); if (IS_ERR(page)) { ret = PTR_ERR(page); goto error_no_page; } if (PageError(page)) { ret = afs_bad(AFS_FS_I(d_inode(mntpt)), afs_file_error_mntpt); goto error; } buf = kmap_atomic(page); memcpy(devname, buf, size); kunmap_atomic(buf); put_page(page); page = NULL; } /* work out what options we want */ as = AFS_FS_S(mntpt->d_sb); if (as->cell) { memcpy(options, "cell=", 5); strcpy(options + 5, as->cell->name); if ((as->volume && as->volume->type == AFSVL_RWVOL) || rwpath) strcat(options, ",rwpath"); } /* try and do the mount */ _debug("--- attempting mount %s -o %s ---", devname, options); mnt = vfs_submount(mntpt, &afs_fs_type, devname, options); _debug("--- mount result %p ---", mnt); free_page((unsigned long) devname); free_page((unsigned long) options); _leave(" = %p", mnt); return mnt;error: put_page(page);error_no_page: free_page((unsigned long) options);error_no_options: free_page((unsigned long) devname);//.........这里部分代码省略.........
开发者ID:AlexShiLucky,项目名称:linux,代码行数:101,
示例27: afs_create/* * create a regular file on an AFS filesystem */static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl){ struct afs_file_status status; struct afs_callback cb; struct afs_server *server; struct afs_vnode *dvnode, *vnode; struct afs_fid fid; struct inode *inode; struct key *key; int ret; dvnode = AFS_FS_I(dir); _enter("{%x:%u},{%pd},%ho,", dvnode->fid.vid, dvnode->fid.vnode, dentry, mode); key = afs_request_key(dvnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } mode |= S_IFREG; ret = afs_vnode_create(dvnode, key, dentry->d_name.name, mode, &fid, &status, &cb, &server); if (ret < 0) goto create_error; inode = afs_iget(dir->i_sb, key, &fid, &status, &cb); if (IS_ERR(inode)) { /* ENOMEM at a really inconvenient time - just abandon the new * directory on the server */ ret = PTR_ERR(inode); goto iget_error; } /* apply the status report we've got for the new vnode */ vnode = AFS_FS_I(inode); spin_lock(&vnode->lock); vnode->update_cnt++; spin_unlock(&vnode->lock); afs_vnode_finalise_status_update(vnode, server); afs_put_server(server); d_instantiate(dentry, inode); if (d_unhashed(dentry)) { _debug("not hashed"); d_rehash(dentry); } key_put(key); _leave(" = 0"); return 0;iget_error: afs_put_server(server);create_error: key_put(key);error: d_drop(dentry); _leave(" = %d", ret); return ret;}
开发者ID:faddat,项目名称:linux-mainline-next,代码行数:66,
示例28: afs_unlink/* * remove a file from an AFS filesystem */static int afs_unlink(struct inode *dir, struct dentry *dentry){ struct afs_vnode *dvnode, *vnode; struct key *key; int ret; dvnode = AFS_FS_I(dir); _enter("{%x:%u},{%pd}", dvnode->fid.vid, dvnode->fid.vnode, dentry); ret = -ENAMETOOLONG; if (dentry->d_name.len >= AFSNAMEMAX) goto error; key = afs_request_key(dvnode->volume->cell); if (IS_ERR(key)) { ret = PTR_ERR(key); goto error; } if (d_really_is_positive(dentry)) { vnode = AFS_FS_I(d_inode(dentry)); /* make sure we have a callback promise on the victim */ ret = afs_validate(vnode, key); if (ret < 0) goto error; } ret = afs_vnode_remove(dvnode, key, dentry->d_name.name, false); if (ret < 0) goto remove_error; if (d_really_is_positive(dentry)) { /* if the file wasn't deleted due to excess hard links, the * fileserver will break the callback promise on the file - if * it had one - before it returns to us, and if it was deleted, * it won't * * however, if we didn't have a callback promise outstanding, * or it was outstanding on a different server, then it won't * break it either... */ vnode = AFS_FS_I(d_inode(dentry)); if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) _debug("AFS_VNODE_DELETED"); if (test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags)) _debug("AFS_VNODE_CB_BROKEN"); set_bit(AFS_VNODE_CB_BROKEN, &vnode->flags); ret = afs_validate(vnode, key); _debug("nlink %d [val %d]", vnode->vfs_inode.i_nlink, ret); } key_put(key); _leave(" = 0"); return 0;remove_error: key_put(key);error: _leave(" = %d", ret); return ret;}
开发者ID:faddat,项目名称:linux-mainline-next,代码行数:67,
示例29: afs_do_lookup/* * do a lookup in a directory * - just returns the FID the dentry name maps to if found */static int afs_do_lookup(struct inode *dir, struct dentry *dentry, struct afs_fid *fid, struct key *key){ struct afs_super_info *as = dir->i_sb->s_fs_info; struct afs_lookup_cookie cookie = { .ctx.actor = afs_lookup_filldir, .name = dentry->d_name, .fid.vid = as->volume->vid }; int ret; _enter("{%lu},%p{%pd},", dir->i_ino, dentry, dentry); /* search the directory */ ret = afs_dir_iterate(dir, &cookie.ctx, key); if (ret < 0) { _leave(" = %d [iter]", ret); return ret; } ret = -ENOENT; if (!cookie.found) { _leave(" = -ENOENT [not found]"); return -ENOENT; } *fid = cookie.fid; _leave(" = 0 { vn=%u u=%u }", fid->vnode, fid->unique); return 0;}/* * Try to auto mount the mountpoint with pseudo directory, if the autocell * operation is setted. */static struct inode *afs_try_auto_mntpt( int ret, struct dentry *dentry, struct inode *dir, struct key *key, struct afs_fid *fid){ const char *devname = dentry->d_name.name; struct afs_vnode *vnode = AFS_FS_I(dir); struct inode *inode; _enter("%d, %p{%pd}, {%x:%u}, %p", ret, dentry, dentry, vnode->fid.vid, vnode->fid.vnode, key); if (ret != -ENOENT || !test_bit(AFS_VNODE_AUTOCELL, &vnode->flags)) goto out; inode = afs_iget_autocell(dir, devname, strlen(devname), key); if (IS_ERR(inode)) { ret = PTR_ERR(inode); goto out; } *fid = AFS_FS_I(inode)->fid; _leave("= %p", inode); return inode;out: _leave("= %d", ret); return ERR_PTR(ret);}/* * look up an entry in a directory */static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags){ struct afs_vnode *vnode; struct afs_fid fid; struct inode *inode; struct key *key; int ret; vnode = AFS_FS_I(dir); _enter("{%x:%u},%p{%pd},", vnode->fid.vid, vnode->fid.vnode, dentry, dentry); ASSERTCMP(d_inode(dentry), ==, NULL); if (dentry->d_name.len >= AFSNAMEMAX) { _leave(" = -ENAMETOOLONG"); return ERR_PTR(-ENAMETOOLONG); } if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { _leave(" = -ESTALE"); return ERR_PTR(-ESTALE); } key = afs_request_key(vnode->volume->cell); if (IS_ERR(key)) {//.........这里部分代码省略.........
开发者ID:faddat,项目名称:linux-mainline-next,代码行数:101,
示例30: afs_d_revalidate/* * check that a dentry lookup hit has found a valid entry * - NOTE! the hit can be a negative hit too, so we can't assume we have an * inode */static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd){ struct afs_vnode *vnode, *dir; struct afs_fid uninitialized_var(fid); struct dentry *parent; struct key *key; void *dir_version; int ret; if (nd->flags & LOOKUP_RCU) return -ECHILD; vnode = AFS_FS_I(dentry->d_inode); if (dentry->d_inode) _enter("{v={%x:%u} n=%s fl=%lx},", vnode->fid.vid, vnode->fid.vnode, dentry->d_name.name, vnode->flags); else _enter("{neg n=%s}", dentry->d_name.name); key = afs_request_key(AFS_FS_S(dentry->d_sb)->volume->cell); if (IS_ERR(key)) key = NULL; /* lock down the parent dentry so we can peer at it */ parent = dget_parent(dentry); if (!parent->d_inode) goto out_bad; dir = AFS_FS_I(parent->d_inode); /* validate the parent directory */ if (test_bit(AFS_VNODE_MODIFIED, &dir->flags)) afs_validate(dir, key); if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { _debug("%s: parent dir deleted", dentry->d_name.name); goto out_bad; } dir_version = (void *) (unsigned long) dir->status.data_version; if (dentry->d_fsdata == dir_version) goto out_valid; /* the dir contents are unchanged */ _debug("dir modified"); /* search the directory for this vnode */ ret = afs_do_lookup(&dir->vfs_inode, dentry, &fid, key); switch (ret) { case 0: /* the filename maps to something */ if (!dentry->d_inode) goto out_bad; if (is_bad_inode(dentry->d_inode)) { printk("kAFS: afs_d_revalidate: %s/%s has bad inode/n", parent->d_name.name, dentry->d_name.name); goto out_bad; } /* if the vnode ID has changed, then the dirent points to a * different file */ if (fid.vnode != vnode->fid.vnode) { _debug("%s: dirent changed [%u != %u]", dentry->d_name.name, fid.vnode, vnode->fid.vnode); goto not_found; } /* if the vnode ID uniqifier has changed, then the file has * been deleted and replaced, and the original vnode ID has * been reused */ if (fid.unique != vnode->fid.unique) { _debug("%s: file deleted (uq %u -> %u I:%u)", dentry->d_name.name, fid.unique, vnode->fid.unique, dentry->d_inode->i_generation); spin_lock(&vnode->lock); set_bit(AFS_VNODE_DELETED, &vnode->flags); spin_unlock(&vnode->lock); goto not_found; } goto out_valid; case -ENOENT: /* the filename is unknown */ _debug("%s: dirent not found", dentry->d_name.name); if (dentry->d_inode) goto not_found; goto out_valid; default: _debug("failed to iterate dir %s: %d", parent->d_name.name, ret); goto out_bad;//.........这里部分代码省略.........
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:101,
注:本文中的AFS_FS_I函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AFS_STATCNT函数代码示例 C++ AFREE函数代码示例 |