Beispiel #1
0
void umsdos_lookup_patch_new(struct dentry *dentry, struct umsdos_info *info)
{
	struct inode *inode = dentry->d_inode;
	struct umsdos_dirent *entry = &info->entry;

	/*
	 * This part of the initialization depends only on i_patched.
	 */
	if (inode->u.umsdos_i.i_patched)
		goto out;
	inode->u.umsdos_i.i_patched = 1;
	if (S_ISREG (entry->mode))
		entry->mtime = inode->i_mtime;
	inode->i_mode = entry->mode;
	inode->i_rdev = to_kdev_t (entry->rdev);
	inode->i_atime = entry->atime;
	inode->i_ctime = entry->ctime;
	inode->i_mtime = entry->mtime;
	inode->i_uid = entry->uid;
	inode->i_gid = entry->gid;

	/* #Specification: umsdos / i_nlink
	 * The nlink field of an inode is maintained by the MSDOS file system
	 * for directory and by UMSDOS for other files.  The logic is that
	 * MSDOS is already figuring out what to do for directories and
	 * does nothing for other files.  For MSDOS, there are no hard links
	 * so all file carry nlink==1.  UMSDOS use some info in the
	 * EMD file to plug the correct value.
	 */
	if (!S_ISDIR (entry->mode)) {
		if (entry->nlink > 0) {
			inode->i_nlink = entry->nlink;
		} else {
			printk (KERN_ERR 
				"UMSDOS:  lookup_patch entry->nlink < 1 ???\n");
		}
	}
	/*
	 * The mode may have changed, so patch the inode again.
	 */
	umsdos_patch_dentry_inode(dentry, info->f_pos);
	umsdos_set_dirinfo_new(dentry, info->f_pos);

out:
	return;
}
Beispiel #2
0
/* #Specification: pseudo root / DOS/..
 * In the real root directory (c:\), the directory ..
 * is the pseudo root (c:\linux).
 */
struct dentry *umsdos_rlookup_x ( struct inode *dir, struct dentry *dentry, int nopseudo)
{
	struct dentry *ret;

	if (saved_root && dir == saved_root->d_inode && !nopseudo &&
	    dentry->d_name.len == UMSDOS_PSDROOT_LEN &&
	    memcmp (dentry->d_name.name, UMSDOS_PSDROOT_NAME, UMSDOS_PSDROOT_LEN) == 0) {
		/* #Specification: pseudo root / DOS/linux
		 * Even in the real root directory (c:\), the directory
		 * /linux won't show
		 */
		 
		ret = ERR_PTR(-ENOENT);
		goto out;
	}

	ret = msdos_lookup (dir, dentry);
	if (ret) {
		printk(KERN_WARNING
			"umsdos_rlookup_x: %s/%s failed, ret=%ld\n",
			dentry->d_parent->d_name.name, dentry->d_name.name,
			PTR_ERR(ret));
		goto out;
	}
	if (dentry->d_inode) {
		/* We must install the proper function table
		 * depending on whether this is an MS-DOS or 
		 * a UMSDOS directory
		 */
Printk ((KERN_DEBUG "umsdos_rlookup_x: patch_dentry_inode %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name));
		umsdos_patch_dentry_inode(dentry, 0);

	}
out:
	/* always install our dentry ops ... */
	dentry->d_op = &umsdos_dentry_operations;
	return ret;
}