ncpfs: Logging cleanups
cover ncpfs: Logging cleanups
Mostly style updating with a couple of fmt/arg mismatch fixes
Joe Perches (5):
ncpfs: Add pr_fmt and convert printks to pr_<level>
ncpfs: Convert DPRINTK/DDPRINTK to ncp_dbg
ncpfs: Convert PPRINTK to ncp_vdbg
ncpfs: Remove now unused PRINTK macro
ncpfs: inode: Fix mismatch printk formats and arguments
fs/ncpfs/dir.c | 65 ++++++++++++++++++++++-------------------------- fs/ncpfs/file.c | 24 ++++++++++-------- fs/ncpfs/getopt.c | 12 +++++---- fs/ncpfs/inode.c | 32 ++++++++++++------------ fs/ncpfs/ioctl.c | 17 ++++++------- fs/ncpfs/mmap.c | 2 +- fs/ncpfs/ncp_fs.h | 30 +++++++++++----------- fs/ncpfs/ncplib_kernel.c | 28 ++++++++++----------- fs/ncpfs/sock.c | 49 ++++++++++++++++++------------------ fs/ncpfs/symlink.c | 2 +- 10 files changed, 130 insertions(+), 131 deletions(-)
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 1/5 ncpfs: Add pr_fmt and convert printks to pr_<level>
Convert to a more current logging style.
Add pr_fmt to prefix with "ncpfs: ".
Remove the embedded function names and use "%s: ", __func__
Some previously unprefixed messages now have "ncpfs: "
--- fs/ncpfs/file.c | 4 +++- fs/ncpfs/getopt.c | 12 +++++++----- fs/ncpfs/inode.c | 10 ++++++---- fs/ncpfs/ncplib_kernel.c | 4 ++-- fs/ncpfs/sock.c | 31 ++++++++++++++++--------------- 5 files changed, 34 insertions(+), 27 deletions(-)
fs/ncpfs/file.c +3 -1
@@ -6,6 +6,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/uaccess.h> #include <linux/time.h>
@@ -34,7 +36,7 @@ int ncp_make_open(struct inode *inode, int right) error = -EINVAL ;if (!inode) { -printk (KERN_ERR "ncp_make_open: got NULL inode\n" ); +pr_err ("%s: got NULL inode\n" , __func__); goto out; }
fs/ncpfs/getopt.c +7 -5
@@ -2,6 +2,8 @@* getopt.c */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/string.h>
@@ -46,8 +48,8 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *optsif (opts->has_arg &OPT_NOPARAM ) {return opts->val; } -printk (KERN_INFO "%s: the %s option requires an argument\n" , - caller, token); +pr_info ("%s: the %s option requires an argument\n" , + caller, token);return -EINVAL ; }if (opts->has_arg &OPT_INT ) {
@@ -57,18 +59,18 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *optsif (!*v) {return opts->val; } -printk (KERN_INFO "%s: invalid numeric value in %s=%s\n" , +pr_info ("%s: invalid numeric value in %s=%s\n" , caller, token, val);return -EDOM ; }if (opts->has_arg &OPT_STRING ) {return opts->val; } -printk (KERN_INFO "%s: unexpected argument %s to the %s option\n" , +pr_info ("%s: unexpected argument %s to the %s option\n" , caller, val, token);return -EINVAL ; } } -printk (KERN_INFO "%s: Unrecognized mount option %s\n" , caller, token); +pr_info ("%s: Unrecognized mount option %s\n" , caller, token);return -EOPNOTSUPP ; }
fs/ncpfs/inode.c +6 -4
@@ -9,6 +9,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <asm/uaccess.h>
@@ -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,7 +291,7 @@ 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; }
@@ -305,7 +307,7 @@ ncp_evict_inode(struct inode *inode)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__); } }
@@ -620,7 +622,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 ;
fs/ncpfs/ncplib_kernel.c +2 -2
@@ -9,7 +9,7 @@* */ - +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include "ncp_fs.h"
@@ -425,7 +425,7 @@ int ncp_obtain_info(struct ncp_server *server, struct inode *dir, const char *paint result;if (target ==NULL ) { -printk (KERN_ERR "ncp_obtain_info: invalid call\n" ); +pr_err ("%s: invalid call\n" , __func__);return -EINVAL ; }ncp_init_request (server);
fs/ncpfs/sock.c +16 -15
@@ -8,6 +8,7 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/time.h> #include <linux/errno.h>
@@ -231,7 +232,7 @@ static void __ncptcp_try_send(struct ncp_server *server)return ;if (result <0 ) { -printk (KERN_ERR "ncpfs: tcp: Send failed: %d\n" , result); +pr_err ("tcp: Send failed: %d\n" , result);__ncp_abort_request (server, rq, result);return ; }
@@ -332,7 +333,7 @@ static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply *mutex_lock (&server->rcv.creq_mutex);if (!ncp_conn_valid (server)) {mutex_unlock (&server->rcv.creq_mutex); -printk (KERN_ERR "ncpfs: tcp: Server died\n" ); +pr_err ("tcp: Server died\n" );return -EIO ; }ncp_req_get (req);
@@ -448,7 +449,7 @@ void ncpdgram_rcv_proc(struct work_struct *work) result -=8 ; hdrl = sock->sk->sk_family ==AF_INET ?8 :6 ;if (sign_verify_reply (server, server->rxbuf + hdrl, result - hdrl,cpu_to_le32 (result), server->rxbuf + result)) { -printk (KERN_INFO "ncpfs: Signature violation\n" ); +pr_info ("Signature violation\n" ); result = -EIO ; } }
@@ -524,7 +525,7 @@ static int do_tcp_rcv(struct ncp_server *server, void *buffer, size_t len)return result; }if (result > len) { -printk (KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %Zu)\n" , result, len); +pr_err ("tcp: bug in recvmsg (%u > %Zu)\n" , result, len);return -EIO ; }return result;
@@ -552,7 +553,7 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)__ncptcp_abort (server); }if (result <0 ) { -printk (KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n" , result); +pr_err ("tcp: error in recvmsg: %d\n" , result); }else {DPRINTK (KERN_ERR "ncpfs: tcp: EOF\n" ); }
@@ -566,20 +567,20 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)switch (server->rcv.state) {case 0 :if (server->rcv.buf.magic !=htonl (NCP_TCP_RCVD_MAGIC )) { -printk (KERN_ERR "ncpfs: tcp: Unexpected reply type %08X\n" ,ntohl (server->rcv.buf.magic)); +pr_err ("tcp: Unexpected reply type %08X\n" ,ntohl (server->rcv.buf.magic));__ncptcp_abort (server);return -EIO ; } datalen =ntohl (server->rcv.buf.len) &0x0FFFFFFF ;if (datalen <10 ) { -printk (KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n" , datalen); +pr_err ("tcp: Unexpected reply len %d\n" , datalen);__ncptcp_abort (server);return -EIO ; }#ifdef CONFIG_NCPFS_PACKET_SIGNING if (server->sign_active) {if (datalen <18 ) { -printk (KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n" , datalen); +pr_err ("tcp: Unexpected reply len %d\n" , datalen);__ncptcp_abort (server);return -EIO ; }
@@ -618,7 +619,7 @@ skipdata:; goto skipdata2; }if (datalen > req->datalen +8 ) { -printk (KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %Zd)\n" , datalen, req->datalen +8 ); +pr_err ("tcp: Unexpected reply len %d (expected at most %Zd)\n" , datalen, req->datalen +8 ); server->rcv.state =3 ; goto skipdata; }
@@ -638,12 +639,12 @@ skipdata:; req = server->rcv.creq;if (req->tx_type !=NCP_ALLOC_SLOT_REQUEST ) {if (((struct ncp_reply_header *)server->rxbuf)->sequence != server->sequence) { -printk (KERN_ERR "ncpfs: tcp: Bad sequence number\n" ); +pr_err ("tcp: Bad sequence number\n" );__ncp_abort_request (server, req, -EIO );return -EIO ; }if ((((struct ncp_reply_header *)server->rxbuf)->conn_low | (((struct ncp_reply_header *)server->rxbuf)->conn_high <<8 )) != server->connection) { -printk (KERN_ERR "ncpfs: tcp: Connection number mismatch\n" ); +pr_err ("tcp: Connection number mismatch\n" );__ncp_abort_request (server, req, -EIO );return -EIO ; }
@@ -651,7 +652,7 @@ skipdata:;#ifdef CONFIG_NCPFS_PACKET_SIGNING if (server->sign_active && req->tx_type !=NCP_DEALLOC_SLOT_REQUEST ) {if (sign_verify_reply (server, server->rxbuf +6 , req->datalen -6 ,cpu_to_be32 (req->datalen +16 ), &server->rcv.buf.type)) { -printk (KERN_ERR "ncpfs: tcp: Signature violation\n" ); +pr_err ("tcp: Signature violation\n" );__ncp_abort_request (server, req, -EIO );return -EIO ; }
@@ -742,7 +743,7 @@ static int ncp_do_request(struct ncp_server *server, int size,int result;if (server->lock ==0 ) { -printk (KERN_ERR "ncpfs: Server not locked!\n" ); +pr_err ("Server not locked!\n" );return -EIO ; }if (!ncp_conn_valid (server)) {
@@ -865,14 +866,14 @@ void ncp_lock_server(struct ncp_server *server) {mutex_lock (&server->mutex);if (server->lock) -printk (KERN_WARNING "ncp_lock_server: was locked!\n" ); +pr_warn ("%s: was locked!\n" , __func__); server->lock =1 ; }void ncp_unlock_server (struct ncp_server *server) {if (!server->lock) { -printk (KERN_WARNING "ncp_unlock_server: was not locked!\n" ); +pr_warn ("%s: was not locked!\n" , __func__);return ; } server->lock =0 ;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 2/5 ncpfs: Convert DPRINTK/DDPRINTK to ncp_dbg
In reply to Joe PerchesUse a more current logging style and enable use of dynamic debugging.
Remove embedded function names, dynamic debug can add this instead.
--- fs/ncpfs/dir.c | 46 +++++++++++++++++++++------------------------- fs/ncpfs/file.c | 16 ++++++++-------- fs/ncpfs/inode.c | 22 ++++++++++------------ fs/ncpfs/ioctl.c | 17 ++++++++--------- fs/ncpfs/mmap.c | 2 +- fs/ncpfs/ncp_fs.h | 18 +++++++++--------- fs/ncpfs/ncplib_kernel.c | 18 ++++++++---------- fs/ncpfs/sock.c | 16 ++++++++-------- fs/ncpfs/symlink.c | 2 +- 9 files changed, 74 insertions(+), 83 deletions(-)
fs/ncpfs/dir.c +21 -25
@@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)if (val) goto finished; -DDPRINTK ("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n" , +ncp_dbg (2 ,"%pd2 not valid, age=%ld, server lookup\n" , dentry,NCP_GET_AGE (dentry)); len =sizeof (__name);
@@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) res =ncp_obtain_info (server, dir, __name, &(finfo.i)); } finfo.volume = finfo.i.volNumber; -DDPRINTK ("ncp_lookup_validate: looked for %pd/%s, res=%d\n" , +ncp_dbg (2 ,"looked for %pd/%s, res=%d\n" , dentry->d_parent, __name, res);/* * If we didn't find it, or if it has a different dirEntNum to
@@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)ncp_new_dentry (dentry); val=1 ; }else -DDPRINTK ("ncp_lookup_validate: found, but dirEntNum changed\n" ); +ncp_dbg (2 ,"found, but dirEntNum changed\n" );ncp_update_inode2 (inode, &finfo);mutex_unlock (&inode->i_mutex); } finished: -DDPRINTK ("ncp_lookup_validate: result=%d\n" , val); +ncp_dbg (2 ,"result=%d\n" , val);dput (parent);return val; }
@@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx) ctl.page =NULL ; ctl.cache =NULL ; -DDPRINTK ("ncp_readdir: reading %pD2, pos=%d\n" , file, - (int ) ctx->pos); +ncp_dbg (2 ,"reading %pD2, pos=%d\n" , file, (int )ctx->pos); result = -EIO ;/* Do not generate '.' and '..' when server is dead. */
@@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,struct ncp_entry_info entry;int i; -DPRINTK ("ncp_read_volume_list: pos=%ld\n" , - (unsigned long ) ctx->pos); +ncp_dbg (1 ,"pos=%ld\n" , (unsigned long )ctx->pos);for (i =0 ; i <NCP_NUMBER_OF_VOLUMES ; i++) {int inval_dentry;
@@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,if (!strlen (info.volume_name))continue ; -DPRINTK ("ncp_read_volume_list: found vol: %s\n" , - info.volume_name); +ncp_dbg (1 ,"found vol: %s\n" , info.volume_name);if (ncp_lookup_volume (server, info.volume_name, &entry.i)) { -DPRINTK ("ncpfs: could not lookup vol %s\n" , +ncp_dbg (1 ,"could not lookup vol %s\n" , info.volume_name);continue ; }
@@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,int more;size_t bufsize; -DPRINTK ("ncp_do_readdir: %pD2, fpos=%ld\n" , file, - (unsigned long ) ctx->pos); +ncp_dbg (1 ,"%pD2, fpos=%ld\n" , file, (unsigned long )ctx->pos);PPRINTK ("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n" , file,NCP_FINFO (dir)->volNumber,NCP_FINFO (dir)->dirEntNum); err =ncp_initialize_search (server, dir, &seq);if (err) { -DPRINTK ("ncp_do_readdir: init failed, err=%d\n" , err); +ncp_dbg (1 ,"init failed, err=%d\n" , err);return ; }/* We MUST NOT use server->buffer_size handshaked with server if we are
@@ -822,10 +818,10 @@ int ncp_conn_logged_in(struct super_block *sb)NCP_FINFO (ino)->DosDirNum = DosDirNum; result =0 ; }else { -DPRINTK ("ncpfs: sb->s_root->d_inode == NULL!\n" ); +ncp_dbg (1 ,"sb->s_root->d_inode == NULL!\n" ); } }else { -DPRINTK ("ncpfs: sb->s_root == NULL!\n" ); +ncp_dbg (1 ,"sb->s_root == NULL!\n" ); } }else result =0 ;
@@ -952,7 +948,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode, error = -ENAMETOOLONG ; else if (result < 0) error = result; -DPRINTK ("ncp_create: %pd2 failed\n" , dentry); +ncp_dbg (1 ,"%pd2 failed\n" , dentry); goto out; } opmode =O_WRONLY ;
@@ -985,7 +981,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)int error, len;__u8 __name[NCP_MAXPATHLEN +1 ]; -DPRINTK ("ncp_mkdir: making %pd2\n" , dentry); +ncp_dbg (1 ,"making %pd2\n" , dentry);ncp_age_dentry (server, dentry); len =sizeof (__name);
@@ -1022,7 +1018,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)int error, result, len;__u8 __name[NCP_MAXPATHLEN +1 ]; -DPRINTK ("ncp_rmdir: removing %pd2\n" , dentry); +ncp_dbg (1 ,"removing %pd2\n" , dentry); len =sizeof (__name); error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
@@ -1067,7 +1063,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)int error; server =NCP_SERVER (dir); -DPRINTK ("ncp_unlink: unlinking %pd2\n" , dentry); +ncp_dbg (1 ,"unlinking %pd2\n" , dentry);/* * Check whether to close the file ...
@@ -1087,7 +1083,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)#endif switch (error) {case 0x00 : -DPRINTK ("ncp: removed %pd2\n" , dentry); +ncp_dbg (1 ,"removed %pd2\n" , dentry);break ;case 0x85 :case 0x8A :
@@ -1120,7 +1116,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,int old_len, new_len;__u8 __old_name[NCP_MAXPATHLEN +1 ], __new_name[NCP_MAXPATHLEN +1 ]; -DPRINTK ("ncp_rename: %pd2 to %pd2\n" , old_dentry, new_dentry); +ncp_dbg (1 ,"%pd2 to %pd2\n" , old_dentry, new_dentry);ncp_age_dentry (server, old_dentry);ncp_age_dentry (server, new_dentry);
@@ -1150,8 +1146,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,#endif switch (error) {case 0x00 : -DPRINTK ("ncp renamed %pd -> %pd.\n" , - old_dentry, new_dentry); +ncp_dbg (1 ,"renamed %pd -> %pd\n" , + old_dentry, new_dentry);break ;case 0x9E : error = -ENAMETOOLONG ;
@@ -1173,7 +1169,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,if (!new_valid_dev (rdev))return -EINVAL ;if (ncp_is_nfs_extras (NCP_SERVER (dir),NCP_FINFO (dir)->volNumber)) { -DPRINTK (KERN_DEBUG "ncp_mknod: mode = 0%ho\n" , mode); +ncp_dbg (1 ,"mode = 0%ho\n" , mode);return ncp_create_new (dir, dentry, mode, rdev,0 ); }return -EPERM ;/* Strange, but true */
fs/ncpfs/file.c +8 -8
@@ -40,7 +40,7 @@ int ncp_make_open(struct inode *inode, int right) goto out; } -DPRINTK ("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n" , +ncp_dbg (1 ,"opened=%d, volume # %u, dir entry # %u\n" ,atomic_read (&NCP_FINFO (inode)->opened),NCP_FINFO (inode)->volNumber,NCP_FINFO (inode)->dirEntNum);
@@ -109,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)void * freepage;size_t freelen; -DPRINTK ("ncp_file_read: enter %pd2\n" , dentry); +ncp_dbg (1 ,"enter %pd2\n" , dentry); pos = *ppos;
@@ -126,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) error =ncp_make_open (inode,O_RDONLY );if (error) { -DPRINTK (KERN_ERR "ncp_file_read: open failed, error=%d\n" , error); +ncp_dbg (1 ,"open failed, error=%d\n" , error);return error; }
@@ -167,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)file_accessed (file); -DPRINTK ("ncp_file_read: exit %pd2\n" , dentry); +ncp_dbg (1 ,"exit %pd2\n" , dentry); outrel:ncp_inode_close (inode);return already_read ? already_read : error;
@@ -184,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *int errno;void * bouncebuffer; -DPRINTK ("ncp_file_write: enter %pd2\n" , dentry); +ncp_dbg (1 ,"enter %pd2\n" , dentry);if ((ssize_t ) count <0 )return -EINVAL ; pos = *ppos;
@@ -213,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *return 0 ; errno =ncp_make_open (inode,O_WRONLY );if (errno) { -DPRINTK (KERN_ERR "ncp_file_write: open failed, error=%d\n" , errno); +ncp_dbg (1 ,"open failed, error=%d\n" , errno);return errno; } bufsize =NCP_SERVER (inode)->buffer_size;
@@ -263,7 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *i_size_write (inode, pos);mutex_unlock (&inode->i_mutex); } -DPRINTK ("ncp_file_write: exit %pd2\n" , dentry); +ncp_dbg (1 ,"exit %pd2\n" , dentry); outrel:ncp_inode_close (inode);return already_written ? already_written : errno;
@@ -271,7 +271,7 @@ outrel:static int ncp_release (struct inode *inode,struct file *file) {if (ncp_make_closed (inode)) { -DPRINTK ("ncp_release: failed to close\n" ); +ncp_dbg (1 ,"failed to close\n" ); }return 0 ; }
fs/ncpfs/inode.c +10 -12
@@ -134,7 +134,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); }
@@ -142,8 +142,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;
@@ -231,7 +230,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;
@@ -302,7 +301,7 @@ ncp_evict_inode(struct inode *inode)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 ) {
@@ -683,7 +682,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) = %x\n" , (int )NCP_SBP (sb)); error = -EMSGSIZE ;/* -EREMOTESIDEINCOMPATIBLE */ #ifdef CONFIG_NCPFS_PACKET_SIGNING
@@ -711,7 +710,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;
@@ -740,7 +739,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;
@@ -986,8 +985,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 %ld\n" , attr->ia_size);if ((result =ncp_make_open (inode,O_WRONLY )) <0 ) { result = -EACCES ;
@@ -1073,7 +1071,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)
@@ -1090,7 +1088,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 (); }
fs/ncpfs/ioctl.c +8 -9
@@ -41,7 +41,7 @@ ncp_get_fs_info(struct ncp_server * server, struct inode *inode,return -EFAULT ;if (info.version !=NCP_GET_FS_INFO_VERSION ) { -DPRINTK ("info.version invalid: %d\n" , info.version); +ncp_dbg (1 ,"info.version invalid: %d\n" , info.version);return -EINVAL ; }/* TODO: info.addr = server->m.serv_addr; */
@@ -66,7 +66,7 @@ ncp_get_fs_info_v2(struct ncp_server * server, struct inode *inode,return -EFAULT ;if (info2.version !=NCP_GET_FS_INFO_VERSION_V2 ) { -DPRINTK ("info.version invalid: %d\n" , info2.version); +ncp_dbg (1 ,"info.version invalid: %d\n" , info2.version);return -EINVAL ; } info2.mounted_uid =from_kuid_munged (current_user_ns (), server->m.mounted_uid);
@@ -132,7 +132,7 @@ ncp_get_compat_fs_info_v2(struct ncp_server * server, struct inode *inode,return -EFAULT ;if (info2.version !=NCP_GET_FS_INFO_VERSION_V2 ) { -DPRINTK ("info.version invalid: %d\n" , info2.version); +ncp_dbg (1 ,"info.version invalid: %d\n" , info2.version);return -EINVAL ; } info2.mounted_uid =from_kuid_munged (current_user_ns (), server->m.mounted_uid);
@@ -308,8 +308,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long argelse result = server->reply_size;ncp_unlock_server (server); -DPRINTK ("ncp_ioctl: copy %d bytes\n" , - result); +ncp_dbg (1 ,"copy %d bytes\n" , result);if (result >=0 )if (copy_to_user (request.data, bouncebuffer, result)) result = -EFAULT ;
@@ -385,9 +384,9 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg sr.namespace = server->name_space[sr.volNumber]; result =0 ; }else -DPRINTK ("ncpfs: s_root->d_inode==NULL\n" ); +ncp_dbg (1 ,"s_root->d_inode==NULL\n" ); }else -DPRINTK ("ncpfs: s_root==NULL\n" ); +ncp_dbg (1 ,"s_root==NULL\n" ); }else { sr.volNumber =-1 ; sr.namespace =0 ;
@@ -440,11 +439,11 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long argNCP_FINFO (s_inode)->DosDirNum = dosde; server->root_setuped =1 ; }else { -DPRINTK ("ncpfs: s_root->d_inode==NULL\n" ); +ncp_dbg (1 ,"s_root->d_inode==NULL\n" ); result = -EIO ; } }else { -DPRINTK ("ncpfs: s_root==NULL\n" ); +ncp_dbg (1 ,"s_root==NULL\n" ); result = -EIO ; } }
fs/ncpfs/mmap.c +1 -1
@@ -107,7 +107,7 @@ int ncp_mmap(struct file *file, struct vm_area_struct *vma) {struct inode *inode =file_inode (file); -DPRINTK ("ncp_mmap: called\n" ); +ncp_dbg (1 ,"called\n" );if (!ncp_conn_valid (NCP_SERVER (inode)))return -EIO ;
fs/ncpfs/ncp_fs.h +9 -9
@@ -15,17 +15,17 @@#ifndef DEBUG_NCP #define DEBUG_NCP 0#endif -#if DEBUG_NCP >0 -#define DPRINTK(format, args...) PRINTK(format , ## args) -#else -#define DPRINTK(format, args...) -#endif -#if DEBUG_NCP >1 -#define DDPRINTK(format, args...) PRINTK(format , ## args) -#else -#define DDPRINTK(format, args...) + +#if DEBUG_NCP >0 && !defined(DEBUG ) +#define DEBUG #endif +#define ncp_dbg (level, fmt, ...) \ +do { \ + if (level >= DEBUG_NCP) \ + pr_debug(fmt, ##__VA_ARGS__); \ +} while (0) +#define NCP_MAX_RPC_TIMEOUT (6*HZ)
fs/ncpfs/ncplib_kernel.c +8 -10
@@ -16,7 +16,7 @@static inline void assert_server_locked (struct ncp_server *server) {if (server->lock ==0 ) { -DPRINTK ("ncpfs: server not locked!\n" ); +ncp_dbg (1 ,"server not locked!\n" ); } }
@@ -75,7 +75,7 @@ static void ncp_add_pstring(struct ncp_server *server, const char *s)int len =strlen (s);assert_server_locked (server);if (len >255 ) { -DPRINTK ("ncpfs: string too long: %s\n" , s); +ncp_dbg (1 ,"string too long: %s\n" , s); len =255 ; }ncp_add_byte (server, len);
@@ -225,7 +225,7 @@ int ncp_get_volume_info_with_number(struct ncp_server* server, result = -EIO ; len =ncp_reply_byte (server,29 );if (len >NCP_VOLNAME_LEN ) { -DPRINTK ("ncpfs: volume name too long: %d\n" , len); +ncp_dbg (1 ,"volume name too long: %d\n" , len); goto out; }memcpy (&(target->volume_name),ncp_reply_data (server,30 ), len);
@@ -259,7 +259,7 @@ int ncp_get_directory_info(struct ncp_server* server, __u8 n, result = -EIO ; len =ncp_reply_byte (server,21 );if (len >NCP_VOLNAME_LEN ) { -DPRINTK ("ncpfs: volume name too long: %d\n" , len); +ncp_dbg (1 ,"volume name too long: %d\n" , len); goto out; }memcpy (&(target->volume_name),ncp_reply_data (server,22 ), len);
@@ -394,8 +394,7 @@ int ncp_obtain_nfs_info(struct ncp_server *server,if ((result =ncp_request (server,87 )) ==0 ) {ncp_extract_nfs_info (ncp_reply_data (server,0 ), &target->nfs); -DPRINTK (KERN_DEBUG -"ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n" , +ncp_dbg (1 ,"(%s) mode=0%o, rdev=0x%x\n" , target->entryName, target->nfs.mode, target->nfs.rdev); }else {
@@ -498,7 +497,7 @@ ncp_get_known_namespace(struct ncp_server *server, __u8 volume) namespace =ncp_reply_data (server,2 );while (no_namespaces >0 ) { -DPRINTK ("get_namespaces: found %d on %d\n" , *namespace, volume); +ncp_dbg (1 ,"found %d on %d\n" , *namespace, volume);#ifdef CONFIG_NCPFS_NFS_NS if ((*namespace ==NW_NS_NFS ) && !(server->m.flags&NCP_MOUNT_NO_NFS ))
@@ -531,8 +530,7 @@ ncp_update_known_namespace(struct ncp_server *server, __u8 volume, int *ret_ns)if (ret_ns) *ret_ns = ns; -DPRINTK ("lookup_vol: namespace[%d] = %d\n" , - volume, server->name_space[volume]); +ncp_dbg (1 ,"namespace[%d] = %d\n" , volume, server->name_space[volume]);if (server->name_space[volume] == ns)return 0 ;
@@ -596,7 +594,7 @@ ncp_get_volume_root(struct ncp_server *server, {int result; -DPRINTK ("ncp_get_volume_root: looking up vol %s\n" , volname); +ncp_dbg (1 ,"looking up vol %s\n" , volname);ncp_init_request (server);ncp_add_byte (server,22 );/* Subfunction: Generate dir handle */
fs/ncpfs/sock.c +8 -8
@@ -406,15 +406,15 @@ void ncpdgram_rcv_proc(struct work_struct *work) } result =_recv (sock, buf,sizeof (buf),MSG_DONTWAIT );if (result <0 ) { -DPRINTK ("recv failed with %d\n" , result); +ncp_dbg (1 ,"recv failed with %d\n" , result);continue ; }if (result <10 ) { -DPRINTK ("too short (%u) watchdog packet\n" , result); +ncp_dbg (1 ,"too short (%u) watchdog packet\n" , result);continue ; }if (buf[9 ] !='?' ) { -DPRINTK ("bad signature (%02X) in watchdog packet\n" , buf[9 ]); +ncp_dbg (1 ,"bad signature (%02X) in watchdog packet\n" , buf[9 ]);continue ; } buf[9 ] ='Y' ;
@@ -555,7 +555,7 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)if (result <0 ) {pr_err ("tcp: error in recvmsg: %d\n" , result); }else { -DPRINTK (KERN_ERR "ncpfs: tcp: EOF\n" ); +ncp_dbg (1 ,"tcp: EOF\n" ); }return -EIO ; }
@@ -605,7 +605,7 @@ cont:; server->rcv.len = datalen -10 ;break ; } -DPRINTK ("ncpfs: tcp: Unexpected NCP type %02X\n" , type); +ncp_dbg (1 ,"tcp: Unexpected NCP type %02X\n" , type); skipdata2:; server->rcv.state =2 ; skipdata:;
@@ -615,7 +615,7 @@ skipdata:; } req = server->rcv.creq;if (!req) { -DPRINTK (KERN_ERR "ncpfs: Reply without appropriate request\n" ); +ncp_dbg (1 ,"Reply without appropriate request\n" ); goto skipdata2; }if (datalen > req->datalen +8 ) {
@@ -782,7 +782,7 @@ static int ncp_do_request(struct ncp_server *server, int size,spin_unlock_irqrestore (¤t->sighand->siglock, flags); } -DDPRINTK ("do_ncp_rpc_call returned %d\n" , result); +ncp_dbg (2 ,"do_ncp_rpc_call returned %d\n" , result);return result; }
@@ -812,7 +812,7 @@ int ncp_request2(struct ncp_server *server, int function, result =ncp_do_request (server, server->current_size, reply, size);if (result <0 ) { -DPRINTK ("ncp_request_error: %d\n" , result); +ncp_dbg (1 ,"ncp_request_error: %d\n" , result); goto out; } server->completion = reply->completion_code;
fs/ncpfs/symlink.c +1 -1
@@ -112,7 +112,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {__le32 attr;unsigned int hdr; -DPRINTK ("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n" ,dir,dentry,symname); +ncp_dbg (1 ,"dir=%p, dentry=%p, symname=%s\n" , dir, dentry, symname);if (ncp_is_nfs_extras (NCP_SERVER (dir),NCP_FINFO (dir)->volNumber)) kludge =0 ;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Re: [PATCH 2/5] ncpfs: Convert DPRINTK/DDPRINTK to ncp_dbg
Quoted 1 line · Joe Perches
Use a more current logging style and enable use of dynamic debugging.
[]
fs/ncpfs/ncp_fs.h
Quoted 1 line
fs/ncpfs/ncp_fs.h +0
-0
[]
fs/ncpfs/ncp_fs.h line 27
Quoted 5 lines
fs/ncpfs/ncp_fs.h +5
-0+#define ncp_dbg (level, fmt, ...) \ +do { \ + if (level >= DEBUG_NCP) \ + pr_debug(fmt, ##__VA_ARGS__); \ +} while (0)
Stupid thinko/typo self-nack. This should be:
if (DEBUG_NCP >= level)
PATCH 3/5 ncpfs: Convert PPRINTK to ncp_vdbg
In reply to Joe PerchesUse a more current logging style.
Convert the paranoia debug statement to vdbg.
Remove the embedded function names as dynamic_debug can do that.
--- fs/ncpfs/dir.c | 19 +++++++++---------- fs/ncpfs/file.c | 4 ++-- fs/ncpfs/ncp_fs.h | 9 +++++++-- fs/ncpfs/ncplib_kernel.c | 6 +++--- fs/ncpfs/sock.c | 2 +- 5 files changed, 22 insertions(+), 18 deletions(-)
fs/ncpfs/dir.c +9 -10
@@ -736,8 +736,8 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,size_t bufsize;ncp_dbg (1 ,"%pD2, fpos=%ld\n" , file, (unsigned long )ctx->pos); -PPRINTK ("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n" , - file,NCP_FINFO (dir)->volNumber,NCP_FINFO (dir)->dirEntNum); +ncp_vdbg ("init %pD, volnum=%d, dirent=%u\n" , + file,NCP_FINFO (dir)->volNumber,NCP_FINFO (dir)->dirEntNum); err =ncp_initialize_search (server, dir, &seq);if (err) {
@@ -804,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb) goto out; result = -ENOENT ;if (ncp_get_volume_root (server, __name, &volNumber, &dirEntNum, &DosDirNum)) { -PPRINTK ("ncp_conn_logged_in: %s not found\n" , - server->m.mounted_vol); +ncp_vdbg ("%s not found\n" , server->m.mounted_vol); goto out; } dent = sb->s_root;
@@ -842,7 +841,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsigif (!ncp_conn_valid (server)) goto finished; -PPRINTK ("ncp_lookup: server lookup for %pd2\n" , dentry); +ncp_vdbg ("server lookup for %pd2\n" , dentry); len =sizeof (__name);if (ncp_is_server_root (dir)) {
@@ -858,7 +857,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsigif (!res) res =ncp_obtain_info (server, dir, __name, &(finfo.i)); } -PPRINTK ("ncp_lookup: looked for %pd2, res=%d\n" , dentry, res); +ncp_vdbg ("looked for %pd2, res=%d\n" , dentry, res);/* * If we didn't find an entry, make a negative dentry. */
@@ -882,7 +881,7 @@ add_entry: } finished: -PPRINTK ("ncp_lookup: result=%d\n" , error); +ncp_vdbg ("result=%d\n" , error);return ERR_PTR (error); }
@@ -905,7 +904,7 @@ out:return error; out_close: -PPRINTK ("ncp_instantiate: %pd2 failed, closing file\n" , dentry); +ncp_vdbg ("%pd2 failed, closing file\n" , dentry);ncp_close_file (NCP_SERVER (dir), finfo->file_handle); goto out; }
@@ -919,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,int opmode;__u8 __name[NCP_MAXPATHLEN +1 ]; -PPRINTK ("ncp_create_new: creating %pd2, mode=%hx\n" , dentry, mode); +ncp_vdbg ("creating %pd2, mode=%hx\n" , dentry, mode);ncp_age_dentry (server, dentry); len =sizeof (__name);
@@ -1069,7 +1068,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)* Check whether to close the file ... */ if (inode) { -PPRINTK ("ncp_unlink: closing file\n" ); +ncp_vdbg ("closing file\n" );ncp_make_closed (inode); }
fs/ncpfs/file.c +2 -2
@@ -73,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)break ; }if (result) { -PPRINTK ("ncp_make_open: failed, result=%d\n" , result); +ncp_vdbg ("failed, result=%d\n" , result); goto out_unlock; }/*
@@ -85,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right) } access =NCP_FINFO (inode)->access; -PPRINTK ("ncp_make_open: file open, access=%x\n" , access); +ncp_vdbg ("file open, access=%x\n" , access);if (access == right || access ==O_RDWR ) {atomic_inc (&NCP_FINFO (inode)->opened); error =0 ;
fs/ncpfs/ncp_fs.h +7 -2
@@ -7,9 +7,14 @@#undef NCPFS_PARANOIA#ifdef NCPFS_PARANOIA -#define PPRINTK(format, args...) PRINTK(format , ## args) +#define ncp_vdbg (fmt, ...) \ + pr_debug(fmt, ##__VA_ARGS__)#else -#define PPRINTK(format, args...) +#define ncp_vdbg (fmt, ...) \ +do { \ + if (0) \ + pr_debug(fmt, ##__VA_ARGS__); \ +} while (0)#endif #ifndef DEBUG_NCP
fs/ncpfs/ncplib_kernel.c +3 -3
@@ -295,9 +295,9 @@ ncp_make_closed(struct inode *inode) err =ncp_close_file (NCP_SERVER (inode),NCP_FINFO (inode)->file_handle);if (!err) -PPRINTK ("ncp_make_closed: volnum=%d, dirent=%u, error=%d\n" , -NCP_FINFO (inode)->volNumber, -NCP_FINFO (inode)->dirEntNum, err); +ncp_vdbg ("volnum=%d, dirent=%u, error=%d\n" , +NCP_FINFO (inode)->volNumber, +NCP_FINFO (inode)->dirEntNum, err); }mutex_unlock (&NCP_FINFO (inode)->open_mutex);return err;
fs/ncpfs/sock.c +1 -1
@@ -823,7 +823,7 @@ int ncp_request2(struct ncp_server *server, int function, result = reply->completion_code;if (result !=0 ) -PPRINTK ("ncp_request: completion code=%x\n" , result); +ncp_vdbg ("completion code=%x\n" , result); out:return result; }
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 4/5 ncpfs: Remove now unused PRINTK macro
In reply to Joe PerchesUses are gone, remove the macro.
--- fs/ncpfs/ncp_fs.h | 3 --- 1 file changed, 3 deletions(-)
fs/ncpfs/ncp_fs.h +0 -3
@@ -2,9 +2,6 @@#include "ncp_fs_i.h" #include "ncp_fs_sb.h" -/* define because it is easy to change PRINTK to {*}PRINTK */ -#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args) -#undef NCPFS_PARANOIA#ifdef NCPFS_PARANOIA #define ncp_vdbg (fmt, ...) \
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 5/5 ncpfs: inode: Fix mismatch printk formats and arguments
In reply to Joe PerchesConversions to ncp_dbg showed some format/argument mismatches so fix them.
--- fs/ncpfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ncpfs/inode.c +2 -2
@@ -682,7 +682,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; -ncp_dbg (1 ,"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
@@ -985,7 +985,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)if ((attr->ia_valid &ATTR_SIZE ) !=0 ) {int written; -ncp_dbg (1 ,"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 ;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty