diff options
Diffstat (limited to 'fs/hfsplus/dir.c')
-rw-r--r-- | fs/hfsplus/dir.c | 64 |
1 files changed, 16 insertions, 48 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 5ca8308f9eb7..7efcf75ea73a 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -237,28 +237,6 @@ static int hfsplus_dir_release(struct inode *inode, struct file *file) | |||
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
240 | static int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode, | ||
241 | struct nameidata *nd) | ||
242 | { | ||
243 | struct inode *inode; | ||
244 | int res; | ||
245 | |||
246 | inode = hfsplus_new_inode(dir->i_sb, mode); | ||
247 | if (!inode) | ||
248 | return -ENOSPC; | ||
249 | |||
250 | res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); | ||
251 | if (res) { | ||
252 | inode->i_nlink = 0; | ||
253 | hfsplus_delete_inode(inode); | ||
254 | iput(inode); | ||
255 | return res; | ||
256 | } | ||
257 | hfsplus_instantiate(dentry, inode, inode->i_ino); | ||
258 | mark_inode_dirty(inode); | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | 240 | static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, |
263 | struct dentry *dst_dentry) | 241 | struct dentry *dst_dentry) |
264 | { | 242 | { |
@@ -365,27 +343,6 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | |||
365 | return res; | 343 | return res; |
366 | } | 344 | } |
367 | 345 | ||
368 | static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, int mode) | ||
369 | { | ||
370 | struct inode *inode; | ||
371 | int res; | ||
372 | |||
373 | inode = hfsplus_new_inode(dir->i_sb, S_IFDIR | mode); | ||
374 | if (!inode) | ||
375 | return -ENOSPC; | ||
376 | |||
377 | res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); | ||
378 | if (res) { | ||
379 | inode->i_nlink = 0; | ||
380 | hfsplus_delete_inode(inode); | ||
381 | iput(inode); | ||
382 | return res; | ||
383 | } | ||
384 | hfsplus_instantiate(dentry, inode, inode->i_ino); | ||
385 | mark_inode_dirty(inode); | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) | 346 | static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) |
390 | { | 347 | { |
391 | struct inode *inode; | 348 | struct inode *inode; |
@@ -438,12 +395,10 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, | |||
438 | static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, | 395 | static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, |
439 | int mode, dev_t rdev) | 396 | int mode, dev_t rdev) |
440 | { | 397 | { |
441 | struct super_block *sb; | ||
442 | struct inode *inode; | 398 | struct inode *inode; |
443 | int res; | 399 | int res; |
444 | 400 | ||
445 | sb = dir->i_sb; | 401 | inode = hfsplus_new_inode(dir->i_sb, mode); |
446 | inode = hfsplus_new_inode(sb, mode); | ||
447 | if (!inode) | 402 | if (!inode) |
448 | return -ENOSPC; | 403 | return -ENOSPC; |
449 | 404 | ||
@@ -454,13 +409,26 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, | |||
454 | iput(inode); | 409 | iput(inode); |
455 | return res; | 410 | return res; |
456 | } | 411 | } |
457 | init_special_inode(inode, mode, rdev); | 412 | |
413 | if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) | ||
414 | init_special_inode(inode, mode, rdev); | ||
415 | |||
458 | hfsplus_instantiate(dentry, inode, inode->i_ino); | 416 | hfsplus_instantiate(dentry, inode, inode->i_ino); |
459 | mark_inode_dirty(inode); | 417 | mark_inode_dirty(inode); |
460 | |||
461 | return 0; | 418 | return 0; |
462 | } | 419 | } |
463 | 420 | ||
421 | static int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode, | ||
422 | struct nameidata *nd) | ||
423 | { | ||
424 | return hfsplus_mknod(dir, dentry, mode, 0); | ||
425 | } | ||
426 | |||
427 | static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, int mode) | ||
428 | { | ||
429 | return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); | ||
430 | } | ||
431 | |||
464 | static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, | 432 | static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, |
465 | struct inode *new_dir, struct dentry *new_dentry) | 433 | struct inode *new_dir, struct dentry *new_dentry) |
466 | { | 434 | { |