Commit 5370f2ff authored by Linus Torvalds's avatar Linus Torvalds

Merge AFS fixes

parents 46ea8f0c 02a4eb10
...@@ -23,14 +23,6 @@ kafs-objs := \ ...@@ -23,14 +23,6 @@ kafs-objs := \
vnode.o \ vnode.o \
volume.o volume.o
# cache.o obj-$(CONFIG_AFS_FS) := kafs.o
obj-m := kafs.o
# superfluous for 2.5, but needed for 2.4..
ifeq "$(VERSION).$(PATCHLEVEL)" "2.4"
kafs.o: $(kafs-objs)
$(LD) -r -o kafs.o $(kafs-objs)
endif
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -38,19 +38,17 @@ struct file_operations afs_dir_file_operations = { ...@@ -38,19 +38,17 @@ struct file_operations afs_dir_file_operations = {
struct inode_operations afs_dir_inode_operations = { struct inode_operations afs_dir_inode_operations = {
.lookup = afs_dir_lookup, .lookup = afs_dir_lookup,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.getattr = afs_inode_getattr, .getattr = afs_inode_getattr,
#else #if 0 /* TODO */
.revalidate = afs_inode_revalidate, .create = afs_dir_create,
.link = afs_dir_link,
.unlink = afs_dir_unlink,
.symlink = afs_dir_symlink,
.mkdir = afs_dir_mkdir,
.rmdir = afs_dir_rmdir,
.mknod = afs_dir_mknod,
.rename = afs_dir_rename,
#endif #endif
// .create = afs_dir_create,
// .link = afs_dir_link,
// .unlink = afs_dir_unlink,
// .symlink = afs_dir_symlink,
// .mkdir = afs_dir_mkdir,
// .rmdir = afs_dir_rmdir,
// .mknod = afs_dir_mknod,
// .rename = afs_dir_rename,
}; };
static struct dentry_operations afs_fs_dentry_operations = { static struct dentry_operations afs_fs_dentry_operations = {
...@@ -250,7 +248,7 @@ static int afs_dir_iterate_block(unsigned *fpos, ...@@ -250,7 +248,7 @@ static int afs_dir_iterate_block(unsigned *fpos,
/* skip entries marked unused in the bitmap */ /* skip entries marked unused in the bitmap */
if (!(block->pagehdr.bitmap[offset/8] & (1 << (offset % 8)))) { if (!(block->pagehdr.bitmap[offset/8] & (1 << (offset % 8)))) {
_debug("ENT[%u.%u]: unused\n",blkoff/sizeof(afs_dir_block_t),offset); _debug("ENT[%Zu.%u]: unused\n",blkoff/sizeof(afs_dir_block_t),offset);
if (offset>=curr) if (offset>=curr)
*fpos = blkoff + next * sizeof(afs_dirent_t); *fpos = blkoff + next * sizeof(afs_dirent_t);
continue; continue;
...@@ -260,26 +258,26 @@ static int afs_dir_iterate_block(unsigned *fpos, ...@@ -260,26 +258,26 @@ static int afs_dir_iterate_block(unsigned *fpos,
dire = &block->dirents[offset]; dire = &block->dirents[offset];
nlen = strnlen(dire->parts.name,sizeof(*block) - offset*sizeof(afs_dirent_t)); nlen = strnlen(dire->parts.name,sizeof(*block) - offset*sizeof(afs_dirent_t));
_debug("ENT[%u.%u]: %s %u \"%.*s\"\n", _debug("ENT[%Zu.%u]: %s %Zu \"%s\"\n",
blkoff/sizeof(afs_dir_block_t),offset, blkoff/sizeof(afs_dir_block_t),offset,
offset<curr ? "skip" : "fill", (offset<curr ? "skip" : "fill"),
nlen,nlen,dire->name); nlen,dire->u.name);
/* work out where the next possible entry is */ /* work out where the next possible entry is */
for (tmp=nlen; tmp>15; tmp-=sizeof(afs_dirent_t)) { for (tmp=nlen; tmp>15; tmp-=sizeof(afs_dirent_t)) {
if (next>=AFS_DIRENT_PER_BLOCK) { if (next>=AFS_DIRENT_PER_BLOCK) {
_debug("ENT[%u.%u]:" _debug("ENT[%Zu.%u]:"
" %u travelled beyond end dir block (len %u/%u)\n", " %u travelled beyond end dir block (len %u/%Zu)\n",
blkoff/sizeof(afs_dir_block_t),offset,next,tmp,nlen); blkoff/sizeof(afs_dir_block_t),offset,next,tmp,nlen);
return -EIO; return -EIO;
} }
if (!(block->pagehdr.bitmap[next/8] & (1 << (next % 8)))) { if (!(block->pagehdr.bitmap[next/8] & (1 << (next % 8)))) {
_debug("ENT[%u.%u]: %u unmarked extension (len %u/%u)\n", _debug("ENT[%Zu.%u]: %u unmarked extension (len %u/%Zu)\n",
blkoff/sizeof(afs_dir_block_t),offset,next,tmp,nlen); blkoff/sizeof(afs_dir_block_t),offset,next,tmp,nlen);
return -EIO; return -EIO;
} }
_debug("ENT[%u.%u]: ext %u/%u\n", _debug("ENT[%Zu.%u]: ext %u/%Zu\n",
blkoff/sizeof(afs_dir_block_t),next,tmp,nlen); blkoff/sizeof(afs_dir_block_t),next,tmp,nlen);
next++; next++;
} }
...@@ -397,7 +395,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen, lof ...@@ -397,7 +395,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen, lof
{ {
struct afs_dir_lookup_cookie *cookie = _cookie; struct afs_dir_lookup_cookie *cookie = _cookie;
_enter("{%s,%u},%s,%u,,%lu,%u",cookie->name,cookie->nlen,name,nlen,ino,ntohl(dtype)); _enter("{%s,%Zu},%s,%u,,%lu,%u",cookie->name,cookie->nlen,name,nlen,ino,ntohl(dtype));
if (cookie->nlen != nlen || memcmp(cookie->name,name,nlen)!=0) { if (cookie->nlen != nlen || memcmp(cookie->name,name,nlen)!=0) {
_leave(" = 0 [no]"); _leave(" = 0 [no]");
...@@ -471,7 +469,7 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry) ...@@ -471,7 +469,7 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry)
} }
dentry->d_op = &afs_fs_dentry_operations; dentry->d_op = &afs_fs_dentry_operations;
dentry->d_fsdata = (void*) (unsigned) vnode->status.version; dentry->d_fsdata = (void*) (unsigned long) vnode->status.version;
d_add(dentry,inode); d_add(dentry,inode);
_leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%lu }", _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%lu }",
...@@ -500,15 +498,9 @@ static int afs_d_revalidate(struct dentry *dentry, int flags) ...@@ -500,15 +498,9 @@ static int afs_d_revalidate(struct dentry *dentry, int flags)
_enter("%s,%x",dentry->d_name.name,flags); _enter("%s,%x",dentry->d_name.name,flags);
/* lock down the parent dentry so we can peer at it */ /* lock down the parent dentry so we can peer at it */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
read_lock(&dparent_lock); read_lock(&dparent_lock);
parent = dget(dentry->d_parent); parent = dget(dentry->d_parent);
read_unlock(&dparent_lock); read_unlock(&dparent_lock);
#else
lock_kernel();
parent = dget(dentry->d_parent);
unlock_kernel();
#endif
dir = parent->d_inode; dir = parent->d_inode;
inode = dentry->d_inode; inode = dentry->d_inode;
...@@ -541,10 +533,10 @@ static int afs_d_revalidate(struct dentry *dentry, int flags) ...@@ -541,10 +533,10 @@ static int afs_d_revalidate(struct dentry *dentry, int flags)
goto out_bad; goto out_bad;
} }
if ((unsigned)dentry->d_fsdata != (unsigned)AFS_FS_I(dir)->status.version) { if ((unsigned long)dentry->d_fsdata != (unsigned long)AFS_FS_I(dir)->status.version) {
_debug("%s: parent changed %u -> %u", _debug("%s: parent changed %lu -> %u",
dentry->d_name.name, dentry->d_name.name,
(unsigned)dentry->d_fsdata, (unsigned long)dentry->d_fsdata,
(unsigned)AFS_FS_I(dir)->status.version); (unsigned)AFS_FS_I(dir)->status.version);
/* search the directory for this vnode */ /* search the directory for this vnode */
...@@ -585,7 +577,7 @@ static int afs_d_revalidate(struct dentry *dentry, int flags) ...@@ -585,7 +577,7 @@ static int afs_d_revalidate(struct dentry *dentry, int flags)
goto out_bad; goto out_bad;
} }
dentry->d_fsdata = (void*) (unsigned) AFS_FS_I(dir)->status.version; dentry->d_fsdata = (void*) (unsigned long) AFS_FS_I(dir)->status.version;
} }
out_valid: out_valid:
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _H_DB712916_5113_11D6_9A6D_0002B3163499 #ifndef _LINUX_AFS_ERRORS_H
#define _H_DB712916_5113_11D6_9A6D_0002B3163499 #define _LINUX_AFS_ERRORS_H
#include "types.h" #include "types.h"
...@@ -31,4 +31,4 @@ typedef enum { ...@@ -31,4 +31,4 @@ typedef enum {
extern int afs_abort_to_error(int abortcode); extern int afs_abort_to_error(int abortcode);
#endif /* _H_DB712916_5113_11D6_9A6D_0002B3163499 */ #endif /* _LINUX_AFS_ERRORS_H */
...@@ -21,53 +21,34 @@ ...@@ -21,53 +21,34 @@
#include <rxrpc/call.h> #include <rxrpc/call.h>
#include "internal.h" #include "internal.h"
//static int afs_file_open(struct inode *inode, struct file *file); #if 0
//static int afs_file_release(struct inode *inode, struct file *file); static int afs_file_open(struct inode *inode, struct file *file);
static int afs_file_release(struct inode *inode, struct file *file);
#endif
static int afs_file_readpage(struct file *file, struct page *page); static int afs_file_readpage(struct file *file, struct page *page);
//static ssize_t afs_file_read(struct file *file, char *buf, size_t size, loff_t *off);
static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, loff_t *off); static ssize_t afs_file_write(struct file *file, const char *buf, size_t size, loff_t *off);
struct inode_operations afs_file_inode_operations = { struct inode_operations afs_file_inode_operations = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.getattr = afs_inode_getattr, .getattr = afs_inode_getattr,
#else
.revalidate = afs_inode_revalidate,
#endif
}; };
struct file_operations afs_file_file_operations = { struct file_operations afs_file_file_operations = {
// .open = afs_file_open, .read = generic_file_read,
// .release = afs_file_release,
.read = generic_file_read, //afs_file_read,
.write = afs_file_write, .write = afs_file_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
// .fsync = afs_file_fsync, #if 0
.open = afs_file_open,
.release = afs_file_release,
.fsync = afs_file_fsync,
#endif
}; };
struct address_space_operations afs_fs_aops = { struct address_space_operations afs_fs_aops = {
.readpage = afs_file_readpage, .readpage = afs_file_readpage,
}; };
/*****************************************************************************/
/*
* AFS file read
*/
#if 0
static ssize_t afs_file_read(struct file *file, char *buf, size_t size, loff_t *off)
{
struct afs_inode_info *ai;
ai = AFS_FS_I(file->f_dentry->d_inode);
if (ai->flags & AFS_INODE_DELETED)
return -ESTALE;
return -EIO;
} /* end afs_file_read() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
* AFS file write * AFS file write
......
...@@ -426,7 +426,7 @@ int afs_rxfs_fetch_file_data(afs_server_t *server, ...@@ -426,7 +426,7 @@ int afs_rxfs_fetch_file_data(afs_server_t *server,
int ret; int ret;
u32 *bp; u32 *bp;
_enter("%p,{fid={%u,%u,%u},sz=%u,of=%lu}", _enter("%p,{fid={%u,%u,%u},sz=%Zu,of=%lu}",
server, server,
desc->fid.vid, desc->fid.vid,
desc->fid.vnode, desc->fid.vnode,
......
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
struct afs_iget_data { struct afs_iget_data {
afs_fid_t fid; afs_fid_t fid;
afs_volume_t *volume; /* volume on which resides */ afs_volume_t *volume; /* volume on which resides */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
afs_vnode_t *new_vnode; /* new vnode record */
#endif
}; };
/*****************************************************************************/ /*****************************************************************************/
...@@ -41,7 +38,7 @@ static int afs_inode_map_status(afs_vnode_t *vnode) ...@@ -41,7 +38,7 @@ static int afs_inode_map_status(afs_vnode_t *vnode)
{ {
struct inode *inode = AFS_VNODE_TO_I(vnode); struct inode *inode = AFS_VNODE_TO_I(vnode);
_debug("FS: ft=%d lk=%d sz=%u ver=%Lu mod=%hu", _debug("FS: ft=%d lk=%d sz=%Zu ver=%Lu mod=%hu",
vnode->status.type, vnode->status.type,
vnode->status.nlink, vnode->status.nlink,
vnode->status.size, vnode->status.size,
...@@ -117,7 +114,6 @@ int afs_inode_fetch_status(struct inode *inode) ...@@ -117,7 +114,6 @@ int afs_inode_fetch_status(struct inode *inode)
/* /*
* iget5() comparator * iget5() comparator
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int afs_iget5_test(struct inode *inode, void *opaque) static int afs_iget5_test(struct inode *inode, void *opaque)
{ {
struct afs_iget_data *data = opaque; struct afs_iget_data *data = opaque;
...@@ -125,13 +121,11 @@ static int afs_iget5_test(struct inode *inode, void *opaque) ...@@ -125,13 +121,11 @@ static int afs_iget5_test(struct inode *inode, void *opaque)
/* only match inodes with the same version number */ /* only match inodes with the same version number */
return inode->i_ino==data->fid.vnode && inode->i_version==data->fid.unique; return inode->i_ino==data->fid.vnode && inode->i_version==data->fid.unique;
} /* end afs_iget5_test() */ } /* end afs_iget5_test() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
* iget5() inode initialiser * iget5() inode initialiser
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int afs_iget5_set(struct inode *inode, void *opaque) static int afs_iget5_set(struct inode *inode, void *opaque)
{ {
struct afs_iget_data *data = opaque; struct afs_iget_data *data = opaque;
...@@ -144,71 +138,6 @@ static int afs_iget5_set(struct inode *inode, void *opaque) ...@@ -144,71 +138,6 @@ static int afs_iget5_set(struct inode *inode, void *opaque)
return 0; return 0;
} /* end afs_iget5_set() */ } /* end afs_iget5_set() */
#endif
/*****************************************************************************/
/*
* iget4() comparator
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static int afs_iget4_test(struct inode *inode, ino_t ino, void *opaque)
{
struct afs_iget_data *data = opaque;
/* only match inodes with the same version number */
return inode->i_ino==data->fid.vnode && inode->i_version==data->fid.unique;
} /* end afs_iget4_test() */
#endif
/*****************************************************************************/
/*
* read an inode (2.4 only)
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
void afs_read_inode2(struct inode *inode, void *opaque)
{
struct afs_iget_data *data = opaque;
afs_vnode_t *vnode;
int ret;
_enter(",{{%u,%u,%u},%p}",data->fid.vid,data->fid.vnode,data->fid.unique,data->volume);
if (inode->u.generic_ip) BUG();
/* attach a pre-allocated vnode record */
inode->u.generic_ip = vnode = data->new_vnode;
data->new_vnode = NULL;
memset(vnode,0,sizeof(*vnode));
vnode->inode = inode;
init_waitqueue_head(&vnode->update_waitq);
spin_lock_init(&vnode->lock);
INIT_LIST_HEAD(&vnode->cb_link);
INIT_LIST_HEAD(&vnode->cb_hash_link);
afs_timer_init(&vnode->cb_timeout,&afs_vnode_cb_timed_out_ops);
vnode->flags |= AFS_VNODE_CHANGED;
vnode->volume = data->volume;
vnode->fid = data->fid;
/* ask the server for a status check */
ret = afs_vnode_fetch_status(vnode);
if (ret<0) {
make_bad_inode(inode);
_leave(" [bad inode]");
return;
}
ret = afs_inode_map_status(vnode);
if (ret<0) {
make_bad_inode(inode);
_leave(" [bad inode]");
return;
}
_leave("");
return;
} /* end afs_read_inode2() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
...@@ -227,7 +156,6 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod ...@@ -227,7 +156,6 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod
as = sb->s_fs_info; as = sb->s_fs_info;
data.volume = as->volume; data.volume = as->volume;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
inode = iget5_locked(sb,fid->vnode,afs_iget5_test,afs_iget5_set,&data); inode = iget5_locked(sb,fid->vnode,afs_iget5_test,afs_iget5_set,&data);
if (!inode) { if (!inode) {
_leave(" = -ENOMEM"); _leave(" = -ENOMEM");
...@@ -253,13 +181,6 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod ...@@ -253,13 +181,6 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod
if (ret<0) if (ret<0)
goto bad_inode; goto bad_inode;
#if 0
/* find a cache entry for it */
ret = afs_cache_lookup_vnode(as->volume,vnode);
if (ret<0)
goto bad_inode;
#endif
/* success */ /* success */
unlock_new_inode(inode); unlock_new_inode(inode);
...@@ -280,42 +201,12 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod ...@@ -280,42 +201,12 @@ inline int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inod
_leave(" = %d [bad]",ret); _leave(" = %d [bad]",ret);
return ret; return ret;
#else
/* pre-allocate a vnode record so that afs_read_inode2() doesn't have to return an inode
* without one attached
*/
data.new_vnode = kmalloc(sizeof(afs_vnode_t),GFP_KERNEL);
if (!data.new_vnode) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
inode = iget4(sb,fid->vnode,afs_iget4_test,&data);
if (data.new_vnode) kfree(data.new_vnode);
if (!inode) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
vnode = AFS_FS_I(inode);
*_inode = inode;
_leave(" = 0 [CB { v=%u x=%lu t=%u nix=%u }]",
vnode->cb_version,
vnode->cb_timeout.timo_jif,
vnode->cb_type,
vnode->nix
);
return 0;
#endif
} /* end afs_iget() */ } /* end afs_iget() */
/*****************************************************************************/ /*****************************************************************************/
/* /*
* read the attributes of an inode * read the attributes of an inode
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{ {
struct inode *inode; struct inode *inode;
...@@ -349,44 +240,6 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat ...@@ -349,44 +240,6 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat
return 0; return 0;
} /* end afs_inode_getattr() */ } /* end afs_inode_getattr() */
#endif
/*****************************************************************************/
/*
* revalidate the inode
*/
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
int afs_inode_revalidate(struct dentry *dentry)
{
struct inode *inode;
afs_vnode_t *vnode;
int ret;
inode = dentry->d_inode;
_enter("{ ino=%lu v=%lu }",inode->i_ino,inode->i_version);
vnode = AFS_FS_I(inode);
ret = afs_inode_fetch_status(inode);
if (ret==-ENOENT) {
_leave(" = %d [%d %p]",ret,atomic_read(&dentry->d_count),dentry->d_inode);
return ret;
}
else if (ret<0) {
make_bad_inode(inode);
_leave(" = %d",ret);
return ret;
}
_leave(" = 0 CB { v=%u x=%u t=%u }",
vnode->cb_version,
vnode->cb_expiry,
vnode->cb_type);
return 0;
} /* end afs_inode_revalidate() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
...@@ -410,9 +263,5 @@ void afs_clear_inode(struct inode *inode) ...@@ -410,9 +263,5 @@ void afs_clear_inode(struct inode *inode)
afs_vnode_give_up_callback(vnode); afs_vnode_give_up_callback(vnode);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
if (inode->u.generic_ip) kfree(inode->u.generic_ip);
#endif
_leave(""); _leave("");
} /* end afs_clear_inode() */ } /* end afs_clear_inode() */
...@@ -21,34 +21,24 @@ ...@@ -21,34 +21,24 @@
/* /*
* debug tracing * debug tracing
*/ */
#define kenter(FMT,...) printk("==> %s("FMT")\n",__FUNCTION__,##__VA_ARGS__) #define kenter(FMT, a...) printk("==> %s("FMT")\n",__FUNCTION__ , ## a)
#define kleave(FMT,...) printk("<== %s()"FMT"\n",__FUNCTION__,##__VA_ARGS__) #define kleave(FMT, a...) printk("<== %s()"FMT"\n",__FUNCTION__ , ## a)
#define kdebug(FMT,...) printk(FMT"\n",##__VA_ARGS__) #define kdebug(FMT, a...) printk(FMT"\n" , ## a)
#define kproto(FMT,...) printk("### "FMT"\n",##__VA_ARGS__) #define kproto(FMT, a...) printk("### "FMT"\n" , ## a)
#define knet(FMT,...) printk(FMT"\n",##__VA_ARGS__) #define knet(FMT, a...) printk(FMT"\n" , ## a)
#if 0 #if 0
#define _enter(FMT,...) kenter(FMT,##__VA_ARGS__) #define _enter(FMT, a...) kenter(FMT , ## a)
#define _leave(FMT,...) kleave(FMT,##__VA_ARGS__) #define _leave(FMT, a...) kleave(FMT , ## a)
#define _debug(FMT,...) kdebug(FMT,##__VA_ARGS__) #define _debug(FMT, a...) kdebug(FMT , ## a)
#define _proto(FMT,...) kproto(FMT,##__VA_ARGS__) #define _proto(FMT, a...) kproto(FMT , ## a)
#define _net(FMT,...) knet(FMT,##__VA_ARGS__) #define _net(FMT, a...) knet(FMT , ## a)
#else #else
#define _enter(FMT,...) do { } while(0) #define _enter(FMT, a...) do { } while(0)
#define _leave(FMT,...) do { } while(0) #define _leave(FMT, a...) do { } while(0)
#define _debug(FMT,...) do { } while(0) #define _debug(FMT, a...) do { } while(0)
#define _proto(FMT,...) do { } while(0) #define _proto(FMT, a...) do { } while(0)
#define _net(FMT,...) do { } while(0) #define _net(FMT, a...) do { } while(0)
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
#define wait_on_page_locked wait_on_page
#define PageUptodate Page_Uptodate
static inline struct proc_dir_entry *PDE(const struct inode *inode)
{
return (struct proc_dir_entry *)inode->u.generic_ip;
}
#endif #endif
static inline void afs_discard_my_signals(void) static inline void afs_discard_my_signals(void)
...@@ -85,12 +75,7 @@ extern struct file_operations afs_file_file_operations; ...@@ -85,12 +75,7 @@ extern struct file_operations afs_file_file_operations;
* inode.c * inode.c
*/ */
extern int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inode); extern int afs_iget(struct super_block *sb, afs_fid_t *fid, struct inode **_inode);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
extern int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); extern int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
#else
extern void afs_read_inode2(struct inode *inode, void *opaque);
extern int afs_inode_revalidate(struct dentry *dentry);
#endif
extern void afs_clear_inode(struct inode *inode); extern void afs_clear_inode(struct inode *inode);
/* /*
...@@ -113,7 +98,7 @@ extern struct list_head afs_cb_hash_tbl[]; ...@@ -113,7 +98,7 @@ extern struct list_head afs_cb_hash_tbl[];
extern spinlock_t afs_cb_hash_lock; extern spinlock_t afs_cb_hash_lock;
#define afs_cb_hash(SRV,FID) \ #define afs_cb_hash(SRV,FID) \
afs_cb_hash_tbl[((unsigned)(SRV) + (FID)->vid + (FID)->vnode + (FID)->unique) % \ afs_cb_hash_tbl[((unsigned long)(SRV) + (FID)->vid + (FID)->vnode + (FID)->unique) % \
AFS_CB_HASH_COUNT] AFS_CB_HASH_COUNT]
/* /*
......
...@@ -103,11 +103,7 @@ static int kafsasyncd(void *arg) ...@@ -103,11 +103,7 @@ static int kafsasyncd(void *arg)
/* only certain signals are of interest */ /* only certain signals are of interest */
spin_lock_irq(&current->sig->siglock); spin_lock_irq(&current->sig->siglock);
siginitsetinv(&current->blocked,0); siginitsetinv(&current->blocked,0);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
recalc_sigpending(); recalc_sigpending();
#else
recalc_sigpending(current);
#endif
spin_unlock_irq(&current->sig->siglock); spin_unlock_irq(&current->sig->siglock);
/* loop around looking for things to attend to */ /* loop around looking for things to attend to */
......
...@@ -80,11 +80,7 @@ static int kafstimod(void *arg) ...@@ -80,11 +80,7 @@ static int kafstimod(void *arg)
/* only certain signals are of interest */ /* only certain signals are of interest */
spin_lock_irq(&current->sig->siglock); spin_lock_irq(&current->sig->siglock);
siginitsetinv(&current->blocked,0); siginitsetinv(&current->blocked,0);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
recalc_sigpending(); recalc_sigpending();
#else
recalc_sigpending(current);
#endif
spin_unlock_irq(&current->sig->siglock); spin_unlock_irq(&current->sig->siglock);
/* loop around looking for things to attend to */ /* loop around looking for things to attend to */
......
...@@ -173,8 +173,8 @@ static void afs_discarding_peer(struct rxrpc_peer *peer) ...@@ -173,8 +173,8 @@ static void afs_discarding_peer(struct rxrpc_peer *peer)
_debug("Discarding peer %08x (rtt=%lu.%lumS)\n", _debug("Discarding peer %08x (rtt=%lu.%lumS)\n",
ntohl(peer->addr.s_addr), ntohl(peer->addr.s_addr),
peer->rtt/1000, (long)(peer->rtt/1000),
peer->rtt%1000); (long)(peer->rtt%1000));
/* uncross-point the structs under a global lock */ /* uncross-point the structs under a global lock */
spin_lock(&afs_server_peer_lock); spin_lock(&afs_server_peer_lock);
......
...@@ -31,11 +31,7 @@ struct file_operations afs_mntpt_file_operations = { ...@@ -31,11 +31,7 @@ struct file_operations afs_mntpt_file_operations = {
struct inode_operations afs_mntpt_inode_operations = { struct inode_operations afs_mntpt_inode_operations = {
.lookup = afs_mntpt_lookup, .lookup = afs_mntpt_lookup,
.readlink = page_readlink, .readlink = page_readlink,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.getattr = afs_inode_getattr, .getattr = afs_inode_getattr,
#else
.revalidate = afs_inode_revalidate,
#endif
}; };
/*****************************************************************************/ /*****************************************************************************/
...@@ -70,7 +66,7 @@ int afs_mntpt_check_symlink(afs_vnode_t *vnode) ...@@ -70,7 +66,7 @@ int afs_mntpt_check_symlink(afs_vnode_t *vnode)
/* examine the symlink's contents */ /* examine the symlink's contents */
size = vnode->status.size; size = vnode->status.size;
_debug("symlink to %*.*s",size,size,buf); _debug("symlink to %*.*s",size,(int)size,buf);
if (size>2 && if (size>2 &&
(buf[0]=='%' || buf[0]=='#') && (buf[0]=='%' || buf[0]=='#') &&
......
...@@ -412,6 +412,7 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) ...@@ -412,6 +412,7 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
afs_put_cell(cell); afs_put_cell(cell);
return ret;
} /* end afs_proc_cell_volumes_release() */ } /* end afs_proc_cell_volumes_release() */
/*****************************************************************************/ /*****************************************************************************/
...@@ -536,6 +537,7 @@ static int afs_proc_cell_vlservers_release(struct inode *inode, struct file *fil ...@@ -536,6 +537,7 @@ static int afs_proc_cell_vlservers_release(struct inode *inode, struct file *fil
afs_put_cell(cell); afs_put_cell(cell);
return ret;
} /* end afs_proc_cell_vlservers_release() */ } /* end afs_proc_cell_vlservers_release() */
/*****************************************************************************/ /*****************************************************************************/
...@@ -651,6 +653,7 @@ static int afs_proc_cell_servers_release(struct inode *inode, struct file *file) ...@@ -651,6 +653,7 @@ static int afs_proc_cell_servers_release(struct inode *inode, struct file *file)
afs_put_cell(cell); afs_put_cell(cell);
return ret;
} /* end afs_proc_cell_servers_release() */ } /* end afs_proc_cell_servers_release() */
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -39,12 +39,8 @@ static inline char *strdup(const char *s) ...@@ -39,12 +39,8 @@ static inline char *strdup(const char *s)
static void afs_i_init_once(void *foo, kmem_cache_t *cachep, unsigned long flags); static void afs_i_init_once(void *foo, kmem_cache_t *cachep, unsigned long flags);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static struct super_block *afs_get_sb(struct file_system_type *fs_type, static struct super_block *afs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data); int flags, char *dev_name, void *data);
#else
static struct super_block *afs_read_super(struct super_block *sb, void *data, int);
#endif
static struct inode *afs_alloc_inode(struct super_block *sb); static struct inode *afs_alloc_inode(struct super_block *sb);
...@@ -55,30 +51,20 @@ static void afs_destroy_inode(struct inode *inode); ...@@ -55,30 +51,20 @@ static void afs_destroy_inode(struct inode *inode);
static struct file_system_type afs_fs_type = { static struct file_system_type afs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "afs", .name = "afs",
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.get_sb = afs_get_sb, .get_sb = afs_get_sb,
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
#else
.read_super = afs_read_super,
#endif
}; };
static struct super_operations afs_super_ops = { static struct super_operations afs_super_ops = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.statfs = simple_statfs, .statfs = simple_statfs,
.alloc_inode = afs_alloc_inode, .alloc_inode = afs_alloc_inode,
.drop_inode = generic_delete_inode, .drop_inode = generic_delete_inode,
.destroy_inode = afs_destroy_inode, .destroy_inode = afs_destroy_inode,
#else
.read_inode2 = afs_read_inode2,
#endif
.clear_inode = afs_clear_inode, .clear_inode = afs_clear_inode,
.put_super = afs_put_super, .put_super = afs_put_super,
}; };
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static kmem_cache_t *afs_inode_cachep; static kmem_cache_t *afs_inode_cachep;
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
...@@ -90,23 +76,6 @@ int __init afs_fs_init(void) ...@@ -90,23 +76,6 @@ int __init afs_fs_init(void)
kenter(""); kenter("");
/* open the cache */
#if 0
ret = -EINVAL;
if (!cachedev) {
printk(KERN_NOTICE "kAFS: No cache device specified as module parm\n");
printk(KERN_NOTICE "kAFS: Set with \"cachedev=<devname>\" on insmod's cmdline\n");
return ret;
}
ret = afs_cache_open(cachedev,&afs_cache);
if (ret<0) {
printk(KERN_NOTICE "kAFS: Failed to open cache device\n");
return ret;
}
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
/* create ourselves an inode cache */ /* create ourselves an inode cache */
ret = -ENOMEM; ret = -ENOMEM;
afs_inode_cachep = kmem_cache_create("afs_inode_cache", afs_inode_cachep = kmem_cache_create("afs_inode_cache",
...@@ -117,22 +86,13 @@ int __init afs_fs_init(void) ...@@ -117,22 +86,13 @@ int __init afs_fs_init(void)
NULL); NULL);
if (!afs_inode_cachep) { if (!afs_inode_cachep) {
printk(KERN_NOTICE "kAFS: Failed to allocate inode cache\n"); printk(KERN_NOTICE "kAFS: Failed to allocate inode cache\n");
#if 0
afs_put_cache(afs_cache);
#endif
return ret; return ret;
} }
#endif
/* now export our filesystem to lesser mortals */ /* now export our filesystem to lesser mortals */
ret = register_filesystem(&afs_fs_type); ret = register_filesystem(&afs_fs_type);
if (ret<0) { if (ret<0) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
kmem_cache_destroy(afs_inode_cachep); kmem_cache_destroy(afs_inode_cachep);
#endif
#if 0
afs_put_cache(afs_cache);
#endif
kleave(" = %d",ret); kleave(" = %d",ret);
return ret; return ret;
} }
...@@ -148,16 +108,10 @@ int __init afs_fs_init(void) ...@@ -148,16 +108,10 @@ int __init afs_fs_init(void)
void __exit afs_fs_exit(void) void __exit afs_fs_exit(void)
{ {
/* destroy our private inode cache */ /* destroy our private inode cache */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
kmem_cache_destroy(afs_inode_cachep); kmem_cache_destroy(afs_inode_cachep);
#endif
unregister_filesystem(&afs_fs_type); unregister_filesystem(&afs_fs_type);
#if 0
if (afs_cache)
afs_put_cache(afs_cache);
#endif
} /* end afs_fs_exit() */ } /* end afs_fs_exit() */
/*****************************************************************************/ /*****************************************************************************/
...@@ -453,7 +407,6 @@ static int afs_fill_super(struct super_block *sb, void *_data, int silent) ...@@ -453,7 +407,6 @@ static int afs_fill_super(struct super_block *sb, void *_data, int silent)
* get an AFS superblock * get an AFS superblock
* - TODO: don't use get_sb_nodev(), but rather call sget() directly * - TODO: don't use get_sb_nodev(), but rather call sget() directly
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static struct super_block *afs_get_sb(struct file_system_type *fs_type, static struct super_block *afs_get_sb(struct file_system_type *fs_type,
int flags, int flags,
char *dev_name, char *dev_name,
...@@ -482,39 +435,6 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type, ...@@ -482,39 +435,6 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type,
_leave(""); _leave("");
return sb; return sb;
} /* end afs_get_sb() */ } /* end afs_get_sb() */
#endif
/*****************************************************************************/
/*
* read an AFS superblock
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static struct super_block *afs_read_super(struct super_block *sb, void *options, int silent)
{
void *data[2] = { NULL, options };
int ret;
_enter(",,%s",(char*)options);
/* start the cache manager */
ret = afscm_start();
if (ret<0) {
_leave(" = NULL (%d)",ret);
return NULL;
}
/* allocate a deviceless superblock */
ret = afs_fill_super(sb,data,silent);
if (ret<0) {
afscm_stop();
_leave(" = NULL (%d)",ret);
return NULL;
}
_leave(" = %p",sb);
return sb;
} /* end afs_read_super() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
...@@ -540,7 +460,6 @@ static void afs_put_super(struct super_block *sb) ...@@ -540,7 +460,6 @@ static void afs_put_super(struct super_block *sb)
/* /*
* initialise an inode cache slab element prior to any use * initialise an inode cache slab element prior to any use
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static void afs_i_init_once(void *_vnode, kmem_cache_t *cachep, unsigned long flags) static void afs_i_init_once(void *_vnode, kmem_cache_t *cachep, unsigned long flags)
{ {
afs_vnode_t *vnode = (afs_vnode_t *) _vnode; afs_vnode_t *vnode = (afs_vnode_t *) _vnode;
...@@ -556,13 +475,11 @@ static void afs_i_init_once(void *_vnode, kmem_cache_t *cachep, unsigned long fl ...@@ -556,13 +475,11 @@ static void afs_i_init_once(void *_vnode, kmem_cache_t *cachep, unsigned long fl
} }
} /* end afs_i_init_once() */ } /* end afs_i_init_once() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
* allocate an AFS inode struct from our slab cache * allocate an AFS inode struct from our slab cache
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static struct inode *afs_alloc_inode(struct super_block *sb) static struct inode *afs_alloc_inode(struct super_block *sb)
{ {
afs_vnode_t *vnode; afs_vnode_t *vnode;
...@@ -580,16 +497,13 @@ static struct inode *afs_alloc_inode(struct super_block *sb) ...@@ -580,16 +497,13 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
return &vnode->vfs_inode; return &vnode->vfs_inode;
} /* end afs_alloc_inode() */ } /* end afs_alloc_inode() */
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
* destroy an AFS inode struct * destroy an AFS inode struct
*/ */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static void afs_destroy_inode(struct inode *inode) static void afs_destroy_inode(struct inode *inode)
{ {
_enter("{%lu}",inode->i_ino); _enter("{%lu}",inode->i_ino);
kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode)); kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode));
} /* end afs_destroy_inode() */ } /* end afs_destroy_inode() */
#endif
...@@ -626,7 +626,7 @@ static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call) ...@@ -626,7 +626,7 @@ static void afs_rxvl_get_entry_by_id_attn(struct rxrpc_call *call)
case RXRPC_CSTATE_CLNT_GOT_REPLY: case RXRPC_CSTATE_CLNT_GOT_REPLY:
if (call->app_read_count==0) if (call->app_read_count==0)
break; break;
printk("kAFS: Reply bigger than expected {cst=%u asyn=%d mark=%d rdy=%u pr=%u%s}", printk("kAFS: Reply bigger than expected {cst=%u asyn=%d mark=%Zu rdy=%Zu pr=%u%s}",
call->app_call_state, call->app_call_state,
call->app_async_read, call->app_async_read,
call->app_mark, call->app_mark,
......
...@@ -27,11 +27,7 @@ struct afs_rxfs_fetch_descriptor; ...@@ -27,11 +27,7 @@ struct afs_rxfs_fetch_descriptor;
*/ */
struct afs_vnode struct afs_vnode
{ {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct inode vfs_inode; /* the VFS's inode record */ struct inode vfs_inode; /* the VFS's inode record */
#else
struct inode *inode; /* the VFS's inode */
#endif
afs_volume_t *volume; /* volume on which vnode resides */ afs_volume_t *volume; /* volume on which vnode resides */
afs_fid_t fid; /* the file identifier for this inode */ afs_fid_t fid; /* the file identifier for this inode */
...@@ -59,20 +55,12 @@ struct afs_vnode ...@@ -59,20 +55,12 @@ struct afs_vnode
static inline afs_vnode_t *AFS_FS_I(struct inode *inode) static inline afs_vnode_t *AFS_FS_I(struct inode *inode)
{ {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) return container_of(inode,afs_vnode_t,vfs_inode);
return list_entry(inode,afs_vnode_t,vfs_inode);
#else
return inode->u.generic_ip;
#endif
} }
static inline struct inode *AFS_VNODE_TO_I(afs_vnode_t *vnode) static inline struct inode *AFS_VNODE_TO_I(afs_vnode_t *vnode)
{ {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
return &vnode->vfs_inode; return &vnode->vfs_inode;
#else
return vnode->inode;
#endif
} }
extern int afs_vnode_fetch_status(afs_vnode_t *vnode); extern int afs_vnode_fetch_status(afs_vnode_t *vnode);
......
...@@ -153,7 +153,7 @@ do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0) ...@@ -153,7 +153,7 @@ do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0)
(CALL)->app_scr_alloc += (SIZE); \ (CALL)->app_scr_alloc += (SIZE); \
if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \ if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \
(size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),(SIZE)); \ printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE)); \
BUG(); \ BUG(); \
} \ } \
ptr; \ ptr; \
...@@ -167,7 +167,7 @@ do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0) ...@@ -167,7 +167,7 @@ do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0)
(CALL)->app_scr_alloc += size; \ (CALL)->app_scr_alloc += size; \
if (size>RXRPC_CALL_SCRATCH_SIZE || \ if (size>RXRPC_CALL_SCRATCH_SIZE || \
(size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
printk("rxrpc_call_alloc_scratch(%p,%u)\n",(CALL),size); \ printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size); \
BUG(); \ BUG(); \
} \ } \
ptr; \ ptr; \
......
...@@ -57,8 +57,8 @@ struct rxrpc_peer ...@@ -57,8 +57,8 @@ struct rxrpc_peer
/* calculated RTT cache */ /* calculated RTT cache */
#define RXRPC_RTT_CACHE_SIZE 32 #define RXRPC_RTT_CACHE_SIZE 32
suseconds_t rtt; /* current RTT estimate (in uS) */ suseconds_t rtt; /* current RTT estimate (in uS) */
unsigned short rtt_point; /* next entry at which to insert */ unsigned rtt_point; /* next entry at which to insert */
unsigned short rtt_usage; /* amount of cache actually used */ unsigned rtt_usage; /* amount of cache actually used */
suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */ suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */
}; };
......
...@@ -15,19 +15,13 @@ rxrpc-objs := \ ...@@ -15,19 +15,13 @@ rxrpc-objs := \
rxrpc_syms.o \ rxrpc_syms.o \
transport.o transport.o
#ifeq ($(CONFIG_PROC_FS),y) ifeq ($(CONFIG_PROC_FS),y)
rxrpc-objs += proc.o rxrpc-objs += proc.o
#endif endif
#ifeq ($(CONFIG_SYSCTL),y) ifeq ($(CONFIG_SYSCTL),y)
rxrpc-objs += sysctl.o rxrpc-objs += sysctl.o
#endif
obj-m := rxrpc.o
# superfluous for 2.5, but needed for 2.4..
ifeq "$(VERSION).$(PATCHLEVEL)" "2.4"
rxrpc.o: $(rxrpc-objs)
$(LD) -r -o $@ $(rxrpc-objs)
endif endif
obj-$(CONFIG_RXRPC) := rxrpc.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -26,10 +26,10 @@ __RXACCT_DECL(atomic_t rxrpc_message_count); ...@@ -26,10 +26,10 @@ __RXACCT_DECL(atomic_t rxrpc_message_count);
LIST_HEAD(rxrpc_calls); LIST_HEAD(rxrpc_calls);
DECLARE_RWSEM(rxrpc_calls_sem); DECLARE_RWSEM(rxrpc_calls_sem);
unsigned rxrpc_call_rcv_timeout = 30; unsigned rxrpc_call_rcv_timeout = HZ/3;
unsigned rxrpc_call_acks_timeout = 30; unsigned rxrpc_call_acks_timeout = HZ/3;
unsigned rxrpc_call_dfr_ack_timeout = 5; unsigned rxrpc_call_dfr_ack_timeout = HZ/20;
unsigned short rxrpc_call_max_resend = 10; unsigned short rxrpc_call_max_resend = HZ/10;
const char *rxrpc_call_states[] = { const char *rxrpc_call_states[] = {
"COMPLETE", "COMPLETE",
...@@ -129,6 +129,22 @@ static void __rxrpc_call_ackr_timeout(unsigned long _call) ...@@ -129,6 +129,22 @@ static void __rxrpc_call_ackr_timeout(unsigned long _call)
rxrpc_krxiod_queue_call(call); rxrpc_krxiod_queue_call(call);
} }
/*****************************************************************************/
/*
* calculate a timeout based on an RTT value
*/
static inline unsigned long __rxrpc_rtt_based_timeout(struct rxrpc_call *call, unsigned long val)
{
unsigned long expiry = call->conn->peer->rtt / (1000000/HZ);
expiry += 10;
if (expiry<HZ/25) expiry = HZ/25;
if (expiry>HZ) expiry = HZ;
_leave(" = %lu jiffies",expiry);
return jiffies + expiry;
} /* end __rxrpc_rtt_based_timeout() */
/*****************************************************************************/ /*****************************************************************************/
/* /*
* create a new call record * create a new call record
...@@ -321,7 +337,10 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn, ...@@ -321,7 +337,10 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn,
spin_lock(&conn->lock); spin_lock(&conn->lock);
if (!conn->channels[cix]) { if (!conn->channels[cix] ||
conn->channels[cix]->app_call_state == RXRPC_CSTATE_COMPLETE ||
conn->channels[cix]->app_call_state == RXRPC_CSTATE_ERROR
) {
conn->channels[cix] = call; conn->channels[cix] = call;
rxrpc_get_connection(conn); rxrpc_get_connection(conn);
ret = 0; ret = 0;
...@@ -329,9 +348,10 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn, ...@@ -329,9 +348,10 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn,
spin_unlock(&conn->lock); spin_unlock(&conn->lock);
if (ret<0) free_page((unsigned long)call); if (ret<0) {
free_page((unsigned long)call);
_leave(" = %p",call); call = NULL;
}
if (ret==0) { if (ret==0) {
down_write(&rxrpc_calls_sem); down_write(&rxrpc_calls_sem);
...@@ -341,6 +361,7 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn, ...@@ -341,6 +361,7 @@ int rxrpc_incoming_call(struct rxrpc_connection *conn,
*_call = call; *_call = call;
} }
_leave(" = %d [%p]",ret,call);
return ret; return ret;
} /* end rxrpc_incoming_call() */ } /* end rxrpc_incoming_call() */
...@@ -367,7 +388,8 @@ void rxrpc_put_call(struct rxrpc_call *call) ...@@ -367,7 +388,8 @@ void rxrpc_put_call(struct rxrpc_call *call)
return; return;
} }
conn->channels[ntohl(call->chan_ix)] = NULL; if (conn->channels[ntohl(call->chan_ix)]==call)
conn->channels[ntohl(call->chan_ix)] = NULL;
spin_unlock(&conn->lock); spin_unlock(&conn->lock);
...@@ -1005,7 +1027,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc ...@@ -1005,7 +1027,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc
} }
/* next in sequence - simply append into the call's ready queue */ /* next in sequence - simply append into the call's ready queue */
_debug("Call add packet %d to readyq (+%d => %d bytes)", _debug("Call add packet %d to readyq (+%Zd => %Zd bytes)",
msg->seq,msg->dsize,call->app_ready_qty); msg->seq,msg->dsize,call->app_ready_qty);
spin_lock(&call->lock); spin_lock(&call->lock);
...@@ -1021,7 +1043,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc ...@@ -1021,7 +1043,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc
break; break;
/* next in sequence - just move list-to-list */ /* next in sequence - just move list-to-list */
_debug("Call transfer packet %d to readyq (+%d => %d bytes)", _debug("Call transfer packet %d to readyq (+%Zd => %Zd bytes)",
pmsg->seq,pmsg->dsize,call->app_ready_qty); pmsg->seq,pmsg->dsize,call->app_ready_qty);
call->app_ready_seq = pmsg->seq; call->app_ready_seq = pmsg->seq;
...@@ -1156,7 +1178,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc ...@@ -1156,7 +1178,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call, struct rxrpc
/* otherwise just invoke the data function whenever we can satisfy its desire for more /* otherwise just invoke the data function whenever we can satisfy its desire for more
* data * data
*/ */
_proto("Rx Received Op Data: st=%u qty=%u mk=%u%s", _proto("Rx Received Op Data: st=%u qty=%Zu mk=%Zu%s",
call->app_call_state,call->app_ready_qty,call->app_mark, call->app_call_state,call->app_ready_qty,call->app_mark,
call->app_last_rcv ? " last-rcvd" : ""); call->app_last_rcv ? " last-rcvd" : "");
...@@ -1394,7 +1416,7 @@ static int rxrpc_call_record_ACK(struct rxrpc_call *call, ...@@ -1394,7 +1416,7 @@ static int rxrpc_call_record_ACK(struct rxrpc_call *call,
char resend, now_complete; char resend, now_complete;
u8 acks[16]; u8 acks[16];
_enter("%p{apc=%u ads=%u},%p,%u,%u", _enter("%p{apc=%u ads=%u},%p,%u,%Zu",
call,call->acks_pend_cnt,call->acks_dftv_seq,msg,seq,count); call,call->acks_pend_cnt,call->acks_dftv_seq,msg,seq,count);
/* handle re-ACK'ing of definitively ACK'd packets (may be out-of-order ACKs) */ /* handle re-ACK'ing of definitively ACK'd packets (may be out-of-order ACKs) */
...@@ -1443,7 +1465,7 @@ static int rxrpc_call_record_ACK(struct rxrpc_call *call, ...@@ -1443,7 +1465,7 @@ static int rxrpc_call_record_ACK(struct rxrpc_call *call,
} }
_proto("Rx ACK of packets #%u-#%u [%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c] (pend=%u)", _proto("Rx ACK of packets #%u-#%u [%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c] (pend=%u)",
seq,seq+chunk-1, seq,(unsigned)(seq+chunk-1),
_acktype[acks[0x0]], _acktype[acks[0x0]],
_acktype[acks[0x1]], _acktype[acks[0x1]],
_acktype[acks[0x2]], _acktype[acks[0x2]],
...@@ -1552,7 +1574,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call) ...@@ -1552,7 +1574,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call)
size_t qty; size_t qty;
int ret; int ret;
_enter("%p{as=%d buf=%p qty=%u/%u}", _enter("%p{as=%d buf=%p qty=%Zu/%Zu}",
call,call->app_async_read,call->app_read_buf,call->app_ready_qty,call->app_mark); call,call->app_async_read,call->app_read_buf,call->app_ready_qty,call->app_mark);
/* check the state */ /* check the state */
...@@ -1560,7 +1582,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call) ...@@ -1560,7 +1582,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call)
case RXRPC_CSTATE_SRVR_RCV_ARGS: case RXRPC_CSTATE_SRVR_RCV_ARGS:
case RXRPC_CSTATE_CLNT_RCV_REPLY: case RXRPC_CSTATE_CLNT_RCV_REPLY:
if (call->app_last_rcv) { if (call->app_last_rcv) {
printk("%s(%p,%p,%d): Inconsistent call state (%s, last pkt)", printk("%s(%p,%p,%Zd): Inconsistent call state (%s, last pkt)",
__FUNCTION__,call,call->app_read_buf,call->app_mark, __FUNCTION__,call,call->app_read_buf,call->app_mark,
rxrpc_call_states[call->app_call_state]); rxrpc_call_states[call->app_call_state]);
BUG(); BUG();
...@@ -1574,7 +1596,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call) ...@@ -1574,7 +1596,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call)
case RXRPC_CSTATE_SRVR_SND_REPLY: case RXRPC_CSTATE_SRVR_SND_REPLY:
if (!call->app_last_rcv) { if (!call->app_last_rcv) {
printk("%s(%p,%p,%d): Inconsistent call state (%s, not last pkt)", printk("%s(%p,%p,%Zd): Inconsistent call state (%s, not last pkt)",
__FUNCTION__,call,call->app_read_buf,call->app_mark, __FUNCTION__,call,call->app_read_buf,call->app_mark,
rxrpc_call_states[call->app_call_state]); rxrpc_call_states[call->app_call_state]);
BUG(); BUG();
...@@ -1616,11 +1638,11 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call) ...@@ -1616,11 +1638,11 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call)
/* drag as much data as we need out of this packet */ /* drag as much data as we need out of this packet */
qty = min(call->app_mark,msg->dsize); qty = min(call->app_mark,msg->dsize);
_debug("reading %u from skb=%p off=%lu",qty,msg->pkt,msg->offset); _debug("reading %Zu from skb=%p off=%lu",qty,msg->pkt,msg->offset);
if (call->app_read_buf) if (call->app_read_buf)
if (skb_copy_bits(msg->pkt,msg->offset,call->app_read_buf,qty)<0) if (skb_copy_bits(msg->pkt,msg->offset,call->app_read_buf,qty)<0)
panic("%s: Failed to copy data from packet: (%p,%p,%d)", panic("%s: Failed to copy data from packet: (%p,%p,%Zd)",
__FUNCTION__,call,call->app_read_buf,qty); __FUNCTION__,call,call->app_read_buf,qty);
/* if that packet is now empty, discard it */ /* if that packet is now empty, discard it */
...@@ -1673,7 +1695,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call) ...@@ -1673,7 +1695,7 @@ static int __rxrpc_call_read_data(struct rxrpc_call *call)
} }
if (call->app_last_rcv) { if (call->app_last_rcv) {
_debug("Insufficient data (%u/%u)",call->app_ready_qty,call->app_mark); _debug("Insufficient data (%Zu/%Zu)",call->app_ready_qty,call->app_mark);
call->app_async_read = 0; call->app_async_read = 0;
call->app_mark = RXRPC_APP_MARK_EOF; call->app_mark = RXRPC_APP_MARK_EOF;
call->app_read_buf = NULL; call->app_read_buf = NULL;
...@@ -1703,7 +1725,7 @@ int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int ...@@ -1703,7 +1725,7 @@ int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int
{ {
int ret; int ret;
_enter("%p{arq=%u},%p,%d,%x",call,call->app_ready_qty,buffer,size,flags); _enter("%p{arq=%Zu},%p,%Zd,%x",call,call->app_ready_qty,buffer,size,flags);
spin_lock(&call->lock); spin_lock(&call->lock);
...@@ -1799,7 +1821,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1799,7 +1821,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
char *buf; char *buf;
int ret; int ret;
_enter("%p,%u,%p,%02x,%x,%d,%p",call,sioc,siov,rxhdr_flags,alloc_flags,dup_data,size_sent); _enter("%p,%Zu,%p,%02x,%x,%d,%p",call,sioc,siov,rxhdr_flags,alloc_flags,dup_data,size_sent);
*size_sent = 0; *size_sent = 0;
size = 0; size = 0;
...@@ -1827,7 +1849,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1827,7 +1849,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
size += sptr->iov_len; size += sptr->iov_len;
} }
_debug("- size=%u mtu=%u",size,call->conn->mtu_size); _debug("- size=%Zu mtu=%Zu",size,call->conn->mtu_size);
do { do {
/* make sure there's a message under construction */ /* make sure there's a message under construction */
...@@ -1837,7 +1859,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1837,7 +1859,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
0,NULL,alloc_flags,&call->snd_nextmsg); 0,NULL,alloc_flags,&call->snd_nextmsg);
if (ret<0) if (ret<0)
goto out; goto out;
_debug("- allocated new message [ds=%u]",call->snd_nextmsg->dsize); _debug("- allocated new message [ds=%Zu]",call->snd_nextmsg->dsize);
} }
msg = call->snd_nextmsg; msg = call->snd_nextmsg;
...@@ -1857,7 +1879,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1857,7 +1879,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
space = call->conn->mtu_size - msg->dsize; space = call->conn->mtu_size - msg->dsize;
chunk = min(space,size); chunk = min(space,size);
_debug("- [before] space=%u chunk=%u",space,chunk); _debug("- [before] space=%Zu chunk=%Zu",space,chunk);
while (!siov->iov_len) while (!siov->iov_len)
siov++; siov++;
...@@ -1916,7 +1938,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1916,7 +1938,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
} }
} }
_debug("- [loaded] chunk=%u size=%u",chunk,size); _debug("- [loaded] chunk=%Zu size=%Zu",chunk,size);
/* dispatch the message when full, final or requesting ACK */ /* dispatch the message when full, final or requesting ACK */
if (msg->dsize>=call->conn->mtu_size || rxhdr_flags) { if (msg->dsize>=call->conn->mtu_size || rxhdr_flags) {
...@@ -1929,7 +1951,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call, ...@@ -1929,7 +1951,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
ret = 0; ret = 0;
out: out:
_leave(" = %d (%d queued, %d rem)",ret,*size_sent,size); _leave(" = %d (%Zd queued, %Zd rem)",ret,*size_sent,size);
return ret; return ret;
} /* end rxrpc_call_write_data() */ } /* end rxrpc_call_write_data() */
...@@ -1960,7 +1982,7 @@ int rxrpc_call_flush(struct rxrpc_call *call) ...@@ -1960,7 +1982,7 @@ int rxrpc_call_flush(struct rxrpc_call *call)
msg->hdr.flags |= RXRPC_MORE_PACKETS; msg->hdr.flags |= RXRPC_MORE_PACKETS;
} }
_proto("Sending DATA message { ds=%u dc=%u df=%02lu }", _proto("Sending DATA message { ds=%Zu dc=%u df=%02lu }",
msg->dsize,msg->dcount,msg->dfree); msg->dsize,msg->dcount,msg->dfree);
/* queue and adjust call state */ /* queue and adjust call state */
...@@ -1993,7 +2015,8 @@ int rxrpc_call_flush(struct rxrpc_call *call) ...@@ -1993,7 +2015,8 @@ int rxrpc_call_flush(struct rxrpc_call *call)
call->acks_pend_cnt++; call->acks_pend_cnt++;
mod_timer(&call->acks_timeout,jiffies + rxrpc_call_acks_timeout); mod_timer(&call->acks_timeout,
__rxrpc_rtt_based_timeout(call,rxrpc_call_acks_timeout));
spin_unlock(&call->lock); spin_unlock(&call->lock);
...@@ -2061,7 +2084,7 @@ static void rxrpc_call_resend(struct rxrpc_call *call, rxrpc_seq_t highest) ...@@ -2061,7 +2084,7 @@ static void rxrpc_call_resend(struct rxrpc_call *call, rxrpc_seq_t highest)
spin_unlock(&call->lock); spin_unlock(&call->lock);
/* send each message again (and ignore any errors we might incur) */ /* send each message again (and ignore any errors we might incur) */
_proto("Resending DATA message { ds=%u dc=%u df=%02lu }", _proto("Resending DATA message { ds=%Zu dc=%u df=%02lu }",
msg->dsize,msg->dcount,msg->dfree); msg->dsize,msg->dcount,msg->dfree);
if (rxrpc_conn_sendmsg(call->conn,msg)==0) if (rxrpc_conn_sendmsg(call->conn,msg)==0)
...@@ -2073,7 +2096,7 @@ static void rxrpc_call_resend(struct rxrpc_call *call, rxrpc_seq_t highest) ...@@ -2073,7 +2096,7 @@ static void rxrpc_call_resend(struct rxrpc_call *call, rxrpc_seq_t highest)
} }
/* reset the timeout */ /* reset the timeout */
mod_timer(&call->acks_timeout,jiffies + rxrpc_call_acks_timeout); mod_timer(&call->acks_timeout,__rxrpc_rtt_based_timeout(call,rxrpc_call_acks_timeout));
spin_unlock(&call->lock); spin_unlock(&call->lock);
......
...@@ -121,7 +121,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans, ...@@ -121,7 +121,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
conn->out_epoch = rxrpc_epoch; conn->out_epoch = rxrpc_epoch;
conn->in_clientflag = 0; conn->in_clientflag = 0;
conn->out_clientflag = RXRPC_CLIENT_INITIATED; conn->out_clientflag = RXRPC_CLIENT_INITIATED;
conn->conn_id = htonl((unsigned) conn & RXRPC_CIDMASK); conn->conn_id = htonl((unsigned long) conn & RXRPC_CIDMASK);
conn->service_id = htons(service_id); conn->service_id = htons(service_id);
/* attach to peer */ /* attach to peer */
...@@ -547,7 +547,7 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg) ...@@ -547,7 +547,7 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg)
msghdr.msg_controllen = 0; msghdr.msg_controllen = 0;
msghdr.msg_flags = MSG_CONFIRM|MSG_DONTWAIT; msghdr.msg_flags = MSG_CONFIRM|MSG_DONTWAIT;
_net("Sending message type %d of %d bytes to %08x:%d", _net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type, msg->hdr.type,
msg->dsize, msg->dsize,
htonl(conn->addr.sin_addr.s_addr), htonl(conn->addr.sin_addr.s_addr),
......
...@@ -29,24 +29,24 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count); ...@@ -29,24 +29,24 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count);
/* /*
* debug tracing * debug tracing
*/ */
#define kenter(FMT,...) printk("==> %s("FMT")\n",__FUNCTION__,##__VA_ARGS__) #define kenter(FMT, a...) printk("==> %s("FMT")\n",__FUNCTION__ , ##a)
#define kleave(FMT,...) printk("<== %s()"FMT"\n",__FUNCTION__,##__VA_ARGS__) #define kleave(FMT, a...) printk("<== %s()"FMT"\n",__FUNCTION__ , ##a)
#define kdebug(FMT,...) printk(" "FMT"\n",##__VA_ARGS__) #define kdebug(FMT, a...) printk(" "FMT"\n" , ##a)
#define kproto(FMT,...) printk("### "FMT"\n",##__VA_ARGS__) #define kproto(FMT, a...) printk("### "FMT"\n" , ##a)
#define knet(FMT,...) printk(" "FMT"\n",##__VA_ARGS__) #define knet(FMT, a...) printk(" "FMT"\n" , ##a)
#if 0 #if 0
#define _enter(FMT,...) kenter(FMT,##__VA_ARGS__) #define _enter(FMT, a...) kenter(FMT , ##a)
#define _leave(FMT,...) kleave(FMT,##__VA_ARGS__) #define _leave(FMT, a...) kleave(FMT , ##a)
#define _debug(FMT,...) kdebug(FMT,##__VA_ARGS__) #define _debug(FMT, a...) kdebug(FMT , ##a)
#define _proto(FMT,...) kproto(FMT,##__VA_ARGS__) #define _proto(FMT, a...) kproto(FMT , ##a)
#define _net(FMT,...) knet(FMT,##__VA_ARGS__) #define _net(FMT, a...) knet(FMT , ##a)
#else #else
#define _enter(FMT,...) do { if (rxrpc_ktrace) kenter(FMT,##__VA_ARGS__); } while(0) #define _enter(FMT, a...) do { if (rxrpc_ktrace) kenter(FMT , ##a); } while(0)
#define _leave(FMT,...) do { if (rxrpc_ktrace) kleave(FMT,##__VA_ARGS__); } while(0) #define _leave(FMT, a...) do { if (rxrpc_ktrace) kleave(FMT , ##a); } while(0)
#define _debug(FMT,...) do { if (rxrpc_kdebug) kdebug(FMT,##__VA_ARGS__); } while(0) #define _debug(FMT, a...) do { if (rxrpc_kdebug) kdebug(FMT , ##a); } while(0)
#define _proto(FMT,...) do { if (rxrpc_kproto) kproto(FMT,##__VA_ARGS__); } while(0) #define _proto(FMT, a...) do { if (rxrpc_kproto) kproto(FMT , ##a); } while(0)
#define _net(FMT,...) do { if (rxrpc_knet) knet (FMT,##__VA_ARGS__); } while(0) #define _net(FMT, a...) do { if (rxrpc_knet) knet (FMT , ##a); } while(0)
#endif #endif
static inline void rxrpc_discard_my_signals(void) static inline void rxrpc_discard_my_signals(void)
......
...@@ -49,11 +49,7 @@ static int rxrpc_krxiod(void *arg) ...@@ -49,11 +49,7 @@ static int rxrpc_krxiod(void *arg)
/* only certain signals are of interest */ /* only certain signals are of interest */
spin_lock_irq(&current->sig->siglock); spin_lock_irq(&current->sig->siglock);
siginitsetinv(&current->blocked,0); siginitsetinv(&current->blocked,0);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
recalc_sigpending(); recalc_sigpending();
#else
recalc_sigpending(current);
#endif
spin_unlock_irq(&current->sig->siglock); spin_unlock_irq(&current->sig->siglock);
/* loop around waiting for work to do */ /* loop around waiting for work to do */
......
...@@ -61,11 +61,7 @@ static int rxrpc_krxsecd(void *arg) ...@@ -61,11 +61,7 @@ static int rxrpc_krxsecd(void *arg)
/* only certain signals are of interest */ /* only certain signals are of interest */
spin_lock_irq(&current->sig->siglock); spin_lock_irq(&current->sig->siglock);
siginitsetinv(&current->blocked,0); siginitsetinv(&current->blocked,0);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
recalc_sigpending(); recalc_sigpending();
#else
recalc_sigpending(current);
#endif
spin_unlock_irq(&current->sig->siglock); spin_unlock_irq(&current->sig->siglock);
/* loop around waiting for work to do */ /* loop around waiting for work to do */
......
...@@ -79,11 +79,7 @@ static int krxtimod(void *arg) ...@@ -79,11 +79,7 @@ static int krxtimod(void *arg)
/* only certain signals are of interest */ /* only certain signals are of interest */
spin_lock_irq(&current->sig->siglock); spin_lock_irq(&current->sig->siglock);
siginitsetinv(&current->blocked,0); siginitsetinv(&current->blocked,0);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,3)
recalc_sigpending(); recalc_sigpending();
#else
recalc_sigpending(current);
#endif
spin_unlock_irq(&current->sig->siglock); spin_unlock_irq(&current->sig->siglock);
/* loop around looking for things to attend to */ /* loop around looking for things to attend to */
......
...@@ -370,11 +370,13 @@ void rxrpc_peer_calculate_rtt(struct rxrpc_peer *peer, ...@@ -370,11 +370,13 @@ void rxrpc_peer_calculate_rtt(struct rxrpc_peer *peer,
if (peer->rtt_usage<RXRPC_RTT_CACHE_SIZE) peer->rtt_usage++; if (peer->rtt_usage<RXRPC_RTT_CACHE_SIZE) peer->rtt_usage++;
/* recalculate RTT */ /* recalculate RTT */
rtt = 0;
for (loop=peer->rtt_usage-1; loop>=0; loop--) for (loop=peer->rtt_usage-1; loop>=0; loop--)
rtt += peer->rtt_cache[loop]; rtt += peer->rtt_cache[loop];
peer->rtt = do_div(rtt,peer->rtt_usage); do_div(rtt,peer->rtt_usage);
peer->rtt = rtt;
_leave(" RTT=%lu.%lums",peer->rtt/1000,peer->rtt%1000); _leave(" RTT=%lu.%lums",(long)(peer->rtt/1000),(long)(peer->rtt%1000));
} /* end rxrpc_peer_calculate_rtt() */ } /* end rxrpc_peer_calculate_rtt() */
...@@ -22,13 +22,6 @@ ...@@ -22,13 +22,6 @@
#include <rxrpc/message.h> #include <rxrpc/message.h>
#include "internal.h" #include "internal.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static inline struct proc_dir_entry *PDE(const struct inode *inode)
{
return (struct proc_dir_entry *)inode->u.generic_ip;
}
#endif
static struct proc_dir_entry *proc_rxrpc; static struct proc_dir_entry *proc_rxrpc;
static int rxrpc_proc_transports_open(struct inode *inode, struct file *file); static int rxrpc_proc_transports_open(struct inode *inode, struct file *file);
...@@ -379,14 +372,14 @@ static int rxrpc_proc_peers_show(struct seq_file *m, void *v) ...@@ -379,14 +372,14 @@ static int rxrpc_proc_peers_show(struct seq_file *m, void *v)
if (!list_empty(&peer->timeout.link)) if (!list_empty(&peer->timeout.link))
timeout = (signed long)peer->timeout.timo_jif - (signed long)jiffies; timeout = (signed long)peer->timeout.timo_jif - (signed long)jiffies;
seq_printf(m,"%5hu %08x %5d %5d %8ld %5u %7lu\n", seq_printf(m,"%5hu %08x %5d %5d %8ld %5Zu %7lu\n",
peer->trans->port, peer->trans->port,
ntohl(peer->addr.s_addr), ntohl(peer->addr.s_addr),
atomic_read(&peer->usage), atomic_read(&peer->usage),
atomic_read(&peer->conn_count), atomic_read(&peer->conn_count),
timeout, timeout,
peer->if_mtu, peer->if_mtu,
peer->rtt (long) peer->rtt
); );
return 0; return 0;
...@@ -484,7 +477,7 @@ static int rxrpc_proc_conns_show(struct seq_file *m, void *v) ...@@ -484,7 +477,7 @@ static int rxrpc_proc_conns_show(struct seq_file *m, void *v)
if (!list_empty(&conn->timeout.link)) if (!list_empty(&conn->timeout.link))
timeout = (signed long)conn->timeout.timo_jif - (signed long)jiffies; timeout = (signed long)conn->timeout.timo_jif - (signed long)jiffies;
seq_printf(m,"%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5u %8ld\n", seq_printf(m,"%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n",
conn->trans->port, conn->trans->port,
ntohl(conn->addr.sin_addr.s_addr), ntohl(conn->addr.sin_addr.s_addr),
ntohs(conn->addr.sin_port), ntohs(conn->addr.sin_port),
......
...@@ -691,12 +691,12 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans) ...@@ -691,12 +691,12 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
msg.msg_controllen = (char*)msg.msg_control - (char*)&emsg; msg.msg_controllen = (char*)msg.msg_control - (char*)&emsg;
if (msg.msg_controllen<sizeof(emsg.cmsg) || msg.msg_namelen<sizeof(sin)) { if (msg.msg_controllen<sizeof(emsg.cmsg) || msg.msg_namelen<sizeof(sin)) {
printk("%s: short control message (nlen=%u clen=%u fl=%x)\n", printk("%s: short control message (nlen=%u clen=%Zu fl=%x)\n",
__FUNCTION__,msg.msg_namelen,msg.msg_controllen,msg.msg_flags); __FUNCTION__,msg.msg_namelen,msg.msg_controllen,msg.msg_flags);
continue; continue;
} }
_net("Rx Received control message { len=%u level=%u type=%u }", _net("Rx Received control message { len=%Zu level=%u type=%u }",
emsg.cmsg.cmsg_len,emsg.cmsg.cmsg_level,emsg.cmsg.cmsg_type); emsg.cmsg.cmsg_len,emsg.cmsg.cmsg_level,emsg.cmsg.cmsg_type);
if (sin.sin_family!=AF_INET) { if (sin.sin_family!=AF_INET) {
...@@ -715,7 +715,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans) ...@@ -715,7 +715,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
} }
if (msg.msg_controllen<sizeof(emsg.cmsg)+sizeof(emsg.ee)) { if (msg.msg_controllen<sizeof(emsg.cmsg)+sizeof(emsg.ee)) {
printk("%s: short error message (%u)\n",__FUNCTION__,msg.msg_controllen); printk("%s: short error message (%Zu)\n",__FUNCTION__,msg.msg_controllen);
_leave(""); _leave("");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment