提交 0f386a70 编写于 作者: L Linus Torvalds

Merge branch 'akpm' (incoming from Andrew)

Merge a few more patches from Andrew Morton:
 "A few leftovers"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  fs/ncpfs/dir.c: fix indenting in ncp_lookup()
  ncpfs/inode.c: fix mismatch printk formats and arguments
  ncpfs: remove now unused PRINTK macro
  ncpfs: convert PPRINTK to ncp_vdbg
  ncpfs: convert DPRINTK/DDPRINTK to ncp_dbg
  ncpfs: Add pr_fmt and convert printks to pr_<level>
  arch/x86/mm/kmemcheck/kmemcheck.c: use kstrtoint() instead of sscanf()
  lib/percpu_counter.c: fix bad percpu counter state during suspend
  autofs4: check dev ioctl size before allocating
  mm: vmscan: do not swap anon pages just because free+file is low
...@@ -78,10 +78,16 @@ early_initcall(kmemcheck_init); ...@@ -78,10 +78,16 @@ early_initcall(kmemcheck_init);
*/ */
static int __init param_kmemcheck(char *str) static int __init param_kmemcheck(char *str)
{ {
int val;
int ret;
if (!str) if (!str)
return -EINVAL; return -EINVAL;
sscanf(str, "%d", &kmemcheck_enabled); ret = kstrtoint(str, 0, &val);
if (ret)
return ret;
kmemcheck_enabled = val;
return 0; return 0;
} }
......
...@@ -103,6 +103,9 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i ...@@ -103,6 +103,9 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
if (tmp.size < sizeof(tmp)) if (tmp.size < sizeof(tmp))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (tmp.size > (PATH_MAX + sizeof(tmp)))
return ERR_PTR(-ENAMETOOLONG);
return memdup_user(in, tmp.size); return memdup_user(in, tmp.size);
} }
......
...@@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) ...@@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
if (val) if (val)
goto finished; 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)); dentry, NCP_GET_AGE(dentry));
len = sizeof(__name); len = sizeof(__name);
...@@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) ...@@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
res = ncp_obtain_info(server, dir, __name, &(finfo.i)); res = ncp_obtain_info(server, dir, __name, &(finfo.i));
} }
finfo.volume = finfo.i.volNumber; 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); dentry->d_parent, __name, res);
/* /*
* If we didn't find it, or if it has a different dirEntNum to * 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) ...@@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
ncp_new_dentry(dentry); ncp_new_dentry(dentry);
val=1; val=1;
} else } else
DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n"); ncp_dbg(2, "found, but dirEntNum changed\n");
ncp_update_inode2(inode, &finfo); ncp_update_inode2(inode, &finfo);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
} }
finished: finished:
DDPRINTK("ncp_lookup_validate: result=%d\n", val); ncp_dbg(2, "result=%d\n", val);
dput(parent); dput(parent);
return val; return val;
} }
...@@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx) ...@@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
ctl.page = NULL; ctl.page = NULL;
ctl.cache = NULL; ctl.cache = NULL;
DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file, ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);
(int) ctx->pos);
result = -EIO; result = -EIO;
/* Do not generate '.' and '..' when server is dead. */ /* Do not generate '.' and '..' when server is dead. */
...@@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx, ...@@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
struct ncp_entry_info entry; struct ncp_entry_info entry;
int i; int i;
DPRINTK("ncp_read_volume_list: pos=%ld\n", ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);
(unsigned long) ctx->pos);
for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) { for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
int inval_dentry; int inval_dentry;
...@@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx, ...@@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
if (!strlen(info.volume_name)) if (!strlen(info.volume_name))
continue; continue;
DPRINTK("ncp_read_volume_list: found vol: %s\n", ncp_dbg(1, "found vol: %s\n", info.volume_name);
info.volume_name);
if (ncp_lookup_volume(server, info.volume_name, if (ncp_lookup_volume(server, info.volume_name,
&entry.i)) { &entry.i)) {
DPRINTK("ncpfs: could not lookup vol %s\n", ncp_dbg(1, "could not lookup vol %s\n",
info.volume_name); info.volume_name);
continue; continue;
} }
...@@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx, ...@@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,
int more; int more;
size_t bufsize; size_t bufsize;
DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file, ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
(unsigned long) ctx->pos); ncp_vdbg("init %pD, volnum=%d, dirent=%u\n",
PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n", file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
err = ncp_initialize_search(server, dir, &seq); err = ncp_initialize_search(server, dir, &seq);
if (err) { if (err) {
DPRINTK("ncp_do_readdir: init failed, err=%d\n", err); ncp_dbg(1, "init failed, err=%d\n", err);
return; return;
} }
/* We MUST NOT use server->buffer_size handshaked with server if we are /* We MUST NOT use server->buffer_size handshaked with server if we are
...@@ -808,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb) ...@@ -808,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb)
goto out; goto out;
result = -ENOENT; result = -ENOENT;
if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) { if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) {
PPRINTK("ncp_conn_logged_in: %s not found\n", ncp_vdbg("%s not found\n", server->m.mounted_vol);
server->m.mounted_vol);
goto out; goto out;
} }
dent = sb->s_root; dent = sb->s_root;
...@@ -822,10 +817,10 @@ int ncp_conn_logged_in(struct super_block *sb) ...@@ -822,10 +817,10 @@ int ncp_conn_logged_in(struct super_block *sb)
NCP_FINFO(ino)->DosDirNum = DosDirNum; NCP_FINFO(ino)->DosDirNum = DosDirNum;
result = 0; result = 0;
} else { } else {
DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n"); ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
} }
} else { } else {
DPRINTK("ncpfs: sb->s_root == NULL!\n"); ncp_dbg(1, "sb->s_root == NULL!\n");
} }
} else } else
result = 0; result = 0;
...@@ -846,7 +841,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig ...@@ -846,7 +841,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
if (!ncp_conn_valid(server)) if (!ncp_conn_valid(server))
goto finished; goto finished;
PPRINTK("ncp_lookup: server lookup for %pd2\n", dentry); ncp_vdbg("server lookup for %pd2\n", dentry);
len = sizeof(__name); len = sizeof(__name);
if (ncp_is_server_root(dir)) { if (ncp_is_server_root(dir)) {
...@@ -854,15 +849,15 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig ...@@ -854,15 +849,15 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
dentry->d_name.len, 1); dentry->d_name.len, 1);
if (!res) if (!res)
res = ncp_lookup_volume(server, __name, &(finfo.i)); res = ncp_lookup_volume(server, __name, &(finfo.i));
if (!res) if (!res)
ncp_update_known_namespace(server, finfo.i.volNumber, NULL); ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
} else { } else {
res = ncp_io2vol(server, __name, &len, dentry->d_name.name, res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
dentry->d_name.len, !ncp_preserve_case(dir)); dentry->d_name.len, !ncp_preserve_case(dir));
if (!res) if (!res)
res = ncp_obtain_info(server, dir, __name, &(finfo.i)); 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. * If we didn't find an entry, make a negative dentry.
*/ */
...@@ -886,7 +881,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig ...@@ -886,7 +881,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
} }
finished: finished:
PPRINTK("ncp_lookup: result=%d\n", error); ncp_vdbg("result=%d\n", error);
return ERR_PTR(error); return ERR_PTR(error);
} }
...@@ -909,7 +904,7 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry, ...@@ -909,7 +904,7 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry,
return error; return error;
out_close: 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); ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
goto out; goto out;
} }
...@@ -923,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode, ...@@ -923,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
int opmode; int opmode;
__u8 __name[NCP_MAXPATHLEN + 1]; __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); ncp_age_dentry(server, dentry);
len = sizeof(__name); len = sizeof(__name);
...@@ -952,7 +947,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode, ...@@ -952,7 +947,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
error = -ENAMETOOLONG; error = -ENAMETOOLONG;
else if (result < 0) else if (result < 0)
error = result; error = result;
DPRINTK("ncp_create: %pd2 failed\n", dentry); ncp_dbg(1, "%pd2 failed\n", dentry);
goto out; goto out;
} }
opmode = O_WRONLY; opmode = O_WRONLY;
...@@ -985,7 +980,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ...@@ -985,7 +980,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
int error, len; int error, len;
__u8 __name[NCP_MAXPATHLEN + 1]; __u8 __name[NCP_MAXPATHLEN + 1];
DPRINTK("ncp_mkdir: making %pd2\n", dentry); ncp_dbg(1, "making %pd2\n", dentry);
ncp_age_dentry(server, dentry); ncp_age_dentry(server, dentry);
len = sizeof(__name); len = sizeof(__name);
...@@ -1022,7 +1017,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -1022,7 +1017,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
int error, result, len; int error, result, len;
__u8 __name[NCP_MAXPATHLEN + 1]; __u8 __name[NCP_MAXPATHLEN + 1];
DPRINTK("ncp_rmdir: removing %pd2\n", dentry); ncp_dbg(1, "removing %pd2\n", dentry);
len = sizeof(__name); len = sizeof(__name);
error = ncp_io2vol(server, __name, &len, dentry->d_name.name, error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
...@@ -1067,13 +1062,13 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1067,13 +1062,13 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
int error; int error;
server = NCP_SERVER(dir); server = NCP_SERVER(dir);
DPRINTK("ncp_unlink: unlinking %pd2\n", dentry); ncp_dbg(1, "unlinking %pd2\n", dentry);
/* /*
* Check whether to close the file ... * Check whether to close the file ...
*/ */
if (inode) { if (inode) {
PPRINTK("ncp_unlink: closing file\n"); ncp_vdbg("closing file\n");
ncp_make_closed(inode); ncp_make_closed(inode);
} }
...@@ -1087,7 +1082,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1087,7 +1082,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
#endif #endif
switch (error) { switch (error) {
case 0x00: case 0x00:
DPRINTK("ncp: removed %pd2\n", dentry); ncp_dbg(1, "removed %pd2\n", dentry);
break; break;
case 0x85: case 0x85:
case 0x8A: case 0x8A:
...@@ -1120,7 +1115,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1120,7 +1115,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
int old_len, new_len; int old_len, new_len;
__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; __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, old_dentry);
ncp_age_dentry(server, new_dentry); ncp_age_dentry(server, new_dentry);
...@@ -1150,8 +1145,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1150,8 +1145,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
#endif #endif
switch (error) { switch (error) {
case 0x00: case 0x00:
DPRINTK("ncp renamed %pd -> %pd.\n", ncp_dbg(1, "renamed %pd -> %pd\n",
old_dentry, new_dentry); old_dentry, new_dentry);
break; break;
case 0x9E: case 0x9E:
error = -ENAMETOOLONG; error = -ENAMETOOLONG;
...@@ -1173,7 +1168,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry, ...@@ -1173,7 +1168,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,
if (!new_valid_dev(rdev)) if (!new_valid_dev(rdev))
return -EINVAL; return -EINVAL;
if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { 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 ncp_create_new(dir, dentry, mode, rdev, 0);
} }
return -EPERM; /* Strange, but true */ return -EPERM; /* Strange, but true */
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/time.h> #include <linux/time.h>
...@@ -34,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right) ...@@ -34,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right)
error = -EINVAL; error = -EINVAL;
if (!inode) { if (!inode) {
printk(KERN_ERR "ncp_make_open: got NULL inode\n"); pr_err("%s: got NULL inode\n", __func__);
goto out; 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), atomic_read(&NCP_FINFO(inode)->opened),
NCP_FINFO(inode)->volNumber, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum); NCP_FINFO(inode)->dirEntNum);
...@@ -71,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right) ...@@ -71,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)
break; break;
} }
if (result) { if (result) {
PPRINTK("ncp_make_open: failed, result=%d\n", result); ncp_vdbg("failed, result=%d\n", result);
goto out_unlock; goto out_unlock;
} }
/* /*
...@@ -83,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right) ...@@ -83,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right)
} }
access = NCP_FINFO(inode)->access; 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) { if (access == right || access == O_RDWR) {
atomic_inc(&NCP_FINFO(inode)->opened); atomic_inc(&NCP_FINFO(inode)->opened);
error = 0; error = 0;
...@@ -107,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) ...@@ -107,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
void* freepage; void* freepage;
size_t freelen; size_t freelen;
DPRINTK("ncp_file_read: enter %pd2\n", dentry); ncp_dbg(1, "enter %pd2\n", dentry);
pos = *ppos; pos = *ppos;
...@@ -124,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) ...@@ -124,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); error = ncp_make_open(inode, O_RDONLY);
if (error) { 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; return error;
} }
...@@ -165,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) ...@@ -165,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
file_accessed(file); file_accessed(file);
DPRINTK("ncp_file_read: exit %pd2\n", dentry); ncp_dbg(1, "exit %pd2\n", dentry);
outrel: outrel:
ncp_inode_close(inode); ncp_inode_close(inode);
return already_read ? already_read : error; return already_read ? already_read : error;
...@@ -182,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * ...@@ -182,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
int errno; int errno;
void* bouncebuffer; void* bouncebuffer;
DPRINTK("ncp_file_write: enter %pd2\n", dentry); ncp_dbg(1, "enter %pd2\n", dentry);
if ((ssize_t) count < 0) if ((ssize_t) count < 0)
return -EINVAL; return -EINVAL;
pos = *ppos; pos = *ppos;
...@@ -211,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * ...@@ -211,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
return 0; return 0;
errno = ncp_make_open(inode, O_WRONLY); errno = ncp_make_open(inode, O_WRONLY);
if (errno) { 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; return errno;
} }
bufsize = NCP_SERVER(inode)->buffer_size; bufsize = NCP_SERVER(inode)->buffer_size;
...@@ -261,7 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * ...@@ -261,7 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
i_size_write(inode, pos); i_size_write(inode, pos);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
} }
DPRINTK("ncp_file_write: exit %pd2\n", dentry); ncp_dbg(1, "exit %pd2\n", dentry);
outrel: outrel:
ncp_inode_close(inode); ncp_inode_close(inode);
return already_written ? already_written : errno; return already_written ? already_written : errno;
...@@ -269,7 +271,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * ...@@ -269,7 +271,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
static int ncp_release(struct inode *inode, struct file *file) { static int ncp_release(struct inode *inode, struct file *file) {
if (ncp_make_closed(inode)) { if (ncp_make_closed(inode)) {
DPRINTK("ncp_release: failed to close\n"); ncp_dbg(1, "failed to close\n");
} }
return 0; return 0;
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
* getopt.c * getopt.c
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -46,8 +48,8 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts ...@@ -46,8 +48,8 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
if (opts->has_arg & OPT_NOPARAM) { if (opts->has_arg & OPT_NOPARAM) {
return opts->val; return opts->val;
} }
printk(KERN_INFO "%s: the %s option requires an argument\n", pr_info("%s: the %s option requires an argument\n",
caller, token); caller, token);
return -EINVAL; return -EINVAL;
} }
if (opts->has_arg & OPT_INT) { if (opts->has_arg & OPT_INT) {
...@@ -57,18 +59,18 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts ...@@ -57,18 +59,18 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
if (!*v) { if (!*v) {
return opts->val; 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); caller, token, val);
return -EDOM; return -EDOM;
} }
if (opts->has_arg & OPT_STRING) { if (opts->has_arg & OPT_STRING) {
return opts->val; 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); caller, val, token);
return -EINVAL; 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; return -EOPNOTSUPP;
} }
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -133,7 +135,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo) ...@@ -133,7 +135,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
NCP_FINFO(inode)->access = nwinfo->access; NCP_FINFO(inode)->access = nwinfo->access;
memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle, memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
sizeof(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, nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum); NCP_FINFO(inode)->dirEntNum);
} }
...@@ -141,8 +143,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo) ...@@ -141,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) static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
{ {
/* NFS namespace mode overrides others if it's set. */ /* NFS namespace mode overrides others if it's set. */
DPRINTK(KERN_DEBUG "ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n", ncp_dbg(1, "(%s) nfs.mode=0%o\n", nwi->entryName, nwi->nfs.mode);
nwi->entryName, nwi->nfs.mode);
if (nwi->nfs.mode) { if (nwi->nfs.mode) {
/* XXX Security? */ /* XXX Security? */
inode->i_mode = nwi->nfs.mode; inode->i_mode = nwi->nfs.mode;
...@@ -230,7 +231,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo) ...@@ -230,7 +231,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
ncp_update_attrs(inode, 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); set_nlink(inode, 1);
inode->i_uid = server->m.uid; inode->i_uid = server->m.uid;
...@@ -258,7 +259,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info) ...@@ -258,7 +259,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
struct inode *inode; struct inode *inode;
if (info == NULL) { if (info == NULL) {
printk(KERN_ERR "ncp_iget: info is NULL\n"); pr_err("%s: info is NULL\n", __func__);
return NULL; return NULL;
} }
...@@ -290,7 +291,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info) ...@@ -290,7 +291,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
} }
insert_inode_hash(inode); insert_inode_hash(inode);
} else } else
printk(KERN_ERR "ncp_iget: iget failed!\n"); pr_err("%s: iget failed!\n", __func__);
return inode; return inode;
} }
...@@ -301,12 +302,12 @@ ncp_evict_inode(struct inode *inode) ...@@ -301,12 +302,12 @@ ncp_evict_inode(struct inode *inode)
clear_inode(inode); clear_inode(inode);
if (S_ISDIR(inode->i_mode)) { 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) { if (ncp_make_closed(inode) != 0) {
/* We can't do anything but complain. */ /* 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__);
} }
} }
...@@ -621,7 +622,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -621,7 +622,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
now because of PATH_MAX changes.. */ now because of PATH_MAX changes.. */
if (server->m.time_out < 1) { if (server->m.time_out < 1) {
server->m.time_out = 10; 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.time_out = server->m.time_out * HZ / 100;
server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG; server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG;
...@@ -682,7 +683,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -682,7 +683,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
ncp_unlock_server(server); ncp_unlock_server(server);
if (error < 0) if (error < 0)
goto out_rxbuf; 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 */ error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
#ifdef CONFIG_NCPFS_PACKET_SIGNING #ifdef CONFIG_NCPFS_PACKET_SIGNING
...@@ -710,7 +711,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -710,7 +711,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
if (ncp_negotiate_buffersize(server, default_bufsize, if (ncp_negotiate_buffersize(server, default_bufsize,
&(server->buffer_size)) != 0) &(server->buffer_size)) != 0)
goto out_disconnect; 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)); memset(&finfo, 0, sizeof(finfo));
finfo.i.attributes = aDIR; finfo.i.attributes = aDIR;
...@@ -739,7 +740,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -739,7 +740,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
root_inode = ncp_iget(sb, &finfo); root_inode = ncp_iget(sb, &finfo);
if (!root_inode) if (!root_inode)
goto out_disconnect; 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); sb->s_root = d_make_root(root_inode);
if (!sb->s_root) if (!sb->s_root)
goto out_disconnect; goto out_disconnect;
...@@ -985,8 +986,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -985,8 +986,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
if ((attr->ia_valid & ATTR_SIZE) != 0) { if ((attr->ia_valid & ATTR_SIZE) != 0) {
int written; int written;
DPRINTK("ncpfs: trying to change size to %ld\n", ncp_dbg(1, "trying to change size to %llu\n", attr->ia_size);
attr->ia_size);
if ((result = ncp_make_open(inode, O_WRONLY)) < 0) { if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
result = -EACCES; result = -EACCES;
...@@ -1072,7 +1072,7 @@ MODULE_ALIAS_FS("ncpfs"); ...@@ -1072,7 +1072,7 @@ MODULE_ALIAS_FS("ncpfs");
static int __init init_ncp_fs(void) static int __init init_ncp_fs(void)
{ {
int err; int err;
DPRINTK("ncpfs: init_ncp_fs called\n"); ncp_dbg(1, "called\n");
err = init_inodecache(); err = init_inodecache();
if (err) if (err)
...@@ -1089,7 +1089,7 @@ static int __init init_ncp_fs(void) ...@@ -1089,7 +1089,7 @@ static int __init init_ncp_fs(void)
static void __exit exit_ncp_fs(void) static void __exit exit_ncp_fs(void)
{ {
DPRINTK("ncpfs: exit_ncp_fs called\n"); ncp_dbg(1, "called\n");
unregister_filesystem(&ncp_fs_type); unregister_filesystem(&ncp_fs_type);
destroy_inodecache(); destroy_inodecache();
} }
......
...@@ -41,7 +41,7 @@ ncp_get_fs_info(struct ncp_server * server, struct inode *inode, ...@@ -41,7 +41,7 @@ ncp_get_fs_info(struct ncp_server * server, struct inode *inode,
return -EFAULT; return -EFAULT;
if (info.version != NCP_GET_FS_INFO_VERSION) { 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; return -EINVAL;
} }
/* TODO: info.addr = server->m.serv_addr; */ /* TODO: info.addr = server->m.serv_addr; */
...@@ -66,7 +66,7 @@ ncp_get_fs_info_v2(struct ncp_server * server, struct inode *inode, ...@@ -66,7 +66,7 @@ ncp_get_fs_info_v2(struct ncp_server * server, struct inode *inode,
return -EFAULT; return -EFAULT;
if (info2.version != NCP_GET_FS_INFO_VERSION_V2) { 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; return -EINVAL;
} }
info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid); 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, ...@@ -132,7 +132,7 @@ ncp_get_compat_fs_info_v2(struct ncp_server * server, struct inode *inode,
return -EFAULT; return -EFAULT;
if (info2.version != NCP_GET_FS_INFO_VERSION_V2) { 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; return -EINVAL;
} }
info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid); 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 arg ...@@ -308,8 +308,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
else else
result = server->reply_size; result = server->reply_size;
ncp_unlock_server(server); ncp_unlock_server(server);
DPRINTK("ncp_ioctl: copy %d bytes\n", ncp_dbg(1, "copy %d bytes\n", result);
result);
if (result >= 0) if (result >= 0)
if (copy_to_user(request.data, bouncebuffer, result)) if (copy_to_user(request.data, bouncebuffer, result))
result = -EFAULT; result = -EFAULT;
...@@ -385,9 +384,9 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg ...@@ -385,9 +384,9 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
sr.namespace = server->name_space[sr.volNumber]; sr.namespace = server->name_space[sr.volNumber];
result = 0; result = 0;
} else } else
DPRINTK("ncpfs: s_root->d_inode==NULL\n"); ncp_dbg(1, "s_root->d_inode==NULL\n");
} else } else
DPRINTK("ncpfs: s_root==NULL\n"); ncp_dbg(1, "s_root==NULL\n");
} else { } else {
sr.volNumber = -1; sr.volNumber = -1;
sr.namespace = 0; sr.namespace = 0;
...@@ -440,11 +439,11 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg ...@@ -440,11 +439,11 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
NCP_FINFO(s_inode)->DosDirNum = dosde; NCP_FINFO(s_inode)->DosDirNum = dosde;
server->root_setuped = 1; server->root_setuped = 1;
} else { } else {
DPRINTK("ncpfs: s_root->d_inode==NULL\n"); ncp_dbg(1, "s_root->d_inode==NULL\n");
result = -EIO; result = -EIO;
} }
} else { } else {
DPRINTK("ncpfs: s_root==NULL\n"); ncp_dbg(1, "s_root==NULL\n");
result = -EIO; result = -EIO;
} }
} }
......
...@@ -107,7 +107,7 @@ int ncp_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -107,7 +107,7 @@ int ncp_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
DPRINTK("ncp_mmap: called\n"); ncp_dbg(1, "called\n");
if (!ncp_conn_valid(NCP_SERVER(inode))) if (!ncp_conn_valid(NCP_SERVER(inode)))
return -EIO; return -EIO;
......
...@@ -2,30 +2,32 @@ ...@@ -2,30 +2,32 @@
#include "ncp_fs_i.h" #include "ncp_fs_i.h"
#include "ncp_fs_sb.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 #undef NCPFS_PARANOIA
#ifdef NCPFS_PARANOIA #ifdef NCPFS_PARANOIA
#define PPRINTK(format, args...) PRINTK(format , ## args) #define ncp_vdbg(fmt, ...) \
pr_debug(fmt, ##__VA_ARGS__)
#else #else
#define PPRINTK(format, args...) #define ncp_vdbg(fmt, ...) \
do { \
if (0) \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)
#endif #endif
#ifndef DEBUG_NCP #ifndef DEBUG_NCP
#define DEBUG_NCP 0 #define DEBUG_NCP 0
#endif #endif
#if DEBUG_NCP > 0
#define DPRINTK(format, args...) PRINTK(format , ## args) #if DEBUG_NCP > 0 && !defined(DEBUG)
#else #define DEBUG
#define DPRINTK(format, args...)
#endif
#if DEBUG_NCP > 1
#define DDPRINTK(format, args...) PRINTK(format , ## args)
#else
#define DDPRINTK(format, args...)
#endif #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) #define NCP_MAX_RPC_TIMEOUT (6*HZ)
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "ncp_fs.h" #include "ncp_fs.h"
static inline void assert_server_locked(struct ncp_server *server) static inline void assert_server_locked(struct ncp_server *server)
{ {
if (server->lock == 0) { 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) ...@@ -75,7 +75,7 @@ static void ncp_add_pstring(struct ncp_server *server, const char *s)
int len = strlen(s); int len = strlen(s);
assert_server_locked(server); assert_server_locked(server);
if (len > 255) { if (len > 255) {
DPRINTK("ncpfs: string too long: %s\n", s); ncp_dbg(1, "string too long: %s\n", s);
len = 255; len = 255;
} }
ncp_add_byte(server, len); ncp_add_byte(server, len);
...@@ -225,7 +225,7 @@ int ncp_get_volume_info_with_number(struct ncp_server* server, ...@@ -225,7 +225,7 @@ int ncp_get_volume_info_with_number(struct ncp_server* server,
result = -EIO; result = -EIO;
len = ncp_reply_byte(server, 29); len = ncp_reply_byte(server, 29);
if (len > NCP_VOLNAME_LEN) { 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; goto out;
} }
memcpy(&(target->volume_name), ncp_reply_data(server, 30), len); 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, ...@@ -259,7 +259,7 @@ int ncp_get_directory_info(struct ncp_server* server, __u8 n,
result = -EIO; result = -EIO;
len = ncp_reply_byte(server, 21); len = ncp_reply_byte(server, 21);
if (len > NCP_VOLNAME_LEN) { 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; goto out;
} }
memcpy(&(target->volume_name), ncp_reply_data(server, 22), len); memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
...@@ -295,9 +295,9 @@ ncp_make_closed(struct inode *inode) ...@@ -295,9 +295,9 @@ ncp_make_closed(struct inode *inode)
err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle); err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle);
if (!err) if (!err)
PPRINTK("ncp_make_closed: volnum=%d, dirent=%u, error=%d\n", ncp_vdbg("volnum=%d, dirent=%u, error=%d\n",
NCP_FINFO(inode)->volNumber, NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum, err); NCP_FINFO(inode)->dirEntNum, err);
} }
mutex_unlock(&NCP_FINFO(inode)->open_mutex); mutex_unlock(&NCP_FINFO(inode)->open_mutex);
return err; return err;
...@@ -394,8 +394,7 @@ int ncp_obtain_nfs_info(struct ncp_server *server, ...@@ -394,8 +394,7 @@ int ncp_obtain_nfs_info(struct ncp_server *server,
if ((result = ncp_request(server, 87)) == 0) { if ((result = ncp_request(server, 87)) == 0) {
ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs); ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs);
DPRINTK(KERN_DEBUG ncp_dbg(1, "(%s) mode=0%o, rdev=0x%x\n",
"ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n",
target->entryName, target->nfs.mode, target->entryName, target->nfs.mode,
target->nfs.rdev); target->nfs.rdev);
} else { } else {
...@@ -425,7 +424,7 @@ int ncp_obtain_info(struct ncp_server *server, struct inode *dir, const char *pa ...@@ -425,7 +424,7 @@ int ncp_obtain_info(struct ncp_server *server, struct inode *dir, const char *pa
int result; int result;
if (target == NULL) { if (target == NULL) {
printk(KERN_ERR "ncp_obtain_info: invalid call\n"); pr_err("%s: invalid call\n", __func__);
return -EINVAL; return -EINVAL;
} }
ncp_init_request(server); ncp_init_request(server);
...@@ -498,7 +497,7 @@ ncp_get_known_namespace(struct ncp_server *server, __u8 volume) ...@@ -498,7 +497,7 @@ ncp_get_known_namespace(struct ncp_server *server, __u8 volume)
namespace = ncp_reply_data(server, 2); namespace = ncp_reply_data(server, 2);
while (no_namespaces > 0) { 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 #ifdef CONFIG_NCPFS_NFS_NS
if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS)) 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) ...@@ -531,8 +530,7 @@ ncp_update_known_namespace(struct ncp_server *server, __u8 volume, int *ret_ns)
if (ret_ns) if (ret_ns)
*ret_ns = ns; *ret_ns = ns;
DPRINTK("lookup_vol: namespace[%d] = %d\n", ncp_dbg(1, "namespace[%d] = %d\n", volume, server->name_space[volume]);
volume, server->name_space[volume]);
if (server->name_space[volume] == ns) if (server->name_space[volume] == ns)
return 0; return 0;
...@@ -596,7 +594,7 @@ ncp_get_volume_root(struct ncp_server *server, ...@@ -596,7 +594,7 @@ ncp_get_volume_root(struct ncp_server *server,
{ {
int result; 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_init_request(server);
ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */ ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/time.h> #include <linux/time.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -231,7 +232,7 @@ static void __ncptcp_try_send(struct ncp_server *server) ...@@ -231,7 +232,7 @@ static void __ncptcp_try_send(struct ncp_server *server)
return; return;
if (result < 0) { 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); __ncp_abort_request(server, rq, result);
return; return;
} }
...@@ -332,7 +333,7 @@ static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply * ...@@ -332,7 +333,7 @@ static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply *
mutex_lock(&server->rcv.creq_mutex); mutex_lock(&server->rcv.creq_mutex);
if (!ncp_conn_valid(server)) { if (!ncp_conn_valid(server)) {
mutex_unlock(&server->rcv.creq_mutex); mutex_unlock(&server->rcv.creq_mutex);
printk(KERN_ERR "ncpfs: tcp: Server died\n"); pr_err("tcp: Server died\n");
return -EIO; return -EIO;
} }
ncp_req_get(req); ncp_req_get(req);
...@@ -405,15 +406,15 @@ void ncpdgram_rcv_proc(struct work_struct *work) ...@@ -405,15 +406,15 @@ void ncpdgram_rcv_proc(struct work_struct *work)
} }
result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT); result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT);
if (result < 0) { if (result < 0) {
DPRINTK("recv failed with %d\n", result); ncp_dbg(1, "recv failed with %d\n", result);
continue; continue;
} }
if (result < 10) { if (result < 10) {
DPRINTK("too short (%u) watchdog packet\n", result); ncp_dbg(1, "too short (%u) watchdog packet\n", result);
continue; continue;
} }
if (buf[9] != '?') { 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; continue;
} }
buf[9] = 'Y'; buf[9] = 'Y';
...@@ -448,7 +449,7 @@ void ncpdgram_rcv_proc(struct work_struct *work) ...@@ -448,7 +449,7 @@ void ncpdgram_rcv_proc(struct work_struct *work)
result -= 8; result -= 8;
hdrl = sock->sk->sk_family == AF_INET ? 8 : 6; 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)) { 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; result = -EIO;
} }
} }
...@@ -524,7 +525,7 @@ static int do_tcp_rcv(struct ncp_server *server, void *buffer, size_t len) ...@@ -524,7 +525,7 @@ static int do_tcp_rcv(struct ncp_server *server, void *buffer, size_t len)
return result; return result;
} }
if (result > len) { 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 -EIO;
} }
return result; return result;
...@@ -552,9 +553,9 @@ static int __ncptcp_rcv_proc(struct ncp_server *server) ...@@ -552,9 +553,9 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)
__ncptcp_abort(server); __ncptcp_abort(server);
} }
if (result < 0) { if (result < 0) {
printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result); pr_err("tcp: error in recvmsg: %d\n", result);
} else { } else {
DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n"); ncp_dbg(1, "tcp: EOF\n");
} }
return -EIO; return -EIO;
} }
...@@ -566,20 +567,20 @@ static int __ncptcp_rcv_proc(struct ncp_server *server) ...@@ -566,20 +567,20 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)
switch (server->rcv.state) { switch (server->rcv.state) {
case 0: case 0:
if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) { 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); __ncptcp_abort(server);
return -EIO; return -EIO;
} }
datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF; datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF;
if (datalen < 10) { 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); __ncptcp_abort(server);
return -EIO; return -EIO;
} }
#ifdef CONFIG_NCPFS_PACKET_SIGNING #ifdef CONFIG_NCPFS_PACKET_SIGNING
if (server->sign_active) { if (server->sign_active) {
if (datalen < 18) { 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); __ncptcp_abort(server);
return -EIO; return -EIO;
} }
...@@ -604,7 +605,7 @@ cont:; ...@@ -604,7 +605,7 @@ cont:;
server->rcv.len = datalen - 10; server->rcv.len = datalen - 10;
break; break;
} }
DPRINTK("ncpfs: tcp: Unexpected NCP type %02X\n", type); ncp_dbg(1, "tcp: Unexpected NCP type %02X\n", type);
skipdata2:; skipdata2:;
server->rcv.state = 2; server->rcv.state = 2;
skipdata:; skipdata:;
...@@ -614,11 +615,11 @@ skipdata:; ...@@ -614,11 +615,11 @@ skipdata:;
} }
req = server->rcv.creq; req = server->rcv.creq;
if (!req) { if (!req) {
DPRINTK(KERN_ERR "ncpfs: Reply without appropriate request\n"); ncp_dbg(1, "Reply without appropriate request\n");
goto skipdata2; goto skipdata2;
} }
if (datalen > req->datalen + 8) { 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; server->rcv.state = 3;
goto skipdata; goto skipdata;
} }
...@@ -638,12 +639,12 @@ skipdata:; ...@@ -638,12 +639,12 @@ skipdata:;
req = server->rcv.creq; req = server->rcv.creq;
if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) { if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) {
if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) { 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); __ncp_abort_request(server, req, -EIO);
return -EIO; return -EIO;
} }
if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) { 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); __ncp_abort_request(server, req, -EIO);
return -EIO; return -EIO;
} }
...@@ -651,7 +652,7 @@ skipdata:; ...@@ -651,7 +652,7 @@ skipdata:;
#ifdef CONFIG_NCPFS_PACKET_SIGNING #ifdef CONFIG_NCPFS_PACKET_SIGNING
if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) { 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)) { 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); __ncp_abort_request(server, req, -EIO);
return -EIO; return -EIO;
} }
...@@ -742,7 +743,7 @@ static int ncp_do_request(struct ncp_server *server, int size, ...@@ -742,7 +743,7 @@ static int ncp_do_request(struct ncp_server *server, int size,
int result; int result;
if (server->lock == 0) { if (server->lock == 0) {
printk(KERN_ERR "ncpfs: Server not locked!\n"); pr_err("Server not locked!\n");
return -EIO; return -EIO;
} }
if (!ncp_conn_valid(server)) { if (!ncp_conn_valid(server)) {
...@@ -781,7 +782,7 @@ static int ncp_do_request(struct ncp_server *server, int size, ...@@ -781,7 +782,7 @@ static int ncp_do_request(struct ncp_server *server, int size,
spin_unlock_irqrestore(&current->sighand->siglock, flags); spin_unlock_irqrestore(&current->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; return result;
} }
...@@ -811,7 +812,7 @@ int ncp_request2(struct ncp_server *server, int function, ...@@ -811,7 +812,7 @@ int ncp_request2(struct ncp_server *server, int function,
result = ncp_do_request(server, server->current_size, reply, size); result = ncp_do_request(server, server->current_size, reply, size);
if (result < 0) { if (result < 0) {
DPRINTK("ncp_request_error: %d\n", result); ncp_dbg(1, "ncp_request_error: %d\n", result);
goto out; goto out;
} }
server->completion = reply->completion_code; server->completion = reply->completion_code;
...@@ -822,7 +823,7 @@ int ncp_request2(struct ncp_server *server, int function, ...@@ -822,7 +823,7 @@ int ncp_request2(struct ncp_server *server, int function,
result = reply->completion_code; result = reply->completion_code;
if (result != 0) if (result != 0)
PPRINTK("ncp_request: completion code=%x\n", result); ncp_vdbg("completion code=%x\n", result);
out: out:
return result; return result;
} }
...@@ -865,14 +866,14 @@ void ncp_lock_server(struct ncp_server *server) ...@@ -865,14 +866,14 @@ void ncp_lock_server(struct ncp_server *server)
{ {
mutex_lock(&server->mutex); mutex_lock(&server->mutex);
if (server->lock) if (server->lock)
printk(KERN_WARNING "ncp_lock_server: was locked!\n"); pr_warn("%s: was locked!\n", __func__);
server->lock = 1; server->lock = 1;
} }
void ncp_unlock_server(struct ncp_server *server) void ncp_unlock_server(struct ncp_server *server)
{ {
if (!server->lock) { if (!server->lock) {
printk(KERN_WARNING "ncp_unlock_server: was not locked!\n"); pr_warn("%s: was not locked!\n", __func__);
return; return;
} }
server->lock = 0; server->lock = 0;
......
...@@ -112,7 +112,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { ...@@ -112,7 +112,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
__le32 attr; __le32 attr;
unsigned int hdr; 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)) if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber))
kludge = 0; kludge = 0;
......
...@@ -169,7 +169,7 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb, ...@@ -169,7 +169,7 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb,
struct percpu_counter *fbc; struct percpu_counter *fbc;
compute_batch_value(); compute_batch_value();
if (action != CPU_DEAD) if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
return NOTIFY_OK; return NOTIFY_OK;
cpu = (unsigned long)hcpu; cpu = (unsigned long)hcpu;
......
...@@ -1862,7 +1862,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, ...@@ -1862,7 +1862,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
struct zone *zone = lruvec_zone(lruvec); struct zone *zone = lruvec_zone(lruvec);
unsigned long anon_prio, file_prio; unsigned long anon_prio, file_prio;
enum scan_balance scan_balance; enum scan_balance scan_balance;
unsigned long anon, file, free; unsigned long anon, file;
bool force_scan = false; bool force_scan = false;
unsigned long ap, fp; unsigned long ap, fp;
enum lru_list lru; enum lru_list lru;
...@@ -1915,20 +1915,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, ...@@ -1915,20 +1915,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
file = get_lru_size(lruvec, LRU_ACTIVE_FILE) + file = get_lru_size(lruvec, LRU_ACTIVE_FILE) +
get_lru_size(lruvec, LRU_INACTIVE_FILE); get_lru_size(lruvec, LRU_INACTIVE_FILE);
/*
* If it's foreseeable that reclaiming the file cache won't be
* enough to get the zone back into a desirable shape, we have
* to swap. Better start now and leave the - probably heavily
* thrashing - remaining file pages alone.
*/
if (global_reclaim(sc)) {
free = zone_page_state(zone, NR_FREE_PAGES);
if (unlikely(file + free <= high_wmark_pages(zone))) {
scan_balance = SCAN_ANON;
goto out;
}
}
/* /*
* There is enough inactive page cache, do not reclaim * There is enough inactive page cache, do not reclaim
* anything from the anonymous working set right now. * anything from the anonymous working set right now.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册