aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus')
-rw-r--r--fs/hfsplus/dir.c8
-rw-r--r--fs/hfsplus/hfsplus_fs.h8
-rw-r--r--fs/hfsplus/inode.c6
-rw-r--r--fs/hfsplus/ioctl.c17
4 files changed, 18 insertions, 21 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 1f9ece0de326..7e309751645f 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -298,7 +298,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
298 if (res) 298 if (res)
299 return res; 299 return res;
300 300
301 inode->i_nlink++; 301 inc_nlink(inode);
302 hfsplus_instantiate(dst_dentry, inode, cnid); 302 hfsplus_instantiate(dst_dentry, inode, cnid);
303 atomic_inc(&inode->i_count); 303 atomic_inc(&inode->i_count);
304 inode->i_ctime = CURRENT_TIME_SEC; 304 inode->i_ctime = CURRENT_TIME_SEC;
@@ -338,7 +338,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
338 return res; 338 return res;
339 339
340 if (inode->i_nlink > 0) 340 if (inode->i_nlink > 0)
341 inode->i_nlink--; 341 drop_nlink(inode);
342 hfsplus_delete_inode(inode); 342 hfsplus_delete_inode(inode);
343 if (inode->i_ino != cnid && !inode->i_nlink) { 343 if (inode->i_ino != cnid && !inode->i_nlink) {
344 if (!atomic_read(&HFSPLUS_I(inode).opencnt)) { 344 if (!atomic_read(&HFSPLUS_I(inode).opencnt)) {
@@ -348,7 +348,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
348 } else 348 } else
349 inode->i_flags |= S_DEAD; 349 inode->i_flags |= S_DEAD;
350 } else 350 } else
351 inode->i_nlink = 0; 351 clear_nlink(inode);
352 inode->i_ctime = CURRENT_TIME_SEC; 352 inode->i_ctime = CURRENT_TIME_SEC;
353 mark_inode_dirty(inode); 353 mark_inode_dirty(inode);
354 354
@@ -387,7 +387,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
387 res = hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name); 387 res = hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name);
388 if (res) 388 if (res)
389 return res; 389 return res;
390 inode->i_nlink = 0; 390 clear_nlink(inode);
391 inode->i_ctime = CURRENT_TIME_SEC; 391 inode->i_ctime = CURRENT_TIME_SEC;
392 hfsplus_delete_inode(inode); 392 hfsplus_delete_inode(inode);
393 mark_inode_dirty(inode); 393 mark_inode_dirty(inode);
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 8a1ca5ef7ada..3915635b4470 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -246,12 +246,8 @@ struct hfsplus_readdir_data {
246 246
247/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support 247/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support
248 * chattr/lsattr */ 248 * chattr/lsattr */
249#define HFSPLUS_IOC_EXT2_GETFLAGS _IOR('f', 1, long) 249#define HFSPLUS_IOC_EXT2_GETFLAGS FS_IOC_GETFLAGS
250#define HFSPLUS_IOC_EXT2_SETFLAGS _IOW('f', 2, long) 250#define HFSPLUS_IOC_EXT2_SETFLAGS FS_IOC_SETFLAGS
251
252#define EXT2_FLAG_IMMUTABLE 0x00000010 /* Immutable file */
253#define EXT2_FLAG_APPEND 0x00000020 /* writes to file may only append */
254#define EXT2_FLAG_NODUMP 0x00000040 /* do not dump file */
255 251
256 252
257/* 253/*
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 0eb1a6092668..9e3675249633 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -282,8 +282,10 @@ static struct inode_operations hfsplus_file_inode_operations = {
282 282
283static const struct file_operations hfsplus_file_operations = { 283static const struct file_operations hfsplus_file_operations = {
284 .llseek = generic_file_llseek, 284 .llseek = generic_file_llseek,
285 .read = generic_file_read, 285 .read = do_sync_read,
286 .write = generic_file_write, 286 .aio_read = generic_file_aio_read,
287 .write = do_sync_write,
288 .aio_write = generic_file_aio_write,
287 .mmap = generic_file_mmap, 289 .mmap = generic_file_mmap,
288 .sendfile = generic_file_sendfile, 290 .sendfile = generic_file_sendfile,
289 .fsync = file_fsync, 291 .fsync = file_fsync,
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 13cf848ac833..79fd10402ea3 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -28,11 +28,11 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
28 case HFSPLUS_IOC_EXT2_GETFLAGS: 28 case HFSPLUS_IOC_EXT2_GETFLAGS:
29 flags = 0; 29 flags = 0;
30 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_IMMUTABLE) 30 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_IMMUTABLE)
31 flags |= EXT2_FLAG_IMMUTABLE; /* EXT2_IMMUTABLE_FL */ 31 flags |= FS_IMMUTABLE_FL; /* EXT2_IMMUTABLE_FL */
32 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_APPEND) 32 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_APPEND)
33 flags |= EXT2_FLAG_APPEND; /* EXT2_APPEND_FL */ 33 flags |= FS_APPEND_FL; /* EXT2_APPEND_FL */
34 if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP) 34 if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP)
35 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */ 35 flags |= FS_NODUMP_FL; /* EXT2_NODUMP_FL */
36 return put_user(flags, (int __user *)arg); 36 return put_user(flags, (int __user *)arg);
37 case HFSPLUS_IOC_EXT2_SETFLAGS: { 37 case HFSPLUS_IOC_EXT2_SETFLAGS: {
38 if (IS_RDONLY(inode)) 38 if (IS_RDONLY(inode))
@@ -44,32 +44,31 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
44 if (get_user(flags, (int __user *)arg)) 44 if (get_user(flags, (int __user *)arg))
45 return -EFAULT; 45 return -EFAULT;
46 46
47 if (flags & (EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND) || 47 if (flags & (FS_IMMUTABLE_FL|FS_APPEND_FL) ||
48 HFSPLUS_I(inode).rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) { 48 HFSPLUS_I(inode).rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) {
49 if (!capable(CAP_LINUX_IMMUTABLE)) 49 if (!capable(CAP_LINUX_IMMUTABLE))
50 return -EPERM; 50 return -EPERM;
51 } 51 }
52 52
53 /* don't silently ignore unsupported ext2 flags */ 53 /* don't silently ignore unsupported ext2 flags */
54 if (flags & ~(EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND| 54 if (flags & ~(FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NODUMP_FL))
55 EXT2_FLAG_NODUMP))
56 return -EOPNOTSUPP; 55 return -EOPNOTSUPP;
57 56
58 if (flags & EXT2_FLAG_IMMUTABLE) { /* EXT2_IMMUTABLE_FL */ 57 if (flags & FS_IMMUTABLE_FL) { /* EXT2_IMMUTABLE_FL */
59 inode->i_flags |= S_IMMUTABLE; 58 inode->i_flags |= S_IMMUTABLE;
60 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_IMMUTABLE; 59 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_IMMUTABLE;
61 } else { 60 } else {
62 inode->i_flags &= ~S_IMMUTABLE; 61 inode->i_flags &= ~S_IMMUTABLE;
63 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_IMMUTABLE; 62 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_IMMUTABLE;
64 } 63 }
65 if (flags & EXT2_FLAG_APPEND) { /* EXT2_APPEND_FL */ 64 if (flags & FS_APPEND_FL) { /* EXT2_APPEND_FL */
66 inode->i_flags |= S_APPEND; 65 inode->i_flags |= S_APPEND;
67 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_APPEND; 66 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_APPEND;
68 } else { 67 } else {
69 inode->i_flags &= ~S_APPEND; 68 inode->i_flags &= ~S_APPEND;
70 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_APPEND; 69 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_APPEND;
71 } 70 }
72 if (flags & EXT2_FLAG_NODUMP) /* EXT2_NODUMP_FL */ 71 if (flags & FS_NODUMP_FL) /* EXT2_NODUMP_FL */
73 HFSPLUS_I(inode).userflags |= HFSPLUS_FLG_NODUMP; 72 HFSPLUS_I(inode).userflags |= HFSPLUS_FLG_NODUMP;
74 else 73 else
75 HFSPLUS_I(inode).userflags &= ~HFSPLUS_FLG_NODUMP; 74 HFSPLUS_I(inode).userflags &= ~HFSPLUS_FLG_NODUMP;