]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - module/spl/spl-vnode.c
Fix two minor compiler warnings
[mirror_spl-debian.git] / module / spl / spl-vnode.c
index b5c34fbcd0c82ad73b77b381927ab32adaf610ff..dd759bf7fb81fd384805262a322ab3dfc9d4fce0 100644 (file)
  *  Solaris Porting Layer (SPL) Vnode Implementation.
 \*****************************************************************************/
 
-#include <sys/sysmacros.h>
 #include <sys/vnode.h>
+#include <spl-debug.h>
 
-
-#ifdef DEBUG_SUBSYSTEM
-#undef DEBUG_SUBSYSTEM
+#ifdef SS_DEBUG_SUBSYS
+#undef SS_DEBUG_SUBSYS
 #endif
 
-#define DEBUG_SUBSYSTEM S_VNODE
+#define SS_DEBUG_SUBSYS SS_VNODE
 
 vnode_t *rootdir = (vnode_t *)0xabcd1234;
 EXPORT_SYMBOL(rootdir);
@@ -77,7 +76,7 @@ vnode_t *
 vn_alloc(int flag)
 {
        vnode_t *vp;
-       ENTRY;
+       SENTRY;
 
        vp = kmem_cache_alloc(vn_cache, flag);
        if (vp != NULL) {
@@ -85,16 +84,16 @@ vn_alloc(int flag)
                vp->v_type = 0;
        }
 
-       RETURN(vp);
+       SRETURN(vp);
 } /* vn_alloc() */
 EXPORT_SYMBOL(vn_alloc);
 
 void
 vn_free(vnode_t *vp)
 {
-       ENTRY;
+       SENTRY;
        kmem_cache_free(vn_cache, vp);
-       EXIT;
+       SEXIT;
 } /* vn_free() */
 EXPORT_SYMBOL(vn_free);
 
@@ -106,7 +105,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
        struct kstat stat;
        int rc, saved_umask = 0;
        vnode_t *vp;
-       ENTRY;
+       SENTRY;
 
        ASSERT(flags & (FWRITE | FREAD));
        ASSERT(seg == UIO_SYSSPACE);
@@ -132,18 +131,18 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
                (void)xchg(&current->fs->umask, saved_umask);
 
        if (IS_ERR(fp))
-               RETURN(-PTR_ERR(fp));
+               SRETURN(-PTR_ERR(fp));
 
        rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
        if (rc) {
                filp_close(fp, 0);
-               RETURN(-rc);
+               SRETURN(-rc);
        }
 
        vp = vn_alloc(KM_SLEEP);
        if (!vp) {
                filp_close(fp, 0);
-               RETURN(ENOMEM);
+               SRETURN(ENOMEM);
        }
 
        mutex_enter(&vp->v_lock);
@@ -152,7 +151,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
        *vpp = vp;
        mutex_exit(&vp->v_lock);
 
-       RETURN(0);
+       SRETURN(0);
 } /* vn_open() */
 EXPORT_SYMBOL(vn_open);
 
@@ -162,20 +161,20 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
 {
        char *realpath;
        int len, rc;
-       ENTRY;
+       SENTRY;
 
        ASSERT(vp == rootdir);
 
        len = strlen(path) + 2;
        realpath = kmalloc(len, GFP_KERNEL);
        if (!realpath)
-               RETURN(ENOMEM);
+               SRETURN(ENOMEM);
 
        (void)snprintf(realpath, len, "/%s", path);
        rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2);
        kfree(realpath);
 
-       RETURN(rc);
+       SRETURN(rc);
 } /* vn_openat() */
 EXPORT_SYMBOL(vn_openat);
 
@@ -187,7 +186,7 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
        mm_segment_t saved_fs;
        struct file *fp;
        int rc;
-       ENTRY;
+       SENTRY;
 
        ASSERT(uio == UIO_WRITE || uio == UIO_READ);
        ASSERT(vp);
@@ -216,16 +215,16 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
        set_fs(saved_fs);
 
        if (rc < 0)
-               RETURN(-rc);
+               SRETURN(-rc);
 
        if (residp) {
                *residp = len - rc;
        } else {
                if (rc != len)
-                       RETURN(EIO);
+                       SRETURN(EIO);
        }
 
-       RETURN(0);
+       SRETURN(0);
 } /* vn_rdwr() */
 EXPORT_SYMBOL(vn_rdwr);
 
@@ -233,7 +232,7 @@ int
 vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4)
 {
        int rc;
-       ENTRY;
+       SENTRY;
 
        ASSERT(vp);
        ASSERT(vp->v_file);
@@ -241,7 +240,7 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4)
        rc = filp_close(vp->v_file, 0);
        vn_free(vp);
 
-       RETURN(-rc);
+       SRETURN(-rc);
 } /* vn_close() */
 EXPORT_SYMBOL(vn_close);
 
@@ -258,7 +257,8 @@ EXPORT_SYMBOL(vn_seek);
 static struct dentry *
 vn_lookup_hash(struct nameidata *nd)
 {
-       return lookup_one_len(nd->last.name, nd->nd_dentry, nd->last.len);
+       return lookup_one_len((const char *)nd->last.name,
+                             nd->nd_dentry, nd->last.len);
 } /* lookup_hash() */
 
 static void
@@ -276,18 +276,18 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
         struct nameidata nd;
         struct inode *inode = NULL;
         int rc = 0;
-        ENTRY;
+        SENTRY;
 
         ASSERT(seg == UIO_SYSSPACE);
         ASSERT(flags == RMFILE);
 
         rc = path_lookup(path, LOOKUP_PARENT, &nd);
         if (rc)
-                GOTO(exit, rc);
+                SGOTO(exit, rc);
 
         rc = -EISDIR;
         if (nd.last_type != LAST_NORM)
-                GOTO(exit1, rc);
+                SGOTO(exit1, rc);
 
 #ifdef HAVE_INODE_I_MUTEX
         mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT);
@@ -299,7 +299,7 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
         if (!IS_ERR(dentry)) {
                 /* Why not before? Because we want correct rc value */
                 if (nd.last.name[nd.last.len])
-                        GOTO(slashes, rc);
+                        SGOTO(slashes, rc);
 
                 inode = dentry->d_inode;
                 if (inode)
@@ -322,12 +322,12 @@ exit2:
 exit1:
         vn_path_release(&nd);
 exit:
-        RETURN(-rc);
+        SRETURN(-rc);
 
 slashes:
         rc = !dentry->d_inode ? -ENOENT :
                 S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
-        GOTO(exit2, rc);
+        SGOTO(exit2, rc);
 } /* vn_remove() */
 EXPORT_SYMBOL(vn_remove);
 
@@ -340,28 +340,28 @@ vn_rename(const char *oldname, const char *newname, int x1)
         struct dentry *trap;
         struct nameidata oldnd, newnd;
         int rc = 0;
-       ENTRY;
+       SENTRY;
 
         rc = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
         if (rc)
-                GOTO(exit, rc);
+                SGOTO(exit, rc);
 
         rc = path_lookup(newname, LOOKUP_PARENT, &newnd);
         if (rc)
-                GOTO(exit1, rc);
+                SGOTO(exit1, rc);
 
         rc = -EXDEV;
         if (oldnd.nd_mnt != newnd.nd_mnt)
-                GOTO(exit2, rc);
+                SGOTO(exit2, rc);
 
         old_dir = oldnd.nd_dentry;
         rc = -EBUSY;
         if (oldnd.last_type != LAST_NORM)
-                GOTO(exit2, rc);
+                SGOTO(exit2, rc);
 
         new_dir = newnd.nd_dentry;
         if (newnd.last_type != LAST_NORM)
-                GOTO(exit2, rc);
+                SGOTO(exit2, rc);
 
         trap = lock_rename(new_dir, old_dir);
 
@@ -369,36 +369,36 @@ vn_rename(const char *oldname, const char *newname, int x1)
 
         rc = PTR_ERR(old_dentry);
         if (IS_ERR(old_dentry))
-                GOTO(exit3, rc);
+                SGOTO(exit3, rc);
 
         /* source must exist */
         rc = -ENOENT;
         if (!old_dentry->d_inode)
-                GOTO(exit4, rc);
+                SGOTO(exit4, rc);
 
         /* unless the source is a directory trailing slashes give -ENOTDIR */
         if (!S_ISDIR(old_dentry->d_inode->i_mode)) {
                 rc = -ENOTDIR;
                 if (oldnd.last.name[oldnd.last.len])
-                        GOTO(exit4, rc);
+                        SGOTO(exit4, rc);
                 if (newnd.last.name[newnd.last.len])
-                        GOTO(exit4, rc);
+                        SGOTO(exit4, rc);
         }
 
         /* source should not be ancestor of target */
         rc = -EINVAL;
         if (old_dentry == trap)
-                GOTO(exit4, rc);
+                SGOTO(exit4, rc);
 
         new_dentry = vn_lookup_hash(&newnd);
         rc = PTR_ERR(new_dentry);
         if (IS_ERR(new_dentry))
-                GOTO(exit4, rc);
+                SGOTO(exit4, rc);
 
         /* target should not be an ancestor of source */
         rc = -ENOTEMPTY;
         if (new_dentry == trap)
-                GOTO(exit5, rc);
+                SGOTO(exit5, rc);
 
 #ifdef HAVE_4ARGS_VFS_RENAME
         rc = vfs_rename(old_dir->d_inode, old_dentry,
@@ -418,7 +418,7 @@ exit2:
 exit1:
         vn_path_release(&oldnd);
 exit:
-        RETURN(-rc);
+        SRETURN(-rc);
 }
 EXPORT_SYMBOL(vn_rename);
 
@@ -428,7 +428,7 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
        struct file *fp;
         struct kstat stat;
        int rc;
-       ENTRY;
+       SENTRY;
 
        ASSERT(vp);
        ASSERT(vp->v_file);
@@ -438,7 +438,7 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
 
         rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
        if (rc)
-               RETURN(-rc);
+               SRETURN(-rc);
 
        vap->va_type          = vn_get_sol_type(stat.mode);
        vap->va_mode          = stat.mode;
@@ -458,14 +458,14 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
        vap->va_rdev          = stat.rdev;
        vap->va_blocks        = stat.blocks;
 
-        RETURN(0);
+        SRETURN(0);
 }
 EXPORT_SYMBOL(vn_getattr);
 
 int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4)
 {
        int datasync = 0;
-       ENTRY;
+       SENTRY;
 
        ASSERT(vp);
        ASSERT(vp->v_file);
@@ -473,7 +473,7 @@ int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4)
        if (flags & FDSYNC)
                datasync = 1;
 
-       RETURN(-file_fsync(vp->v_file, vp->v_file->f_dentry, datasync));
+       SRETURN(-spl_filp_fsync(vp->v_file, datasync));
 } /* vn_fsync() */
 EXPORT_SYMBOL(vn_fsync);
 
@@ -503,7 +503,7 @@ vn_getf(int fd)
        file_t *fp;
        vnode_t *vp;
        int rc = 0;
-       ENTRY;
+       SENTRY;
 
        /* Already open just take an extra reference */
        spin_lock(&vn_file_lock);
@@ -512,7 +512,7 @@ vn_getf(int fd)
        if (fp) {
                atomic_inc(&fp->f_ref);
                spin_unlock(&vn_file_lock);
-               RETURN(fp);
+               SRETURN(fp);
        }
 
        spin_unlock(&vn_file_lock);
@@ -520,7 +520,7 @@ vn_getf(int fd)
        /* File was not yet opened create the object and setup */
        fp = kmem_cache_alloc(vn_file_cache, KM_SLEEP);
        if (fp == NULL)
-               GOTO(out, rc);
+               SGOTO(out, rc);
 
        mutex_enter(&fp->f_lock);
 
@@ -530,14 +530,14 @@ vn_getf(int fd)
 
        lfp = fget(fd);
        if (lfp == NULL)
-               GOTO(out_mutex, rc);
+               SGOTO(out_mutex, rc);
 
        vp = vn_alloc(KM_SLEEP);
        if (vp == NULL)
-               GOTO(out_fget, rc);
+               SGOTO(out_fget, rc);
 
         if (vfs_getattr(lfp->f_vfsmnt, lfp->f_dentry, &stat))
-               GOTO(out_vnode, rc);
+               SGOTO(out_vnode, rc);
 
        mutex_enter(&vp->v_lock);
        vp->v_type = vn_get_sol_type(stat.mode);
@@ -553,7 +553,7 @@ vn_getf(int fd)
        spin_unlock(&vn_file_lock);
 
        mutex_exit(&fp->f_lock);
-       RETURN(fp);
+       SRETURN(fp);
 
 out_vnode:
        vn_free(vp);
@@ -563,7 +563,7 @@ out_mutex:
        mutex_exit(&fp->f_lock);
        kmem_cache_free(vn_file_cache, fp);
 out:
-        RETURN(NULL);
+        SRETURN(NULL);
 } /* getf() */
 EXPORT_SYMBOL(getf);
 
@@ -583,7 +583,7 @@ void
 vn_releasef(int fd)
 {
        file_t *fp;
-       ENTRY;
+       SENTRY;
 
        spin_lock(&vn_file_lock);
        fp = file_find(fd);
@@ -591,7 +591,7 @@ vn_releasef(int fd)
                atomic_dec(&fp->f_ref);
                if (atomic_read(&fp->f_ref) > 0) {
                        spin_unlock(&vn_file_lock);
-                       EXIT;
+                       SEXIT;
                        return;
                }
 
@@ -600,7 +600,7 @@ vn_releasef(int fd)
        }
        spin_unlock(&vn_file_lock);
 
-       EXIT;
+       SEXIT;
        return;
 } /* releasef() */
 EXPORT_SYMBOL(releasef);
@@ -655,7 +655,7 @@ vn_set_pwd(const char *filename)
 #endif /* HAVE_2ARGS_SET_FS_PWD */
         mm_segment_t saved_fs;
         int rc;
-        ENTRY;
+        SENTRY;
 
         /*
          * user_path_dir() and __user_walk() both expect 'filename' to be
@@ -669,11 +669,11 @@ vn_set_pwd(const char *filename)
 # ifdef HAVE_USER_PATH_DIR
         rc = user_path_dir(filename, &path);
         if (rc)
-                GOTO(out, rc);
+                SGOTO(out, rc);
 
         rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
         if (rc)
-                GOTO(dput_and_out, rc);
+                SGOTO(dput_and_out, rc);
 
         set_fs_pwd(current->fs, &path);
 
@@ -683,11 +683,11 @@ dput_and_out:
         rc = __user_walk(filename,
                          LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
         if (rc)
-                GOTO(out, rc);
+                SGOTO(out, rc);
 
         rc = vfs_permission(&nd, MAY_EXEC);
         if (rc)
-                GOTO(dput_and_out, rc);
+                SGOTO(dput_and_out, rc);
 
         set_fs_pwd(current->fs, &nd.path);
 
@@ -698,11 +698,11 @@ dput_and_out:
         rc = __user_walk(filename,
                          LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
         if (rc)
-                GOTO(out, rc);
+                SGOTO(out, rc);
 
         rc = vfs_permission(&nd, MAY_EXEC);
         if (rc)
-                GOTO(dput_and_out, rc);
+                SGOTO(dput_and_out, rc);
 
         set_fs_pwd(current->fs, nd.nd_mnt, nd.nd_dentry);
 
@@ -712,7 +712,7 @@ dput_and_out:
 out:
        set_fs(saved_fs);
 
-        RETURN(-rc);
+        SRETURN(-rc);
 } /* vn_set_pwd() */
 EXPORT_SYMBOL(vn_set_pwd);
 
@@ -757,7 +757,7 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
 int
 vn_init(void)
 {
-       ENTRY;
+       SENTRY;
        vn_cache = kmem_cache_create("spl_vn_cache",
                                     sizeof(struct vnode), 64,
                                     vn_cache_constructor,
@@ -769,7 +769,7 @@ vn_init(void)
                                          vn_file_cache_constructor,
                                          vn_file_cache_destructor,
                                          NULL, NULL, NULL, 0);
-       RETURN(0);
+       SRETURN(0);
 } /* vn_init() */
 
 void
@@ -777,7 +777,7 @@ vn_fini(void)
 {
         file_t *fp, *next_fp;
        int leaked = 0;
-       ENTRY;
+       SENTRY;
 
        spin_lock(&vn_file_lock);
 
@@ -792,10 +792,10 @@ vn_fini(void)
        spin_unlock(&vn_file_lock);
 
        if (leaked > 0)
-               CWARN("Warning %d files leaked\n", leaked);
+               SWARN("Warning %d files leaked\n", leaked);
 
        kmem_cache_destroy(vn_cache);
 
-       EXIT;
+       SEXIT;
        return;
 } /* vn_fini() */