|
@@ -28,29 +28,6 @@
|
|
|
|
|
|
#include "coda_int.h"
|
|
|
|
|
|
-/* dir inode-ops */
|
|
|
-static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, bool excl);
|
|
|
-static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, unsigned int flags);
|
|
|
-static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
|
|
|
- struct dentry *entry);
|
|
|
-static int coda_unlink(struct inode *dir_inode, struct dentry *entry);
|
|
|
-static int coda_symlink(struct inode *dir_inode, struct dentry *entry,
|
|
|
- const char *symname);
|
|
|
-static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, umode_t mode);
|
|
|
-static int coda_rmdir(struct inode *dir_inode, struct dentry *entry);
|
|
|
-static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
|
|
|
- struct inode *new_inode, struct dentry *new_dentry);
|
|
|
-
|
|
|
-/* dir file-ops */
|
|
|
-static int coda_readdir(struct file *file, struct dir_context *ctx);
|
|
|
-
|
|
|
-/* dentry ops */
|
|
|
-static int coda_dentry_revalidate(struct dentry *de, unsigned int flags);
|
|
|
-static int coda_dentry_delete(const struct dentry *);
|
|
|
-
|
|
|
-/* support routines */
|
|
|
-static int coda_venus_readdir(struct file *, struct dir_context *);
|
|
|
-
|
|
|
/* same as fs/bad_inode.c */
|
|
|
static int coda_return_EIO(void)
|
|
|
{
|
|
@@ -58,38 +35,6 @@ static int coda_return_EIO(void)
|
|
|
}
|
|
|
#define CODA_EIO_ERROR ((void *) (coda_return_EIO))
|
|
|
|
|
|
-const struct dentry_operations coda_dentry_operations =
|
|
|
-{
|
|
|
- .d_revalidate = coda_dentry_revalidate,
|
|
|
- .d_delete = coda_dentry_delete,
|
|
|
-};
|
|
|
-
|
|
|
-const struct inode_operations coda_dir_inode_operations =
|
|
|
-{
|
|
|
- .create = coda_create,
|
|
|
- .lookup = coda_lookup,
|
|
|
- .link = coda_link,
|
|
|
- .unlink = coda_unlink,
|
|
|
- .symlink = coda_symlink,
|
|
|
- .mkdir = coda_mkdir,
|
|
|
- .rmdir = coda_rmdir,
|
|
|
- .mknod = CODA_EIO_ERROR,
|
|
|
- .rename = coda_rename,
|
|
|
- .permission = coda_permission,
|
|
|
- .getattr = coda_getattr,
|
|
|
- .setattr = coda_setattr,
|
|
|
-};
|
|
|
-
|
|
|
-const struct file_operations coda_dir_operations = {
|
|
|
- .llseek = generic_file_llseek,
|
|
|
- .read = generic_read_dir,
|
|
|
- .iterate = coda_readdir,
|
|
|
- .open = coda_open,
|
|
|
- .release = coda_release,
|
|
|
- .fsync = coda_fsync,
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
/* inode operations for directories */
|
|
|
/* access routines: lookup, readlink, permission */
|
|
|
static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags)
|
|
@@ -374,33 +319,6 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|
|
return error;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-/* file operations for directories */
|
|
|
-static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
|
|
|
-{
|
|
|
- struct coda_file_info *cfi;
|
|
|
- struct file *host_file;
|
|
|
- int ret;
|
|
|
-
|
|
|
- cfi = CODA_FTOC(coda_file);
|
|
|
- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
|
|
|
- host_file = cfi->cfi_container;
|
|
|
-
|
|
|
- if (host_file->f_op->iterate) {
|
|
|
- struct inode *host_inode = file_inode(host_file);
|
|
|
- mutex_lock(&host_inode->i_mutex);
|
|
|
- ret = -ENOENT;
|
|
|
- if (!IS_DEADDIR(host_inode)) {
|
|
|
- ret = host_file->f_op->iterate(host_file, ctx);
|
|
|
- file_accessed(host_file);
|
|
|
- }
|
|
|
- mutex_unlock(&host_inode->i_mutex);
|
|
|
- return ret;
|
|
|
- }
|
|
|
- /* Venus: we must read Venus dirents from a file */
|
|
|
- return coda_venus_readdir(coda_file, ctx);
|
|
|
-}
|
|
|
-
|
|
|
static inline unsigned int CDT2DT(unsigned char cdt)
|
|
|
{
|
|
|
unsigned int dt;
|
|
@@ -495,6 +413,33 @@ out:
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/* file operations for directories */
|
|
|
+static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
|
|
|
+{
|
|
|
+ struct coda_file_info *cfi;
|
|
|
+ struct file *host_file;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ cfi = CODA_FTOC(coda_file);
|
|
|
+ BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
|
|
|
+ host_file = cfi->cfi_container;
|
|
|
+
|
|
|
+ if (host_file->f_op->iterate) {
|
|
|
+ struct inode *host_inode = file_inode(host_file);
|
|
|
+
|
|
|
+ mutex_lock(&host_inode->i_mutex);
|
|
|
+ ret = -ENOENT;
|
|
|
+ if (!IS_DEADDIR(host_inode)) {
|
|
|
+ ret = host_file->f_op->iterate(host_file, ctx);
|
|
|
+ file_accessed(host_file);
|
|
|
+ }
|
|
|
+ mutex_unlock(&host_inode->i_mutex);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ /* Venus: we must read Venus dirents from a file */
|
|
|
+ return coda_venus_readdir(coda_file, ctx);
|
|
|
+}
|
|
|
+
|
|
|
/* called when a cache lookup succeeds */
|
|
|
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
|
|
|
{
|
|
@@ -603,3 +548,32 @@ int coda_revalidate_inode(struct inode *inode)
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+const struct dentry_operations coda_dentry_operations = {
|
|
|
+ .d_revalidate = coda_dentry_revalidate,
|
|
|
+ .d_delete = coda_dentry_delete,
|
|
|
+};
|
|
|
+
|
|
|
+const struct inode_operations coda_dir_inode_operations = {
|
|
|
+ .create = coda_create,
|
|
|
+ .lookup = coda_lookup,
|
|
|
+ .link = coda_link,
|
|
|
+ .unlink = coda_unlink,
|
|
|
+ .symlink = coda_symlink,
|
|
|
+ .mkdir = coda_mkdir,
|
|
|
+ .rmdir = coda_rmdir,
|
|
|
+ .mknod = CODA_EIO_ERROR,
|
|
|
+ .rename = coda_rename,
|
|
|
+ .permission = coda_permission,
|
|
|
+ .getattr = coda_getattr,
|
|
|
+ .setattr = coda_setattr,
|
|
|
+};
|
|
|
+
|
|
|
+const struct file_operations coda_dir_operations = {
|
|
|
+ .llseek = generic_file_llseek,
|
|
|
+ .read = generic_read_dir,
|
|
|
+ .iterate = coda_readdir,
|
|
|
+ .open = coda_open,
|
|
|
+ .release = coda_release,
|
|
|
+ .fsync = coda_fsync,
|
|
|
+};
|