Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux.git] / fs / ncpfs / inode.c
index ceeca64f059920606c9047fda5904e4addf173b6..e31e589369a49a930f45be2124114c7252c83723 100644 (file)
@@ -9,6 +9,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
@@ -99,6 +101,7 @@ static void destroy_inodecache(void)
 
 static int ncp_remount(struct super_block *sb, int *flags, char* data)
 {
+       sync_filesystem(sb);
        *flags |= MS_NODIRATIME;
        return 0;
 }
@@ -132,7 +135,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
        NCP_FINFO(inode)->access = nwinfo->access;
        memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
                        sizeof(nwinfo->file_handle));
-       DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
+       ncp_dbg(1, "updated %s, volnum=%d, dirent=%u\n",
                nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
                NCP_FINFO(inode)->dirEntNum);
 }
@@ -140,8 +143,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
 static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
 {
        /* NFS namespace mode overrides others if it's set. */
-       DPRINTK(KERN_DEBUG "ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n",
-               nwi->entryName, nwi->nfs.mode);
+       ncp_dbg(1, "(%s) nfs.mode=0%o\n", nwi->entryName, nwi->nfs.mode);
        if (nwi->nfs.mode) {
                /* XXX Security? */
                inode->i_mode = nwi->nfs.mode;
@@ -229,7 +231,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
        
        ncp_update_attrs(inode, nwinfo);
 
-       DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);
+       ncp_dbg(2, "inode->i_mode = %u\n", inode->i_mode);
 
        set_nlink(inode, 1);
        inode->i_uid = server->m.uid;
@@ -257,7 +259,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
        struct inode *inode;
 
        if (info == NULL) {
-               printk(KERN_ERR "ncp_iget: info is NULL\n");
+               pr_err("%s: info is NULL\n", __func__);
                return NULL;
        }
 
@@ -289,23 +291,23 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
                }
                insert_inode_hash(inode);
        } else
-               printk(KERN_ERR "ncp_iget: iget failed!\n");
+               pr_err("%s: iget failed!\n", __func__);
        return inode;
 }
 
 static void
 ncp_evict_inode(struct inode *inode)
 {
-       truncate_inode_pages(&inode->i_data, 0);
+       truncate_inode_pages_final(&inode->i_data);
        clear_inode(inode);
 
        if (S_ISDIR(inode->i_mode)) {
-               DDPRINTK("ncp_evict_inode: put directory %ld\n", inode->i_ino);
+               ncp_dbg(2, "put directory %ld\n", inode->i_ino);
        }
 
        if (ncp_make_closed(inode) != 0) {
                /* We can't do anything but complain. */
-               printk(KERN_ERR "ncp_evict_inode: could not close\n");
+               pr_err("%s: could not close\n", __func__);
        }
 }
 
@@ -599,7 +601,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
           now because of PATH_MAX changes.. */
        if (server->m.time_out < 1) {
                server->m.time_out = 10;
-               printk(KERN_INFO "You need to recompile your ncpfs utils..\n");
+               pr_info("You need to recompile your ncpfs utils..\n");
        }
        server->m.time_out = server->m.time_out * HZ / 100;
        server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG;
@@ -660,7 +662,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        ncp_unlock_server(server);
        if (error < 0)
                goto out_rxbuf;
-       DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb));
+       ncp_dbg(1, "NCP_SBP(sb) = %p\n", NCP_SBP(sb));
 
        error = -EMSGSIZE;      /* -EREMOTESIDEINCOMPATIBLE */
 #ifdef CONFIG_NCPFS_PACKET_SIGNING
@@ -688,7 +690,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        if (ncp_negotiate_buffersize(server, default_bufsize,
                                     &(server->buffer_size)) != 0)
                goto out_disconnect;
-       DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size);
+       ncp_dbg(1, "bufsize = %d\n", server->buffer_size);
 
        memset(&finfo, 0, sizeof(finfo));
        finfo.i.attributes      = aDIR;
@@ -717,7 +719,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
         root_inode = ncp_iget(sb, &finfo);
         if (!root_inode)
                goto out_disconnect;
-       DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
+       ncp_dbg(1, "root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
        sb->s_root = d_make_root(root_inode);
         if (!sb->s_root)
                goto out_disconnect;
@@ -958,8 +960,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
        if ((attr->ia_valid & ATTR_SIZE) != 0) {
                int written;
 
-               DPRINTK("ncpfs: trying to change size to %ld\n",
-                       attr->ia_size);
+               ncp_dbg(1, "trying to change size to %llu\n", attr->ia_size);
 
                if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
                        result = -EACCES;
@@ -1045,7 +1046,7 @@ MODULE_ALIAS_FS("ncpfs");
 static int __init init_ncp_fs(void)
 {
        int err;
-       DPRINTK("ncpfs: init_ncp_fs called\n");
+       ncp_dbg(1, "called\n");
 
        err = init_inodecache();
        if (err)
@@ -1062,7 +1063,7 @@ out1:
 
 static void __exit exit_ncp_fs(void)
 {
-       DPRINTK("ncpfs: exit_ncp_fs called\n");
+       ncp_dbg(1, "called\n");
        unregister_filesystem(&ncp_fs_type);
        destroy_inodecache();
 }