git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
fs
/
msdos
/
namei.c
diff --git
a/fs/msdos/namei.c
b/fs/msdos/namei.c
index
154f511
..
4524619
100644
(file)
--- a/
fs/msdos/namei.c
+++ b/
fs/msdos/namei.c
@@
-12,14
+12,6
@@
#include <linux/msdos_fs.h>
#include <linux/smp_lock.h>
#include <linux/msdos_fs.h>
#include <linux/smp_lock.h>
-/* MS-DOS "device special files" */
-static const unsigned char *reserved_names[] = {
- "CON ", "PRN ", "NUL ", "AUX ",
- "LPT1 ", "LPT2 ", "LPT3 ", "LPT4 ",
- "COM1 ", "COM2 ", "COM3 ", "COM4 ",
- NULL
-};
-
/* Characters that are undesirable in an MS-DOS file name */
static unsigned char bad_chars[] = "*?<>|\"";
static unsigned char bad_if_strict_pc[] = "+=,; ";
/* Characters that are undesirable in an MS-DOS file name */
static unsigned char bad_chars[] = "*?<>|\"";
static unsigned char bad_if_strict_pc[] = "+=,; ";
@@
-40,7
+32,6
@@
static int msdos_format_name(const unsigned char *name, int len,
*/
{
unsigned char *walk;
*/
{
unsigned char *walk;
- const unsigned char **reserved;
unsigned char c;
int space;
unsigned char c;
int space;
@@
-127,11
+118,7
@@
static int msdos_format_name(const unsigned char *name, int len,
}
while (walk - res < MSDOS_NAME)
*walk++ = ' ';
}
while (walk - res < MSDOS_NAME)
*walk++ = ' ';
- if (!opts->atari)
- /* GEMDOS is less stupid and has no reserved names */
- for (reserved = reserved_names; *reserved; reserved++)
- if (!strncmp(res, *reserved, 8))
- return -EINVAL;
+
return 0;
}
return 0;
}
@@
-293,7
+280,7
@@
static int msdos_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
- struct inode *inode;
+ struct inode *inode
= NULL
;
struct fat_slot_info sinfo;
struct timespec ts;
unsigned char msdos_name[MSDOS_NAME];
struct fat_slot_info sinfo;
struct timespec ts;
unsigned char msdos_name[MSDOS_NAME];
@@
-329,6
+316,8
@@
static int msdos_create(struct inode *dir, struct dentry *dentry, int mode,
d_instantiate(dentry, inode);
out:
unlock_kernel();
d_instantiate(dentry, inode);
out:
unlock_kernel();
+ if (!err)
+ err = fat_flush_inodes(sb, dir, inode);
return err;
}
return err;
}
@@
-354,13
+343,15
@@
static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
- d
ir->i_nlink--
;
+ d
rop_nlink(dir)
;
-
inode->i_nlink = 0
;
+
clear_nlink(inode)
;
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
unlock_kernel();
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
unlock_kernel();
+ if (!err)
+ err = fat_flush_inodes(inode->i_sb, dir, inode);
return err;
}
return err;
}
@@
-398,7
+389,7
@@
static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode)
err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo);
if (err)
goto out_free;
err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo);
if (err)
goto out_free;
-
dir->i_nlink++
;
+
inc_nlink(dir)
;
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh);
inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
brelse(sinfo.bh);
@@
-414,6
+405,7
@@
static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode)
d_instantiate(dentry, inode);
unlock_kernel();
d_instantiate(dentry, inode);
unlock_kernel();
+ fat_flush_inodes(sb, dir, inode);
return 0;
out_free:
return 0;
out_free:
@@
-438,11
+430,13
@@
static int msdos_unlink(struct inode *dir, struct dentry *dentry)
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
-
inode->i_nlink = 0
;
+
clear_nlink(inode)
;
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
unlock_kernel();
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
unlock_kernel();
+ if (!err)
+ err = fat_flush_inodes(inode->i_sb, dir, inode);
return err;
}
return err;
}
@@
-454,10
+448,10
@@
static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
{
struct buffer_head *dotdot_bh;
struct msdos_dir_entry *dotdot_de;
{
struct buffer_head *dotdot_bh;
struct msdos_dir_entry *dotdot_de;
- loff_t dotdot_i_pos;
struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo;
struct timespec ts;
struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo;
struct timespec ts;
+ loff_t dotdot_i_pos, new_i_pos;
int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
@@
-516,28
+510,24
@@
static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
if (new_inode) {
if (err)
goto out;
if (new_inode) {
if (err)
goto out;
- if (MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
- /* WTF??? Cry and fail. */
- printk(KERN_WARNING "msdos_rename: fs corrupted\n");
- goto out;
- }
-
if (is_dir) {
err = fat_dir_empty(new_inode);
if (err)
goto out;
}
if (is_dir) {
err = fat_dir_empty(new_inode);
if (err)
goto out;
}
+ new_i_pos = MSDOS_I(new_inode)->i_pos;
fat_detach(new_inode);
} else {
err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
&ts, &sinfo);
if (err)
goto out;
fat_detach(new_inode);
} else {
err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
&ts, &sinfo);
if (err)
goto out;
+ new_i_pos = sinfo.i_pos;
}
new_dir->i_version++;
fat_detach(old_inode);
}
new_dir->i_version++;
fat_detach(old_inode);
- fat_attach(old_inode,
sinfo.
i_pos);
+ fat_attach(old_inode,
new_
i_pos);
if (is_hid)
MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
else
if (is_hid)
MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
else
@@
-559,9
+549,9
@@
static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
if (err)
goto error_dotdot;
}
if (err)
goto error_dotdot;
}
-
old_dir->i_nlink--
;
+
drop_nlink(old_dir)
;
if (!new_inode)
if (!new_inode)
-
new_dir->i_nlink++
;
+
inc_nlink(new_dir)
;
}
err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */
}
err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */
@@
-576,10
+566,9
@@
static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
mark_inode_dirty(old_dir);
if (new_inode) {
mark_inode_dirty(old_dir);
if (new_inode) {
+ drop_nlink(new_inode);
if (is_dir)
if (is_dir)
- new_inode->i_nlink -= 2;
- else
- new_inode->i_nlink--;
+ drop_nlink(new_inode);
new_inode->i_ctime = ts;
}
out:
new_inode->i_ctime = ts;
}
out:
@@
-604,7
+593,7
@@
error_inode:
fat_attach(old_inode, old_sinfo.i_pos);
MSDOS_I(old_inode)->i_attrs = old_attrs;
if (new_inode) {
fat_attach(old_inode, old_sinfo.i_pos);
MSDOS_I(old_inode)->i_attrs = old_attrs;
if (new_inode) {
- fat_attach(new_inode,
sinfo.
i_pos);
+ fat_attach(new_inode,
new_
i_pos);
if (corrupt)
corrupt |= fat_sync_inode(new_inode);
} else {
if (corrupt)
corrupt |= fat_sync_inode(new_inode);
} else {
@@
-652,6
+641,8
@@
static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dir, new_msdos_name, new_dentry, is_hid);
out:
unlock_kernel();
new_dir, new_msdos_name, new_dentry, is_hid);
out:
unlock_kernel();
+ if (!err)
+ err = fat_flush_inodes(old_dir->i_sb, old_dir, new_dir);
return err;
}
return err;
}
@@
-663,6
+654,7
@@
static struct inode_operations msdos_dir_inode_operations = {
.rmdir = msdos_rmdir,
.rename = msdos_rename,
.setattr = fat_notify_change,
.rmdir = msdos_rmdir,
.rename = msdos_rename,
.setattr = fat_notify_change,
+ .getattr = fat_getattr,
};
static int msdos_fill_super(struct super_block *sb, void *data, int silent)
};
static int msdos_fill_super(struct super_block *sb, void *data, int silent)
@@
-678,11
+670,12
@@
static int msdos_fill_super(struct super_block *sb, void *data, int silent)
return 0;
}
return 0;
}
-static
struct super_block *
msdos_get_sb(struct file_system_type *fs_type,
-
int flags, const char *dev_name,
-
void *data
)
+static
int
msdos_get_sb(struct file_system_type *fs_type,
+ int flags, const char *dev_name,
+
void *data, struct vfsmount *mnt
)
{
{
- return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
+ return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super,
+ mnt);
}
static struct file_system_type msdos_fs_type = {
}
static struct file_system_type msdos_fs_type = {