summaryrefslogtreecommitdiffstats
path: root/fs/hfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfs')
-rw-r--r--fs/hfs/ChangeLog10
-rw-r--r--fs/hfs/catalog.c11
-rw-r--r--fs/hfs/dir.c2
-rw-r--r--fs/hfs/dir_cap.c10
-rw-r--r--fs/hfs/dir_dbl.c10
-rw-r--r--fs/hfs/dir_nat.c10
-rw-r--r--fs/hfs/file_hdr.c67
-rw-r--r--fs/hfs/sysdep.c4
8 files changed, 47 insertions, 77 deletions
diff --git a/fs/hfs/ChangeLog b/fs/hfs/ChangeLog
index c0b077f47..f97bd0086 100644
--- a/fs/hfs/ChangeLog
+++ b/fs/hfs/ChangeLog
@@ -1,3 +1,13 @@
+1999-01-30 a sun <asun@hecate.darksunrising.blah>
+
+ * catalog.c (hfs_cat_move): fixed corruption problem with
+ renames.
+
+1999-01-27 a sun <asun@hecate.darksunrising.blah>
+
+ * file_hdr.c (get/set_dates): got rid of broken afpd times. NOTE:
+ you must use netatalk-1.4b2+asun2.1.2 or newer for this.
+
1998-12-20 a sun <asun@hecate.darksunrising.blah>
* bdelete.c (del_root): assign bthLNode and bthFNode only if the
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 306c018e7..48577a9e6 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -1348,7 +1348,7 @@ int hfs_cat_move(struct hfs_cat_entry *old_dir, struct hfs_cat_entry *new_dir,
hfs_sleep_on(&mdb->rename_wait);
}
spin_lock(&entry_lock);
- mdb->rename_lock = 1;
+ mdb->rename_lock = 1; /* XXX: should be atomic_inc */
spin_unlock(&entry_lock);
/* keep readers from getting confused by changing dir size */
@@ -1385,7 +1385,6 @@ int hfs_cat_move(struct hfs_cat_entry *old_dir, struct hfs_cat_entry *new_dir,
restart:
/* see if the destination exists, getting it if it does */
dest = hfs_cat_get(mdb, new_key);
-
if (!dest) {
/* destination doesn't exist, so create it */
struct hfs_cat_rec new_record;
@@ -1408,14 +1407,16 @@ restart:
goto bail3;
}
- /* build the new record */
+ /* build the new record. make sure to zero out the
+ record. */
+ memset(&new_record, 0, sizeof(new_record));
new_record.cdrType = entry->type;
__write_entry(entry, &new_record);
/* insert the new record */
error = hfs_binsert(mdb->cat_tree, HFS_BKEY(new_key),
&new_record, is_dir ? 2 + sizeof(DIR_REC) :
- 2 + sizeof(FIL_REC));
+ 2 + sizeof(FIL_REC));
if (error == -EEXIST) {
delete_entry(dest);
unlock_entry(dest);
@@ -1565,7 +1566,7 @@ done:
}
end_write(new_dir);
spin_lock(&entry_lock);
- mdb->rename_lock = 0;
+ mdb->rename_lock = 0; /* XXX: should use atomic_dec */
hfs_wake_up(&mdb->rename_wait);
spin_unlock(&entry_lock);
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index f8d89227d..b355408c9 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -430,8 +430,6 @@ int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
update_dirs_plus(new_parent, is_dir);
}
- /* update dcache */
- d_move(old_dentry, new_dentry);
}
hfs_rename_put:
diff --git a/fs/hfs/dir_cap.c b/fs/hfs/dir_cap.c
index 03fa7f7ae..0ab81d966 100644
--- a/fs/hfs/dir_cap.c
+++ b/fs/hfs/dir_cap.c
@@ -27,7 +27,7 @@
/*================ Forward declarations ================*/
-static int cap_lookup(struct inode *, struct dentry *);
+static struct dentry *cap_lookup(struct inode *, struct dentry *);
static int cap_readdir(struct file *, void *, filldir_t);
/*================ Global variables ================*/
@@ -147,7 +147,7 @@ struct inode_operations hfs_cap_rdir_inode_operations = {
* inode corresponding to an entry in a directory, given the inode for
* the directory and the name (and its length) of the entry.
*/
-static int cap_lookup(struct inode * dir, struct dentry *dentry)
+static struct dentry *cap_lookup(struct inode * dir, struct dentry *dentry)
{
ino_t dtype;
struct hfs_name cname;
@@ -155,10 +155,6 @@ static int cap_lookup(struct inode * dir, struct dentry *dentry)
struct hfs_cat_key key;
struct inode *inode = NULL;
- if (!dir || !S_ISDIR(dir->i_mode)) {
- return -ENOENT;
- }
-
dentry->d_op = &hfs_dentry_operations;
entry = HFS_I(dir)->entry;
dtype = HFS_ITYPE(dir->i_ino);
@@ -207,7 +203,7 @@ static int cap_lookup(struct inode * dir, struct dentry *dentry)
done:
d_add(dentry, inode);
- return 0;
+ return NULL;
}
/*
diff --git a/fs/hfs/dir_dbl.c b/fs/hfs/dir_dbl.c
index 4e4e6fcc3..80e990627 100644
--- a/fs/hfs/dir_dbl.c
+++ b/fs/hfs/dir_dbl.c
@@ -23,7 +23,7 @@
/*================ Forward declarations ================*/
-static int dbl_lookup(struct inode *, struct dentry *);
+static struct dentry *dbl_lookup(struct inode *, struct dentry *);
static int dbl_readdir(struct file *, void *, filldir_t);
static int dbl_create(struct inode *, struct dentry *, int);
static int dbl_mkdir(struct inode *, struct dentry *, int);
@@ -130,17 +130,13 @@ static int is_hdr(struct inode *dir, const char *name, int len)
* the inode for the directory and the name (and its length) of the
* entry.
*/
-static int dbl_lookup(struct inode * dir, struct dentry *dentry)
+static struct dentry *dbl_lookup(struct inode * dir, struct dentry *dentry)
{
struct hfs_name cname;
struct hfs_cat_entry *entry;
struct hfs_cat_key key;
struct inode *inode = NULL;
- if (!dir || !S_ISDIR(dir->i_mode)) {
- return -ENOENT;
- }
-
dentry->d_op = &hfs_dentry_operations;
entry = HFS_I(dir)->entry;
@@ -173,7 +169,7 @@ static int dbl_lookup(struct inode * dir, struct dentry *dentry)
done:
d_add(dentry, inode);
- return 0;
+ return NULL;
}
/*
diff --git a/fs/hfs/dir_nat.c b/fs/hfs/dir_nat.c
index a4078e891..5cff9d814 100644
--- a/fs/hfs/dir_nat.c
+++ b/fs/hfs/dir_nat.c
@@ -29,7 +29,7 @@
/*================ Forward declarations ================*/
-static int nat_lookup(struct inode *, struct dentry *);
+static struct dentry *nat_lookup(struct inode *, struct dentry *);
static int nat_readdir(struct file *, void *, filldir_t);
static int nat_rmdir(struct inode *, struct dentry *);
static int nat_hdr_unlink(struct inode *, struct dentry *);
@@ -136,7 +136,7 @@ struct inode_operations hfs_nat_hdir_inode_operations = {
* the inode corresponding to an entry in a directory, given the inode
* for the directory and the name (and its length) of the entry.
*/
-static int nat_lookup(struct inode * dir, struct dentry *dentry)
+static struct dentry *nat_lookup(struct inode * dir, struct dentry *dentry)
{
ino_t dtype;
struct hfs_name cname;
@@ -144,10 +144,6 @@ static int nat_lookup(struct inode * dir, struct dentry *dentry)
struct hfs_cat_key key;
struct inode *inode = NULL;
- if (!dir || !S_ISDIR(dir->i_mode)) {
- return -ENOENT;
- }
-
dentry->d_op = &hfs_dentry_operations;
entry = HFS_I(dir)->entry;
dtype = HFS_ITYPE(dir->i_ino);
@@ -199,7 +195,7 @@ static int nat_lookup(struct inode * dir, struct dentry *dentry)
done:
d_add(dentry, inode);
- return 0;
+ return NULL;
}
/*
diff --git a/fs/hfs/file_hdr.c b/fs/hfs/file_hdr.c
index 3ae2d5b5d..9479fab08 100644
--- a/fs/hfs/file_hdr.c
+++ b/fs/hfs/file_hdr.c
@@ -303,16 +303,9 @@ static inline void adjust_forks(struct hfs_cat_entry *entry,
static void get_dates(const struct hfs_cat_entry *entry,
const struct inode *inode, hfs_u32 dates[3])
{
- if (HFS_SB(inode->i_sb)->s_afpd) {
- /* AFPD compatible: use un*x times */
- dates[0] = htonl(hfs_m_to_utime(entry->create_date));
- dates[1] = htonl(hfs_m_to_utime(entry->modify_date));
- dates[2] = htonl(hfs_m_to_utime(entry->backup_date));
- } else {
- dates[0] = hfs_m_to_htime(entry->create_date);
- dates[1] = hfs_m_to_htime(entry->modify_date);
- dates[2] = hfs_m_to_htime(entry->backup_date);
- }
+ dates[0] = hfs_m_to_htime(entry->create_date);
+ dates[1] = hfs_m_to_htime(entry->modify_date);
+ dates[2] = hfs_m_to_htime(entry->backup_date);
}
/*
@@ -322,43 +315,23 @@ static void set_dates(struct hfs_cat_entry *entry, struct inode *inode,
const hfs_u32 *dates)
{
hfs_u32 tmp;
- if (HFS_SB(inode->i_sb)->s_afpd) {
- /* AFPD compatible: use un*x times */
- tmp = hfs_u_to_mtime(ntohl(dates[0]));
- if (entry->create_date != tmp) {
- entry->create_date = tmp;
- hfs_cat_mark_dirty(entry);
- }
- tmp = hfs_u_to_mtime(ntohl(dates[1]));
- if (entry->modify_date != tmp) {
- entry->modify_date = tmp;
- inode->i_ctime = inode->i_atime = inode->i_mtime =
- ntohl(dates[1]);
- hfs_cat_mark_dirty(entry);
- }
- tmp = hfs_u_to_mtime(ntohl(dates[2]));
- if (entry->backup_date != tmp) {
- entry->backup_date = tmp;
- hfs_cat_mark_dirty(entry);
- }
- } else {
- tmp = hfs_h_to_mtime(dates[0]);
- if (entry->create_date != tmp) {
- entry->create_date = tmp;
- hfs_cat_mark_dirty(entry);
- }
- tmp = hfs_h_to_mtime(dates[1]);
- if (entry->modify_date != tmp) {
- entry->modify_date = tmp;
- inode->i_ctime = inode->i_atime = inode->i_mtime =
- hfs_h_to_utime(dates[1]);
- hfs_cat_mark_dirty(entry);
- }
- tmp = hfs_h_to_mtime(dates[2]);
- if (entry->backup_date != tmp) {
- entry->backup_date = tmp;
- hfs_cat_mark_dirty(entry);
- }
+
+ tmp = hfs_h_to_mtime(dates[0]);
+ if (entry->create_date != tmp) {
+ entry->create_date = tmp;
+ hfs_cat_mark_dirty(entry);
+ }
+ tmp = hfs_h_to_mtime(dates[1]);
+ if (entry->modify_date != tmp) {
+ entry->modify_date = tmp;
+ inode->i_ctime = inode->i_atime = inode->i_mtime =
+ hfs_h_to_utime(dates[1]);
+ hfs_cat_mark_dirty(entry);
+ }
+ tmp = hfs_h_to_mtime(dates[2]);
+ if (entry->backup_date != tmp) {
+ entry->backup_date = tmp;
+ hfs_cat_mark_dirty(entry);
}
}
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c
index 0524808f7..fb68e9ab2 100644
--- a/fs/hfs/sysdep.c
+++ b/fs/hfs/sysdep.c
@@ -18,7 +18,7 @@
#include <linux/hfs_fs_i.h>
#include <linux/hfs_fs.h>
-static int hfs_revalidate_dentry(struct dentry *);
+static int hfs_revalidate_dentry(struct dentry *, int);
static int hfs_hash_dentry(struct dentry *, struct qstr *);
static int hfs_compare_dentry(struct dentry *, struct qstr *, struct qstr *);
static void hfs_dentry_iput(struct dentry *, struct inode *);
@@ -89,7 +89,7 @@ static void hfs_dentry_iput(struct dentry *dentry, struct inode *inode)
iput(inode);
}
-static int hfs_revalidate_dentry(struct dentry *dentry)
+static int hfs_revalidate_dentry(struct dentry *dentry, int flags)
{
struct inode *inode = dentry->d_inode;
int diff;