commit 706f9d227a5811171ffe4980993c25a53be7b5fe
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Tue Apr 3 19:04:54 2007 -0400
preparing for hardlinks
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index de55971..548f99a 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -1368,46 +1368,52 @@ out:
* Returns odf_dentry_info pointing to the location in the odf
* for the given directory's cached contents
*/
-struct odf_dentry_info *odf_ic_dir(struct dentry *dir)
+struct odf_dentry_info *odf_ic_cache_dentry(struct dentry *dir)
{
- struct odf_dentry_info *odi_dir, *odis[4], *odi_ic, *odi_ret = NULL;
- struct odf_sb_info *osi;
- u64 ino;
+ struct odf_dentry_info *odi_dir;
+
+ odi_dir = UNIONFS_D(dir)->odf_info;
+ if (!odi_dir)
+ return ERR_PTR(-ENOENT);
+
+ if (!S_ISDIR(dir->d_inode->i_mode))
+ return ERR_PTR(-ENOTDIR);
+
+ return odf_ic_dentry(UNIONFS_SB(dir->d_sb)->odf,
+ dir->d_inode->i_ino, ODF_CONTENT, ODF_CONTENT_LEN);
+}
+
+/*
+ * Returns odf_dentry_info pointing to the location in odf/ic
+ * for the requested file name
+ */
+struct odf_dentry_info *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char
*name, int namelen)
+{
+ struct odf_dentry_info *odis[4], *odi_ic, *odi_ret = NULL;
int breakdown[4];
- char name[6];
+ char tmp_name[6];
int i, err = 0;
- if (!S_ISDIR(dir->d_inode->i_mode)) {
- err = -ENOTDIR;
- goto out;
- }
- osi = UNIONFS_SB(dir->d_sb)->odf;
odi_ic = osi->odi_ic;
- odi_dir = UNIONFS_D(dir)->odf_info;
- if (!odi_dir) {
- err = -ENOENT;
- goto out;
- }
- ino = odi_dir->inum;
for (i = 3; i >= 0; i--) {
breakdown[i] = ino & 0xFFFF;
ino >>= 16;
odis[i] = NULL;
}
- memset(name,0,6);
- sprintf(name, "%x", breakdown[0]);
- odis[0] = __odf_lookup(osi, odi_ic, name, strlen(name), ODF_LOOKUP_DIR,
NULL);
+ memset(tmp_name,0,6);
+ sprintf(tmp_name, "%x", breakdown[0]);
+ odis[0] = __odf_lookup(osi, odi_ic, tmp_name, strlen(tmp_name),
ODF_LOOKUP_DIR, NULL);
if (IS_ERR(odis[0])) {
err = PTR_ERR(odis[0]);
odis[0] = NULL;
goto out;
}
for (i = 1; i < 4; i++) {
- memset(name,0,6);
- sprintf(name, "%x", breakdown[i]);
- odis[i] = __odf_lookup(osi, odis[i-1], name, strlen(name),
ODF_LOOKUP_DIR, NULL);
+ memset(tmp_name,0,6);
+ sprintf(tmp_name, "%x", breakdown[i]);
+ odis[i] = __odf_lookup(osi, odis[i-1], tmp_name,
strlen(tmp_name), ODF_LOOKUP_DIR, NULL);
if (IS_ERR(odis[i])) {
err = PTR_ERR(odis[i]);
odis[i] = NULL;
@@ -1415,7 +1421,7 @@ struct odf_dentry_info *odf_ic_dir(struct dentry *dir)
}
}
- odi_ret = __odf_lookup(osi, odis[3], ODF_CONTENT, ODF_CONTENT_LEN,
ODF_LOOKUP_FILE, NULL);
+ odi_ret = __odf_lookup(osi, odis[3], name, namelen, ODF_LOOKUP_FILE,
NULL);
if (IS_ERR(odi_ret)) {
err = PTR_ERR(odi_ret);
odi_ret = NULL;
@@ -1564,7 +1570,7 @@ int odf_purge_dir_cache(struct dentry *dentry)
//struct iattr attr;
struct odf_dentry_info *odi = NULL;
- odi = odf_ic_dir(dentry);
+ odi = odf_ic_cache_dentry(dentry);
if (IS_ERR(odi)){
err = PTR_ERR(odi);
odi = NULL;
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs