8 #include <linux/sched.h>
13 const unsigned char *
name = dentry->
d_name.name;
16 struct buffer_head *bh;
35 memset(&dee, 0,
sizeof dee);
37 if (!(mode & 0222)) dee.read_only = 1;
39 dee.hidden = name[0] ==
'.';
47 hpfs_i(result)->i_parent_dir = dir->
i_ino;
48 hpfs_i(result)->i_dno = dno;
53 hpfs_i(result)->i_ea_size = 0;
71 memcpy(fnode->
name, name, len > 15 ? 15 : len);
74 fnode->
btree.n_free_nodes = 7;
75 fnode->
btree.n_used_nodes = 1;
92 insert_inode_hash(result);
103 hpfs_unlock(dir->
i_sb);
114 hpfs_unlock(dir->
i_sb);
118 static int hpfs_create(
struct inode *dir,
struct dentry *dentry,
umode_t mode,
bool excl)
120 const unsigned char *name = dentry->
d_name.name;
121 unsigned len = dentry->
d_name.len;
123 struct buffer_head *bh;
131 hpfs_lock(dir->
i_sb);
136 memset(&dee, 0,
sizeof dee);
137 if (!(mode & 0222)) dee.read_only = 1;
139 dee.hidden = name[0] ==
'.';
154 hpfs_i(result)->i_parent_dir = dir->
i_ino;
159 hpfs_i(result)->i_ea_size = 0;
165 hpfs_i(result)->mmu_private = 0;
175 memcpy(fnode->
name, name, len > 15 ? 15 : len);
180 insert_inode_hash(result);
191 hpfs_unlock(dir->
i_sb);
200 hpfs_unlock(dir->
i_sb);
206 const unsigned char *name = dentry->
d_name.name;
207 unsigned len = dentry->
d_name.len;
208 struct buffer_head *bh;
216 if (hpfs_sb(dir->
i_sb)->sb_eas < 2)
return -
EPERM;
217 if (!new_valid_dev(rdev))
219 hpfs_lock(dir->
i_sb);
224 memset(&dee, 0,
sizeof dee);
225 if (!(mode & 0222)) dee.read_only = 1;
227 dee.hidden = name[0] ==
'.';
237 hpfs_i(result)->i_parent_dir = dir->
i_ino;
242 hpfs_i(result)->i_ea_size = 0;
258 memcpy(fnode->
name, name, len > 15 ? 15 : len);
262 insert_inode_hash(result);
267 hpfs_unlock(dir->
i_sb);
275 hpfs_unlock(dir->
i_sb);
279 static int hpfs_symlink(
struct inode *dir,
struct dentry *dentry,
const char *symlink)
281 const unsigned char *name = dentry->
d_name.name;
282 unsigned len = dentry->
d_name.len;
283 struct buffer_head *bh;
291 hpfs_lock(dir->
i_sb);
292 if (hpfs_sb(dir->
i_sb)->sb_eas < 2) {
293 hpfs_unlock(dir->
i_sb);
300 memset(&dee, 0,
sizeof dee);
302 dee.hidden = name[0] ==
'.';
311 hpfs_i(result)->i_parent_dir = dir->
i_ino;
316 hpfs_i(result)->i_ea_size = 0;
334 memcpy(fnode->
name, name, len > 15 ? 15 : len);
340 insert_inode_hash(result);
344 hpfs_unlock(dir->
i_sb);
352 hpfs_unlock(dir->
i_sb);
356 static int hpfs_unlink(
struct inode *dir,
struct dentry *dentry)
358 const unsigned char *name = dentry->
d_name.name;
359 unsigned len = dentry->
d_name.len;
368 hpfs_lock(dir->
i_sb);
372 de =
map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh);
397 if (!d_unhashed(dentry)) {
398 hpfs_unlock(dir->
i_sb);
403 get_write_access(inode)) {
406 struct iattr newattrs;
411 put_write_access(inode);
415 hpfs_unlock(dir->
i_sb);
426 hpfs_unlock(dir->
i_sb);
430 static int hpfs_rmdir(
struct inode *dir,
struct dentry *dentry)
432 const unsigned char *name = dentry->
d_name.name;
433 unsigned len = dentry->
d_name.len;
436 struct inode *inode = dentry->
d_inode;
443 hpfs_lock(dir->
i_sb);
445 de =
map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh);
480 hpfs_unlock(dir->
i_sb);
487 struct inode *
i = page->
mapping->host;
489 struct buffer_head *bh;
500 hpfs_unlock(i->
i_sb);
501 SetPageUptodate(page);
507 hpfs_unlock(i->
i_sb);
515 .readpage = hpfs_symlink_readpage
518 static int hpfs_rename(
struct inode *old_dir,
struct dentry *old_dentry,
519 struct inode *new_dir,
struct dentry *new_dentry)
521 const unsigned char *old_name = old_dentry->
d_name.name;
522 unsigned old_len = old_dentry->
d_name.len;
523 const unsigned char *new_name = new_dentry->
d_name.name;
524 unsigned new_len = new_dentry->
d_name.len;
525 struct inode *i = old_dentry->
d_inode;
532 struct buffer_head *bh;
549 if (!(dep =
map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) {
555 de.
hidden = new_name[0] ==
'.';
560 if ((nde =
map_dirent(new_dir, hpfs_i(new_dir)->i_dno, new_name, new_len,
NULL, &qbh1))) {
579 if (r == -1)
hpfs_error(new_dir->
i_sb,
"hpfs_rename: dirent already exists!");
585 if (new_dir == old_dir)
586 if (!(dep =
map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) {
587 hpfs_error(i->
i_sb,
"lookup succeeded but map dirent failed at #2");
599 hpfs_i(i)->i_parent_dir = new_dir->
i_ino;
606 fnode->
len = new_len;
607 memcpy(fnode->
name, new_name, new_len>15?15:new_len);
608 if (new_len < 15)
memset(&fnode->
name[new_len], 0, 15 - new_len);
613 hpfs_unlock(i->
i_sb);
619 .create = hpfs_create,
621 .unlink = hpfs_unlink,
622 .symlink = hpfs_symlink,
626 .rename = hpfs_rename,