Release 4.11 fs/coda/cnode.c
/* cnode related routines for the coda kernel code
(C) 1996 Peter Braam
*/
#include <linux/types.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/coda.h>
#include <linux/coda_psdev.h>
#include <linux/pagemap.h>
#include "coda_linux.h"
static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
{
return memcmp(fid1, fid2, sizeof(*fid1)) == 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 15 | 45.45% | 1 | 20.00% |
Jan Harkes | 15 | 45.45% | 3 | 60.00% |
Linus Torvalds | 3 | 9.09% | 1 | 20.00% |
Total | 33 | 100.00% | 5 | 100.00% |
static const struct inode_operations coda_symlink_inode_operations = {
.get_link = page_get_link,
.setattr = coda_setattr,
};
/* cnode.c */
static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
{
coda_vattr_to_iattr(inode, attr);
if (S_ISREG(inode->i_mode)) {
inode->i_op = &coda_file_inode_operations;
inode->i_fop = &coda_file_operations;
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &coda_dir_inode_operations;
inode->i_fop = &coda_dir_operations;
} else if (S_ISLNK(inode->i_mode)) {
inode->i_op = &coda_symlink_inode_operations;
inode_nohighmem(inode);
inode->i_data.a_ops = &coda_symlink_aops;
inode->i_mapping = &inode->i_data;
} else
init_special_inode(inode, inode->i_mode, huge_decode_dev(attr->va_rdev));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 125 | 93.98% | 6 | 66.67% |
Al Viro | 8 | 6.02% | 3 | 33.33% |
Total | 133 | 100.00% | 9 | 100.00% |
static int coda_test_inode(struct inode *inode, void *data)
{
struct CodaFid *fid = (struct CodaFid *)data;
struct coda_inode_info *cii = ITOC(inode);
return coda_fideq(&cii->c_fid, fid);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jan Harkes | 37 | 77.08% | 2 | 66.67% |
Yoshihisa Abe | 11 | 22.92% | 1 | 33.33% |
Total | 48 | 100.00% | 3 | 100.00% |
static int coda_set_inode(struct inode *inode, void *data)
{
struct CodaFid *fid = (struct CodaFid *)data;
struct coda_inode_info *cii = ITOC(inode);
cii->c_fid = *fid;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jan Harkes | 40 | 85.11% | 2 | 66.67% |
Yoshihisa Abe | 7 | 14.89% | 1 | 33.33% |
Total | 47 | 100.00% | 3 | 100.00% |
struct inode * coda_iget(struct super_block * sb, struct CodaFid * fid,
struct coda_vattr * attr)
{
struct inode *inode;
struct coda_inode_info *cii;
unsigned long hash = coda_f2i(fid);
inode = iget5_locked(sb, hash, coda_test_inode, coda_set_inode, fid);
if (!inode)
return ERR_PTR(-ENOMEM);
if (inode->i_state & I_NEW) {
cii = ITOC(inode);
/* we still need to set i_ino for things like stat(2) */
inode->i_ino = hash;
/* inode is locked and unique, no need to grab cii->c_lock */
cii->c_mapcount = 0;
unlock_new_inode(inode);
}
/* always replace the attributes, type might have changed */
coda_fill_inode(inode, attr);
return inode;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 56 | 48.70% | 4 | 30.77% |
Jan Harkes | 50 | 43.48% | 6 | 46.15% |
Linus Torvalds | 8 | 6.96% | 2 | 15.38% |
Yoshihisa Abe | 1 | 0.87% | 1 | 7.69% |
Total | 115 | 100.00% | 13 | 100.00% |
/* this is effectively coda_iget:
- get attributes (might be cached)
- get the inode for the fid using vfs iget
- link the two up if this is needed
- fill in the attributes
*/
struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb)
{
struct coda_vattr attr;
struct inode *inode;
int error;
/* We get inode numbers from Venus -- see venus source */
error = venus_getattr(sb, fid, &attr);
if (error)
return ERR_PTR(error);
inode = coda_iget(sb, fid, &attr);
if (IS_ERR(inode))
pr_warn("%s: coda_iget failed\n", __func__);
return inode;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 65 | 80.25% | 3 | 42.86% |
Al Viro | 10 | 12.35% | 1 | 14.29% |
Fabian Frederick | 4 | 4.94% | 2 | 28.57% |
Jan Harkes | 2 | 2.47% | 1 | 14.29% |
Total | 81 | 100.00% | 7 | 100.00% |
/* Although we treat Coda file identifiers as immutable, there is one
* special case for files created during a disconnection where they may
* not be globally unique. When an identifier collision is detected we
* first try to flush the cached inode from the kernel and finally
* resort to renaming/rehashing in-place. Userspace remembers both old
* and new values of the identifier to handle any in-flight upcalls.
* The real solution is to use globally unique UUIDs as identifiers, but
* retrofitting the existing userspace code for this is non-trivial. */
void coda_replace_fid(struct inode *inode, struct CodaFid *oldfid,
struct CodaFid *newfid)
{
struct coda_inode_info *cii = ITOC(inode);
unsigned long hash = coda_f2i(newfid);
BUG_ON(!coda_fideq(&cii->c_fid, oldfid));
/* replace fid and rehash inode */
/* XXX we probably need to hold some lock here! */
remove_inode_hash(inode);
cii->c_fid = *newfid;
inode->i_ino = hash;
__insert_inode_hash(inode, hash);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 43 | 53.75% | 2 | 28.57% |
Jan Harkes | 15 | 18.75% | 2 | 28.57% |
Linus Torvalds | 14 | 17.50% | 1 | 14.29% |
Yoshihisa Abe | 5 | 6.25% | 1 | 14.29% |
Eric Sesterhenn / Snakebyte | 3 | 3.75% | 1 | 14.29% |
Total | 80 | 100.00% | 7 | 100.00% |
/* convert a fid to an inode. */
struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb)
{
struct inode *inode;
unsigned long hash = coda_f2i(fid);
if ( !sb ) {
pr_warn("%s: no sb!\n", __func__);
return NULL;
}
inode = ilookup5(sb, hash, coda_test_inode, fid);
if ( !inode )
return NULL;
/* we should never see newly created inodes because we intentionally
* fail in the initialization callback */
BUG_ON(inode->i_state & I_NEW);
return inode;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 51 | 62.20% | 4 | 33.33% |
Jan Harkes | 25 | 30.49% | 5 | 41.67% |
Fabian Frederick | 4 | 4.88% | 2 | 16.67% |
Linus Torvalds | 2 | 2.44% | 1 | 8.33% |
Total | 82 | 100.00% | 12 | 100.00% |
/* the CONTROL inode is made without asking attributes from Venus */
struct inode *coda_cnode_makectl(struct super_block *sb)
{
struct inode *inode = new_inode(sb);
if (inode) {
inode->i_ino = CTL_INO;
inode->i_op = &coda_ioctl_inode_operations;
inode->i_fop = &coda_ioctl_operations;
inode->i_mode = 0444;
return inode;
}
return ERR_PTR(-ENOMEM);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 42 | 65.62% | 3 | 60.00% |
Al Viro | 15 | 23.44% | 1 | 20.00% |
Jan Harkes | 7 | 10.94% | 1 | 20.00% |
Total | 64 | 100.00% | 5 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 426 | 58.52% | 14 | 35.90% |
Jan Harkes | 194 | 26.65% | 9 | 23.08% |
Al Viro | 43 | 5.91% | 9 | 23.08% |
Linus Torvalds | 28 | 3.85% | 2 | 5.13% |
Yoshihisa Abe | 25 | 3.43% | 1 | 2.56% |
Fabian Frederick | 8 | 1.10% | 2 | 5.13% |
Eric Sesterhenn / Snakebyte | 3 | 0.41% | 1 | 2.56% |
Arjan van de Ven | 1 | 0.14% | 1 | 2.56% |
Total | 728 | 100.00% | 39 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.