static int nfs_link(struct inode *oldinode, struct inode *dir, const char *name, int len) { int error; if (!oldinode) { printk("nfs_link: old inode is NULL\n"); iput(oldinode); iput(dir); return -ENOENT; } if (!dir || !S_ISDIR(dir->i_mode)) { printk("nfs_link: dir is NULL or not a directory\n"); iput(oldinode); iput(dir); return -ENOENT; } if (len > NFS_MAXNAMLEN) { iput(oldinode); iput(dir); return -ENAMETOOLONG; } error = nfs_proc_link(NFS_SERVER(oldinode), NFS_FH(oldinode), NFS_FH(dir), name); nfs_lookup_cache_remove(dir, oldinode, NULL); NFS_CACHEINV(oldinode); iput(oldinode); iput(dir); return error; }
int nfs_link(struct file *filp, struct file *dir_filp, const char *name) { struct nfs_fh *fhandle, *dhandle; int status; DPRINTF(CLU_LEVEL,("nfs_link:\n")); demand(filp, bogus filp); demand(dir_filp, bogus dir_filp); fhandle = GETFHANDLE(filp); dhandle = GETFHANDLE(dir_filp); status = nfs_proc_link(fhandle,dhandle,name); /* HBXX - the nlink field in the stat structure will be invalid */ if (status == 0) { nfs_flush_filp(dir_filp); nfs_cache_remove(dir_filp,name); return 0; } else { errno = status; return -1; } }