diff options
Diffstat (limited to 'fs/ntfs/namei.c')
| -rw-r--r-- | fs/ntfs/namei.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index 7c7e13b43b2e..351dbc3b6e40 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c | |||
| @@ -153,8 +153,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, | |||
| 153 | ntfs_error(vol->sb, "ntfs_iget(0x%lx) failed with " | 153 | ntfs_error(vol->sb, "ntfs_iget(0x%lx) failed with " |
| 154 | "error code %li.", dent_ino, | 154 | "error code %li.", dent_ino, |
| 155 | PTR_ERR(dent_inode)); | 155 | PTR_ERR(dent_inode)); |
| 156 | if (name) | 156 | kfree(name); |
| 157 | kfree(name); | ||
| 158 | /* Return the error code. */ | 157 | /* Return the error code. */ |
| 159 | return (struct dentry *)dent_inode; | 158 | return (struct dentry *)dent_inode; |
| 160 | } | 159 | } |
| @@ -380,7 +379,7 @@ struct inode_operations ntfs_dir_inode_ops = { | |||
| 380 | * Return the dentry of the parent directory on success or the error code on | 379 | * Return the dentry of the parent directory on success or the error code on |
| 381 | * error (IS_ERR() is true). | 380 | * error (IS_ERR() is true). |
| 382 | */ | 381 | */ |
| 383 | struct dentry *ntfs_get_parent(struct dentry *child_dent) | 382 | static struct dentry *ntfs_get_parent(struct dentry *child_dent) |
| 384 | { | 383 | { |
| 385 | struct inode *vi = child_dent->d_inode; | 384 | struct inode *vi = child_dent->d_inode; |
| 386 | ntfs_inode *ni = NTFS_I(vi); | 385 | ntfs_inode *ni = NTFS_I(vi); |
| @@ -465,7 +464,7 @@ try_next: | |||
| 465 | * | 464 | * |
| 466 | * Return the dentry on success or the error code on error (IS_ERR() is true). | 465 | * Return the dentry on success or the error code on error (IS_ERR() is true). |
| 467 | */ | 466 | */ |
| 468 | struct dentry *ntfs_get_dentry(struct super_block *sb, void *fh) | 467 | static struct dentry *ntfs_get_dentry(struct super_block *sb, void *fh) |
| 469 | { | 468 | { |
| 470 | struct inode *vi; | 469 | struct inode *vi; |
| 471 | struct dentry *dent; | 470 | struct dentry *dent; |
| @@ -496,3 +495,30 @@ struct dentry *ntfs_get_dentry(struct super_block *sb, void *fh) | |||
| 496 | ntfs_debug("Done for inode 0x%lx, generation 0x%x.", ino, gen); | 495 | ntfs_debug("Done for inode 0x%lx, generation 0x%x.", ino, gen); |
| 497 | return dent; | 496 | return dent; |
| 498 | } | 497 | } |
| 498 | |||
| 499 | /** | ||
| 500 | * Export operations allowing NFS exporting of mounted NTFS partitions. | ||
| 501 | * | ||
| 502 | * We use the default ->decode_fh() and ->encode_fh() for now. Note that they | ||
| 503 | * use 32 bits to store the inode number which is an unsigned long so on 64-bit | ||
| 504 | * architectures is usually 64 bits so it would all fail horribly on huge | ||
| 505 | * volumes. I guess we need to define our own encode and decode fh functions | ||
| 506 | * that store 64-bit inode numbers at some point but for now we will ignore the | ||
| 507 | * problem... | ||
| 508 | * | ||
| 509 | * We also use the default ->get_name() helper (used by ->decode_fh() via | ||
| 510 | * fs/exportfs/expfs.c::find_exported_dentry()) as that is completely fs | ||
| 511 | * independent. | ||
| 512 | * | ||
| 513 | * The default ->get_parent() just returns -EACCES so we have to provide our | ||
| 514 | * own and the default ->get_dentry() is incompatible with NTFS due to not | ||
| 515 | * allowing the inode number 0 which is used in NTFS for the system file $MFT | ||
| 516 | * and due to using iget() whereas NTFS needs ntfs_iget(). | ||
| 517 | */ | ||
| 518 | struct export_operations ntfs_export_ops = { | ||
| 519 | .get_parent = ntfs_get_parent, /* Find the parent of a given | ||
| 520 | directory. */ | ||
| 521 | .get_dentry = ntfs_get_dentry, /* Find a dentry for the inode | ||
| 522 | given a file handle | ||
| 523 | sub-fragment. */ | ||
| 524 | }; | ||
