]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/hfsplus/dir.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / fs / hfsplus / dir.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
1da177e4
LT
2/*
3 * linux/fs/hfsplus/dir.c
4 *
5 * Copyright (C) 2001
6 * Brad Boyer (flar@allandria.com)
7 * (C) 2003 Ardis Technologies <roman@ardistech.com>
8 *
9 * Handling of directories
10 */
11
12#include <linux/errno.h>
13#include <linux/fs.h>
1da177e4
LT
14#include <linux/slab.h>
15#include <linux/random.h>
017f8da4 16#include <linux/nls.h>
1da177e4
LT
17
18#include "hfsplus_fs.h"
19#include "hfsplus_raw.h"
324ef39a 20#include "xattr.h"
b4c1107c 21#include "acl.h"
1da177e4
LT
22
23static inline void hfsplus_instantiate(struct dentry *dentry,
24 struct inode *inode, u32 cnid)
25{
26 dentry->d_fsdata = (void *)(unsigned long)cnid;
27 d_instantiate(dentry, inode);
28}
29
30/* Find the entry inside dir named dentry->d_name */
31static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
00cd8dd3 32 unsigned int flags)
1da177e4
LT
33{
34 struct inode *inode = NULL;
35 struct hfs_find_data fd;
36 struct super_block *sb;
37 hfsplus_cat_entry entry;
38 int err;
39 u32 cnid, linkid = 0;
40 u16 type;
41
42 sb = dir->i_sb;
d45bce8f 43
1da177e4 44 dentry->d_fsdata = NULL;
5bd9d99d
AK
45 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
46 if (err)
47 return ERR_PTR(err);
89ac9b4d
SS
48 err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino,
49 &dentry->d_name);
50 if (unlikely(err < 0))
51 goto fail;
1da177e4
LT
52again:
53 err = hfs_brec_read(&fd, &entry, sizeof(entry));
54 if (err) {
55 if (err == -ENOENT) {
56 hfs_find_exit(&fd);
57 /* No such entry */
58 inode = NULL;
59 goto out;
60 }
61 goto fail;
62 }
63 type = be16_to_cpu(entry.type);
64 if (type == HFSPLUS_FOLDER) {
65 if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) {
66 err = -EIO;
67 goto fail;
68 }
69 cnid = be32_to_cpu(entry.folder.id);
70 dentry->d_fsdata = (void *)(unsigned long)cnid;
71 } else if (type == HFSPLUS_FILE) {
72 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
73 err = -EIO;
74 goto fail;
75 }
76 cnid = be32_to_cpu(entry.file.id);
2753cc28
AS
77 if (entry.file.user_info.fdType ==
78 cpu_to_be32(HFSP_HARDLINK_TYPE) &&
79 entry.file.user_info.fdCreator ==
80 cpu_to_be32(HFSP_HFSPLUS_CREATOR) &&
81 (entry.file.create_date ==
82 HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->
83 create_date ||
84 entry.file.create_date ==
2b0143b5 85 HFSPLUS_I(d_inode(sb->s_root))->
2753cc28
AS
86 create_date) &&
87 HFSPLUS_SB(sb)->hidden_dir) {
1da177e4
LT
88 struct qstr str;
89 char name[32];
90
91 if (dentry->d_fsdata) {
af8c85bb
RZ
92 /*
93 * We found a link pointing to another link,
94 * so ignore it and treat it as regular file.
95 */
96 cnid = (unsigned long)dentry->d_fsdata;
97 linkid = 0;
98 } else {
99 dentry->d_fsdata = (void *)(unsigned long)cnid;
2753cc28
AS
100 linkid =
101 be32_to_cpu(entry.file.permissions.dev);
af8c85bb
RZ
102 str.len = sprintf(name, "iNode%d", linkid);
103 str.name = name;
89ac9b4d 104 err = hfsplus_cat_build_key(sb, fd.search_key,
2753cc28
AS
105 HFSPLUS_SB(sb)->hidden_dir->i_ino,
106 &str);
89ac9b4d
SS
107 if (unlikely(err < 0))
108 goto fail;
af8c85bb 109 goto again;
1da177e4 110 }
1da177e4
LT
111 } else if (!dentry->d_fsdata)
112 dentry->d_fsdata = (void *)(unsigned long)cnid;
113 } else {
d6142673 114 pr_err("invalid catalog entry type in lookup\n");
1da177e4
LT
115 err = -EIO;
116 goto fail;
117 }
118 hfs_find_exit(&fd);
63525391
DH
119 inode = hfsplus_iget(dir->i_sb, cnid);
120 if (IS_ERR(inode))
121 return ERR_CAST(inode);
1da177e4 122 if (S_ISREG(inode->i_mode))
f6089ff8 123 HFSPLUS_I(inode)->linkid = linkid;
1da177e4
LT
124out:
125 d_add(dentry, inode);
126 return NULL;
127fail:
128 hfs_find_exit(&fd);
129 return ERR_PTR(err);
130}
131
e72514e7 132static int hfsplus_readdir(struct file *file, struct dir_context *ctx)
1da177e4 133{
e72514e7 134 struct inode *inode = file_inode(file);
1da177e4
LT
135 struct super_block *sb = inode->i_sb;
136 int len, err;
017f8da4 137 char *strbuf;
1da177e4
LT
138 hfsplus_cat_entry entry;
139 struct hfs_find_data fd;
140 struct hfsplus_readdir_data *rd;
141 u16 type;
142
e72514e7 143 if (file->f_pos >= inode->i_size)
1da177e4
LT
144 return 0;
145
5bd9d99d
AK
146 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
147 if (err)
148 return err;
017f8da4
HTL
149 strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN + 1, GFP_KERNEL);
150 if (!strbuf) {
151 err = -ENOMEM;
152 goto out;
153 }
89ac9b4d 154 hfsplus_cat_build_key_with_cnid(sb, fd.search_key, inode->i_ino);
324ef39a 155 err = hfs_brec_find(&fd, hfs_find_rec_by_key);
1da177e4
LT
156 if (err)
157 goto out;
158
e72514e7 159 if (ctx->pos == 0) {
1da177e4 160 /* This is completely artificial... */
e72514e7 161 if (!dir_emit_dot(file, ctx))
1da177e4 162 goto out;
e72514e7
AV
163 ctx->pos = 1;
164 }
165 if (ctx->pos == 1) {
6f24f892
GKH
166 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
167 err = -EIO;
168 goto out;
169 }
170
2753cc28
AS
171 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
172 fd.entrylength);
1da177e4 173 if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
d6142673 174 pr_err("bad catalog folder thread\n");
1da177e4
LT
175 err = -EIO;
176 goto out;
177 }
178 if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) {
d6142673 179 pr_err("truncated catalog thread\n");
1da177e4
LT
180 err = -EIO;
181 goto out;
182 }
e72514e7 183 if (!dir_emit(ctx, "..", 2,
1da177e4
LT
184 be32_to_cpu(entry.thread.parentID), DT_DIR))
185 goto out;
e72514e7 186 ctx->pos = 2;
1da177e4 187 }
e72514e7
AV
188 if (ctx->pos >= inode->i_size)
189 goto out;
190 err = hfs_brec_goto(&fd, ctx->pos - 1);
191 if (err)
192 goto out;
1da177e4
LT
193 for (;;) {
194 if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) {
d6142673 195 pr_err("walked past end of dir\n");
1da177e4
LT
196 err = -EIO;
197 goto out;
198 }
6f24f892
GKH
199
200 if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
201 err = -EIO;
202 goto out;
203 }
204
2753cc28
AS
205 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
206 fd.entrylength);
1da177e4 207 type = be16_to_cpu(entry.type);
017f8da4 208 len = NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN;
1da177e4
LT
209 err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len);
210 if (err)
211 goto out;
212 if (type == HFSPLUS_FOLDER) {
2753cc28
AS
213 if (fd.entrylength <
214 sizeof(struct hfsplus_cat_folder)) {
d6142673 215 pr_err("small dir entry\n");
1da177e4
LT
216 err = -EIO;
217 goto out;
218 }
dd73a01a
CH
219 if (HFSPLUS_SB(sb)->hidden_dir &&
220 HFSPLUS_SB(sb)->hidden_dir->i_ino ==
221 be32_to_cpu(entry.folder.id))
1da177e4 222 goto next;
e72514e7 223 if (!dir_emit(ctx, strbuf, len,
1da177e4
LT
224 be32_to_cpu(entry.folder.id), DT_DIR))
225 break;
226 } else if (type == HFSPLUS_FILE) {
97a62eae
SA
227 u16 mode;
228 unsigned type = DT_UNKNOWN;
229
1da177e4 230 if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
d6142673 231 pr_err("small file entry\n");
1da177e4
LT
232 err = -EIO;
233 goto out;
234 }
97a62eae
SA
235
236 mode = be16_to_cpu(entry.file.permissions.mode);
237 if (S_ISREG(mode))
238 type = DT_REG;
239 else if (S_ISLNK(mode))
240 type = DT_LNK;
241 else if (S_ISFIFO(mode))
242 type = DT_FIFO;
243 else if (S_ISCHR(mode))
244 type = DT_CHR;
245 else if (S_ISBLK(mode))
246 type = DT_BLK;
247 else if (S_ISSOCK(mode))
248 type = DT_SOCK;
249
e72514e7 250 if (!dir_emit(ctx, strbuf, len,
97a62eae 251 be32_to_cpu(entry.file.id), type))
1da177e4
LT
252 break;
253 } else {
d6142673 254 pr_err("bad catalog entry type\n");
1da177e4
LT
255 err = -EIO;
256 goto out;
257 }
20b7643d 258next:
e72514e7
AV
259 ctx->pos++;
260 if (ctx->pos >= inode->i_size)
1da177e4
LT
261 goto out;
262 err = hfs_brec_goto(&fd, 1);
263 if (err)
264 goto out;
265 }
e72514e7 266 rd = file->private_data;
1da177e4
LT
267 if (!rd) {
268 rd = kmalloc(sizeof(struct hfsplus_readdir_data), GFP_KERNEL);
269 if (!rd) {
270 err = -ENOMEM;
271 goto out;
272 }
e72514e7
AV
273 file->private_data = rd;
274 rd->file = file;
323ee8fc 275 spin_lock(&HFSPLUS_I(inode)->open_dir_lock);
6af502de 276 list_add(&rd->list, &HFSPLUS_I(inode)->open_dir_list);
323ee8fc 277 spin_unlock(&HFSPLUS_I(inode)->open_dir_lock);
1da177e4 278 }
323ee8fc
AV
279 /*
280 * Can be done after the list insertion; exclusion with
281 * hfsplus_delete_cat() is provided by directory lock.
282 */
1da177e4
LT
283 memcpy(&rd->key, fd.key, sizeof(struct hfsplus_cat_key));
284out:
017f8da4 285 kfree(strbuf);
1da177e4
LT
286 hfs_find_exit(&fd);
287 return err;
288}
289
290static int hfsplus_dir_release(struct inode *inode, struct file *file)
291{
292 struct hfsplus_readdir_data *rd = file->private_data;
293 if (rd) {
323ee8fc 294 spin_lock(&HFSPLUS_I(inode)->open_dir_lock);
1da177e4 295 list_del(&rd->list);
323ee8fc 296 spin_unlock(&HFSPLUS_I(inode)->open_dir_lock);
1da177e4
LT
297 kfree(rd);
298 }
299 return 0;
300}
301
1da177e4
LT
302static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
303 struct dentry *dst_dentry)
304{
dd73a01a 305 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb);
2b0143b5
DH
306 struct inode *inode = d_inode(src_dentry);
307 struct inode *src_dir = d_inode(src_dentry->d_parent);
1da177e4
LT
308 struct qstr str;
309 char name[32];
310 u32 cnid, id;
311 int res;
312
313 if (HFSPLUS_IS_RSRC(inode))
314 return -EPERM;
f6089ff8
CH
315 if (!S_ISREG(inode->i_mode))
316 return -EPERM;
1da177e4 317
7ac9fb9c 318 mutex_lock(&sbi->vh_mutex);
1da177e4
LT
319 if (inode->i_ino == (u32)(unsigned long)src_dentry->d_fsdata) {
320 for (;;) {
321 get_random_bytes(&id, sizeof(cnid));
322 id &= 0x3fffffff;
323 str.name = name;
324 str.len = sprintf(name, "iNode%d", id);
325 res = hfsplus_rename_cat(inode->i_ino,
326 src_dir, &src_dentry->d_name,
dd73a01a 327 sbi->hidden_dir, &str);
1da177e4
LT
328 if (!res)
329 break;
330 if (res != -EEXIST)
7ac9fb9c 331 goto out;
1da177e4 332 }
f6089ff8 333 HFSPLUS_I(inode)->linkid = id;
dd73a01a 334 cnid = sbi->next_cnid++;
1da177e4 335 src_dentry->d_fsdata = (void *)(unsigned long)cnid;
2753cc28
AS
336 res = hfsplus_create_cat(cnid, src_dir,
337 &src_dentry->d_name, inode);
1da177e4
LT
338 if (res)
339 /* panic? */
7ac9fb9c 340 goto out;
dd73a01a 341 sbi->file_count++;
1da177e4 342 }
dd73a01a 343 cnid = sbi->next_cnid++;
1da177e4
LT
344 res = hfsplus_create_cat(cnid, dst_dir, &dst_dentry->d_name, inode);
345 if (res)
7ac9fb9c 346 goto out;
1da177e4 347
d8c76e6f 348 inc_nlink(inode);
1da177e4 349 hfsplus_instantiate(dst_dentry, inode, cnid);
7de9c6ee 350 ihold(inode);
02027d42 351 inode->i_ctime = current_time(inode);
1da177e4 352 mark_inode_dirty(inode);
dd73a01a 353 sbi->file_count++;
9e6c5829 354 hfsplus_mark_mdb_dirty(dst_dir->i_sb);
7ac9fb9c
CH
355out:
356 mutex_unlock(&sbi->vh_mutex);
357 return res;
1da177e4
LT
358}
359
360static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
361{
dd73a01a 362 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
2b0143b5 363 struct inode *inode = d_inode(dentry);
1da177e4
LT
364 struct qstr str;
365 char name[32];
366 u32 cnid;
367 int res;
368
369 if (HFSPLUS_IS_RSRC(inode))
370 return -EPERM;
371
7ac9fb9c 372 mutex_lock(&sbi->vh_mutex);
1da177e4
LT
373 cnid = (u32)(unsigned long)dentry->d_fsdata;
374 if (inode->i_ino == cnid &&
6af502de 375 atomic_read(&HFSPLUS_I(inode)->opencnt)) {
1da177e4
LT
376 str.name = name;
377 str.len = sprintf(name, "temp%lu", inode->i_ino);
378 res = hfsplus_rename_cat(inode->i_ino,
379 dir, &dentry->d_name,
dd73a01a 380 sbi->hidden_dir, &str);
85b8fe8c 381 if (!res) {
1da177e4 382 inode->i_flags |= S_DEAD;
85b8fe8c
CH
383 drop_nlink(inode);
384 }
7ac9fb9c 385 goto out;
1da177e4
LT
386 }
387 res = hfsplus_delete_cat(cnid, dir, &dentry->d_name);
388 if (res)
7ac9fb9c 389 goto out;
1da177e4 390
af8c85bb 391 if (inode->i_nlink > 0)
9a53c3a7 392 drop_nlink(inode);
76b0c26a
RZ
393 if (inode->i_ino == cnid)
394 clear_nlink(inode);
395 if (!inode->i_nlink) {
396 if (inode->i_ino != cnid) {
dd73a01a 397 sbi->file_count--;
6af502de 398 if (!atomic_read(&HFSPLUS_I(inode)->opencnt)) {
76b0c26a 399 res = hfsplus_delete_cat(inode->i_ino,
dd73a01a 400 sbi->hidden_dir,
76b0c26a
RZ
401 NULL);
402 if (!res)
403 hfsplus_delete_inode(inode);
404 } else
405 inode->i_flags |= S_DEAD;
1da177e4 406 } else
76b0c26a 407 hfsplus_delete_inode(inode);
af8c85bb 408 } else
dd73a01a 409 sbi->file_count--;
02027d42 410 inode->i_ctime = current_time(inode);
1da177e4 411 mark_inode_dirty(inode);
7ac9fb9c
CH
412out:
413 mutex_unlock(&sbi->vh_mutex);
1da177e4
LT
414 return res;
415}
416
1da177e4
LT
417static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
418{
7ac9fb9c 419 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
2b0143b5 420 struct inode *inode = d_inode(dentry);
1da177e4
LT
421 int res;
422
1da177e4
LT
423 if (inode->i_size != 2)
424 return -ENOTEMPTY;
7ac9fb9c
CH
425
426 mutex_lock(&sbi->vh_mutex);
1da177e4
LT
427 res = hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name);
428 if (res)
7ac9fb9c 429 goto out;
ce71ec36 430 clear_nlink(inode);
02027d42 431 inode->i_ctime = current_time(inode);
1da177e4
LT
432 hfsplus_delete_inode(inode);
433 mark_inode_dirty(inode);
7ac9fb9c
CH
434out:
435 mutex_unlock(&sbi->vh_mutex);
436 return res;
1da177e4
LT
437}
438
439static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
440 const char *symname)
441{
7ac9fb9c 442 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
1da177e4 443 struct inode *inode;
27a4e388 444 int res = -ENOMEM;
1da177e4 445
7ac9fb9c 446 mutex_lock(&sbi->vh_mutex);
f17c89bf 447 inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO);
1da177e4 448 if (!inode)
7ac9fb9c 449 goto out;
1da177e4
LT
450
451 res = page_symlink(inode, symname, strlen(symname) + 1);
f17c89bf
CH
452 if (res)
453 goto out_err;
1da177e4 454
1da177e4 455 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
f17c89bf
CH
456 if (res)
457 goto out_err;
1da177e4 458
324ef39a
VD
459 res = hfsplus_init_inode_security(inode, dir, &dentry->d_name);
460 if (res == -EOPNOTSUPP)
461 res = 0; /* Operation is not supported. */
462 else if (res) {
463 /* Try to delete anyway without error analysis. */
464 hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name);
465 goto out_err;
466 }
467
f17c89bf
CH
468 hfsplus_instantiate(dentry, inode, inode->i_ino);
469 mark_inode_dirty(inode);
7ac9fb9c 470 goto out;
1da177e4 471
f17c89bf 472out_err:
6d6b77f1 473 clear_nlink(inode);
f17c89bf
CH
474 hfsplus_delete_inode(inode);
475 iput(inode);
7ac9fb9c
CH
476out:
477 mutex_unlock(&sbi->vh_mutex);
1da177e4
LT
478 return res;
479}
480
481static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
1a67aafb 482 umode_t mode, dev_t rdev)
1da177e4 483{
7ac9fb9c 484 struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
1da177e4 485 struct inode *inode;
27a4e388 486 int res = -ENOMEM;
1da177e4 487
7ac9fb9c 488 mutex_lock(&sbi->vh_mutex);
30d3abbe 489 inode = hfsplus_new_inode(dir->i_sb, mode);
1da177e4 490 if (!inode)
7ac9fb9c 491 goto out;
1da177e4 492
90e61690
CH
493 if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
494 init_special_inode(inode, mode, rdev);
495
1da177e4 496 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
324ef39a
VD
497 if (res)
498 goto failed_mknod;
499
500 res = hfsplus_init_inode_security(inode, dir, &dentry->d_name);
501 if (res == -EOPNOTSUPP)
502 res = 0; /* Operation is not supported. */
503 else if (res) {
504 /* Try to delete anyway without error analysis. */
505 hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name);
506 goto failed_mknod;
1da177e4 507 }
30d3abbe 508
1da177e4
LT
509 hfsplus_instantiate(dentry, inode, inode->i_ino);
510 mark_inode_dirty(inode);
324ef39a
VD
511 goto out;
512
513failed_mknod:
514 clear_nlink(inode);
515 hfsplus_delete_inode(inode);
516 iput(inode);
7ac9fb9c
CH
517out:
518 mutex_unlock(&sbi->vh_mutex);
519 return res;
1da177e4
LT
520}
521
4acdaf27 522static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode,
ebfc3b49 523 bool excl)
30d3abbe
CH
524{
525 return hfsplus_mknod(dir, dentry, mode, 0);
526}
527
18bb1db3 528static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
30d3abbe
CH
529{
530 return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0);
531}
532
1da177e4 533static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry,
f03b8ad8
MS
534 struct inode *new_dir, struct dentry *new_dentry,
535 unsigned int flags)
1da177e4
LT
536{
537 int res;
538
f03b8ad8
MS
539 if (flags & ~RENAME_NOREPLACE)
540 return -EINVAL;
541
1da177e4 542 /* Unlink destination if it already exists */
2b0143b5 543 if (d_really_is_positive(new_dentry)) {
e36cb0b8 544 if (d_is_dir(new_dentry))
40de9a7c 545 res = hfsplus_rmdir(new_dir, new_dentry);
e3911785 546 else
40de9a7c 547 res = hfsplus_unlink(new_dir, new_dentry);
1da177e4
LT
548 if (res)
549 return res;
550 }
551
552 res = hfsplus_rename_cat((u32)(unsigned long)old_dentry->d_fsdata,
553 old_dir, &old_dentry->d_name,
554 new_dir, &new_dentry->d_name);
555 if (!res)
556 new_dentry->d_fsdata = old_dentry->d_fsdata;
557 return res;
558}
559
92e1d5be 560const struct inode_operations hfsplus_dir_inode_operations = {
324ef39a
VD
561 .lookup = hfsplus_lookup,
562 .create = hfsplus_create,
563 .link = hfsplus_link,
564 .unlink = hfsplus_unlink,
565 .mkdir = hfsplus_mkdir,
566 .rmdir = hfsplus_rmdir,
567 .symlink = hfsplus_symlink,
568 .mknod = hfsplus_mknod,
569 .rename = hfsplus_rename,
324ef39a 570 .listxattr = hfsplus_listxattr,
b4c1107c
VD
571#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
572 .get_acl = hfsplus_get_posix_acl,
b0a7ab57 573 .set_acl = hfsplus_set_posix_acl,
b4c1107c 574#endif
1da177e4
LT
575};
576
4b6f5d20 577const struct file_operations hfsplus_dir_operations = {
eb29d66d 578 .fsync = hfsplus_file_fsync,
1da177e4 579 .read = generic_read_dir,
323ee8fc 580 .iterate_shared = hfsplus_readdir,
7cc4bcc6 581 .unlocked_ioctl = hfsplus_ioctl,
1da177e4
LT
582 .llseek = generic_file_llseek,
583 .release = hfsplus_dir_release,
584};