From 7c4e6a7e6dd3452a66c6ce7dc163d6409d2199a0 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Tue, 7 Nov 2000 16:09:08 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r44, which included commits to RCS files with non-trunk default branches. --- src/afs/LINUX/osi_alloc.c | 8 + src/afs/LINUX/osi_cred.c | 4 + src/afs/LINUX/osi_file.c | 38 ++++ src/afs/LINUX/osi_misc.c | 47 ++++- src/afs/LINUX/osi_module.c | 8 + src/afs/LINUX/osi_sleep.c | 8 + src/afs/LINUX/osi_vfs.h | 35 ++++ src/afs/LINUX/osi_vfsops.c | 55 +++++- src/afs/LINUX/osi_vnodeops.c | 328 ++++++++++++++++++++++++++++--- src/afs/Makefile | 2 +- src/afs/SOLARIS/osi_inode.c | 6 +- src/afs/SOLARIS/osi_vfsops.c | 2 + src/afs/VNOPS/afs_vnop_flock.c | 6 +- src/afs/afs_analyze.c | 3 + src/afs/afs_cell.c | 3 + src/afs/afs_conn.c | 3 + src/afs/afs_server.c | 7 + src/afs/afs_user.c | 3 + src/afs/afs_util.c | 3 + src/afs/afs_vcache.c | 28 ++- src/afs/afs_volume.c | 3 + src/afsd/Makefile | 2 + src/afsd/afsd.c | 4 +- src/comerr/Makefile | 2 +- src/config/NTMakefile.i386_nt40 | 3 +- src/config/afs_sysnames.h | 8 + src/des/andrew-conf.h | 4 + src/libafs/MakefileProto.SOLARIS | 16 +- src/lwp/Makefile | 2 +- src/lwp/process.c | 4 + src/rx/LINUX/rx_kmutex.h | 26 ++- src/rx/LINUX/rx_knet.c | 7 + src/rx/Makefile | 4 +- src/rx/SOLARIS/rx_knet.c | 3 + src/venus/kdump.c | 5 + 35 files changed, 635 insertions(+), 55 deletions(-) diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index f88188e8a..ab0352d63 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -45,10 +45,14 @@ unsigned int afs_linux_hash_verify_count = 0; /* used by hash_verify */ struct afs_lhash_stat afs_linux_lsb; /* hash table statistics */ unsigned int afs_linux_hash_bucket_dist[MAX_BUCKET_LEN]; /* bucket population distribution in our hash table */ +#if defined(AFS_LINUX24_ENV) +#include "../h/vmalloc.h" +#else /* externs : can we do this in a better way. Including vmalloc.h causes other * problems.*/ extern void vfree(void * addr); extern void *vmalloc(unsigned long size); +#endif /* Allocator support functions (static) */ @@ -249,7 +253,11 @@ static void get_hash_stats() /************** Linux memory allocator interface functions **********/ +#if defined(AFS_LINUX24_ENV) +DECLARE_MUTEX(afs_linux_alloc_sem); +#else struct semaphore afs_linux_alloc_sem = MUTEX; +#endif void *osi_linux_alloc(unsigned int asize) { diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c index 32065f66d..f452e030a 100644 --- a/src/afs/LINUX/osi_cred.c +++ b/src/afs/LINUX/osi_cred.c @@ -27,7 +27,11 @@ int ncreds_inuse = 0; * Also assuming a fast path through both down and up if no waiters. Otherwise, * test if no creds in pool before grabbing lock in crfree(). */ +#if defined(AFS_LINUX24_ENV) +static DECLARE_MUTEX(linux_cred_pool_lock); +#else static struct semaphore linux_cred_pool_lock = MUTEX; +#endif #define CRED_LOCK() down(&linux_cred_pool_lock) #define CRED_UNLOCK() up(&linux_cred_pool_lock) diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index 25cb2db9d..bb57725ac 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -11,6 +11,7 @@ #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ #include "../afs/afs_stats.h" /* afs statistics */ +#include "../h/smp_lock.h" int afs_osicred_initialized=0; @@ -54,7 +55,11 @@ void *osi_UFSOpen(ainode) FILE_INODE(filp) = tip; tip->i_flags |= MS_NOATIME; /* Disable updating access times. */ filp->f_flags = O_RDWR; +#if defined(AFS_LINUX24_ENV) + filp->f_op = fops_get(tip->i_fop); +#else filp->f_op = tip->i_op->default_file_ops; +#endif if (filp->f_op && filp->f_op->open) code = filp->f_op->open(tip, filp); if (code) @@ -99,6 +104,33 @@ osi_UFSClose(afile) return 0; } +#if defined(AFS_LINUX24_ENV) +int osi_notify_change(struct dentry * dentry, struct iattr * attr) +{ + struct inode *inode = dentry->d_inode; + int error; + time_t now = CURRENT_TIME; + unsigned int ia_valid = attr->ia_valid; + + attr->ia_ctime = now; + if (!(ia_valid & ATTR_ATIME_SET)) + attr->ia_atime = now; + if (!(ia_valid & ATTR_MTIME_SET)) + attr->ia_mtime = now; + + lock_kernel(); + if (inode && inode->i_op && inode->i_op->setattr) + error = inode->i_op->setattr(dentry, attr); + else { + error = inode_change_ok(inode, attr); + if (!error) + inode_setattr(inode, attr); + } + unlock_kernel(); + return error; +} +#endif + osi_UFSTruncate(afile, asize) register struct osi_file *afile; afs_int32 asize; { @@ -118,6 +150,11 @@ osi_UFSTruncate(afile, asize) MObtainWriteLock(&afs_xosi,321); AFS_GUNLOCK(); down(&inode->i_sem); +#if defined(AFS_LINUX24_ENV) + newattrs.ia_size = asize; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; + code = osi_notify_change(&afile->dentry, &newattrs); +#else inode->i_size = newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) { @@ -128,6 +165,7 @@ osi_UFSTruncate(afile, asize) if (inode->i_op && inode->i_op->truncate) inode->i_op->truncate(inode); } +#endif code = -code; up(&inode->i_sem); AFS_GLOCK(); diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 0194d4d7f..edda974af 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -22,17 +22,40 @@ char *crash_addr = 0; /* Induce an oops by writing here. */ int osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t **dirvpp, struct dentry **dpp) { +#if defined(AFS_LINUX24_ENV) + struct nameidata nd; +#else struct dentry *dp = NULL; +#endif int code; code = ENOENT; +#if defined(AFS_LINUX24_ENV) + if (seg == AFS_UIOUSER) { + code = followlink ? + user_path_walk(aname, &nd) : user_path_walk_link(aname, &nd); + } + else { + if (path_init(aname, followlink ? LOOKUP_FOLLOW : 0, &nd)) + code = path_walk(aname, &nd); + } + + if (!code) { + if (nd.dentry->d_inode) { + *dpp = nd.dentry; + code = 0; + } + else + path_release(&nd); + } +#else if (seg == AFS_UIOUSER) { dp = followlink ? namei(aname) : lnamei(aname); } else { dp = lookup_dentry(aname, NULL, followlink ? 1 : 0); } - + if (dp && !IS_ERR(dp)) { if (dp->d_inode) { *dpp = dp; @@ -41,6 +64,7 @@ int osi_lookupname(char *aname, uio_seg_t seg, int followlink, else dput(dp); } +#endif return code; } @@ -262,9 +286,17 @@ void osi_linux_free_inode_pages(void) for (i=0; ihnext) { ip = (struct inode*)tvc; +#if defined(AFS_LINUX24_ENV) + if (ip->i_data.nrpages) { +#else if (ip->i_nrpages) { +#endif invalidate_inode_pages(ip); +#if defined(AFS_LINUX24_ENV) + if (ip->i_data.nrpages) { +#else if (ip->i_nrpages) { +#endif printf("Failed to invalidate all pages on inode 0x%x\n", ip); } @@ -283,13 +315,26 @@ void osi_iput(struct inode *ip) extern struct vfs *afs_globalVFS; +#if defined(AFS_LINUX24_ENV) + if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) { +#else if (ip->i_count == 0 || ip->i_count & 0xffff0000) { +#endif osi_Panic("IPUT Bad refCount %d on inode 0x%x\n", +#if defined(AFS_LINUX24_ENV) + atomic_read(&ip->i_count), ip); +#else ip->i_count, ip); +#endif } if (afs_globalVFS && afs_globalVFS == ip->i_sb ) { +#if defined(AFS_LINUX24_ENV) + atomic_dec(&ip->i_count); + if (!atomic_read(&ip->i_count)) +#else ip->i_count --; if (!ip->i_count) +#endif afs_delete_inode(ip); } else { diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 79ca81143..5d29b43c5 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -31,7 +31,11 @@ extern struct file_system_type afs_file_system; static long get_page_offset(void); +#if defined(AFS_LINUX24_ENV) +DECLARE_MUTEX(afs_global_lock); +#else struct semaphore afs_global_lock = MUTEX; +#endif int afs_global_owner = 0; unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ @@ -96,6 +100,9 @@ void cleanup_module(void) static long get_page_offset(void) { +#if defined(AFS_PPC_LINUX22_ENV) + return PAGE_OFFSET; +#else struct task_struct *p; /* search backward thru the circular list */ @@ -104,4 +111,5 @@ static long get_page_offset(void) return p->addr_limit.seg; return 0; +#endif } diff --git a/src/afs/LINUX/osi_sleep.c b/src/afs/LINUX/osi_sleep.c index 82451ab1e..f1b75d89a 100644 --- a/src/afs/LINUX/osi_sleep.c +++ b/src/afs/LINUX/osi_sleep.c @@ -124,7 +124,11 @@ typedef struct afs_event { int seq; /* Sequence number: this is incremented by wakeup calls; wait will not return until it changes */ +#if defined(AFS_LINUX24_ENV) + wait_queue_head_t cond; +#else struct wait_queue *cond; +#endif } afs_event_t; #define HASHSIZE 128 @@ -156,7 +160,11 @@ static afs_event_t *afs_getevent(char *event) afs_evhashcnt++; newp->next = afs_evhasht[hashcode]; afs_evhasht[hashcode] = newp; +#if defined(AFS_LINUX24_ENV) + init_waitqueue_head(&newp->cond); +#else init_waitqueue(&newp->cond); +#endif newp->seq = 0; } newp->event = event; diff --git a/src/afs/LINUX/osi_vfs.h b/src/afs/LINUX/osi_vfs.h index 747846b94..74f7515b7 100644 --- a/src/afs/LINUX/osi_vfs.h +++ b/src/afs/LINUX/osi_vfs.h @@ -34,31 +34,63 @@ typedef struct vnode { uid_t i_uid; gid_t i_gid; kdev_t i_rdev; +#if defined(AFS_LINUX24_ENV) + loff_t i_size; +#else off_t i_size; +#endif time_t i_atime; time_t i_mtime; time_t i_ctime; unsigned long i_blksize; unsigned long i_blocks; unsigned long i_version; +#if !defined(AFS_LINUX24_ENV) unsigned long i_nrpages; +#endif struct semaphore i_sem; +#if defined(AFS_LINUX24_ENV) + struct semaphore i_zombie; +#else struct semaphore i_atomic_write; +#endif struct inode_operations *i_op; +#if defined(AFS_LINUX24_ENV) + struct file_operations *i_fop; +#endif struct super_block *i_sb; +#if defined(AFS_LINUX24_ENV) + wait_queue_head_t i_wait; +#else struct wait_queue *i_wait; +#endif struct file_lock *i_flock; +#if defined(AFS_LINUX24_ENV) + struct address_space *i_mapping; + struct address_space i_data; +#else struct vm_area_struct *i_mmap; struct page *i_pages; +#endif struct dquot *i_dquot[MAXQUOTAS]; +#if defined(AFS_LINUX24_ENV) + struct pipe_inode_info *i_pipe; + struct block_device *i_bdev; +#endif unsigned long i_state; unsigned int i_flags; +#if !defined(AFS_LINUX24_ENV) unsigned char i_pipe; +#endif unsigned char i_sock; +#if defined(AFS_LINUX24_ENV) + atomic_t i_writecount; +#else int i_writecount; +#endif unsigned int i_attr_flags; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) __u32 i_generation; @@ -93,6 +125,9 @@ typedef struct vnode { #define i_number i_ino #define v_count i_count #define v_op i_op +#if defined(AFS_LINUX24_ENV) +#define v_fop i_fop +#endif #define v_type i_mode #define v_vfsp i_sb #define vfs_vnodecovered s_covered diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index c04a20e0f..3e9faa1e1 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -17,6 +17,9 @@ #include "../afs/afsincludes.h" #include "../afs/afs_stats.h" #include "../h/locks.h" +#if defined(AFS_LINUX24_ENV) +#include "../h/smp_lock.h" +#endif #define __NO_VERSION__ /* don't define kernel_verion in module.h */ #include @@ -47,6 +50,9 @@ void put_inode_on_dummy_list(struct inode *ip); * 2) Mount call comes to us via do_mount -> read_super -> afs_read_super. * We are expected to setup the super_block. See afs_read_super. */ +#if defined(AFS_LINUX24_ENV) +DECLARE_FSTYPE(afs_file_system, "afs", afs_read_super, 0); +#else struct file_system_type afs_file_system = { "afs", /* name - used by mount operation. */ 0, /* requires_dev - no for network filesystems. mount() will @@ -54,6 +60,7 @@ struct file_system_type afs_file_system = { afs_read_super, /* wrapper to afs_mount */ NULL /* pointer to next file_system_type once registered. */ }; +#endif /* afs_read_super * read the "super block" for AFS - roughly eguivalent to struct vfs. @@ -72,7 +79,9 @@ struct super_block *afs_read_super(struct super_block *sb, void *data, afs_was_mounted = 1; /* Set basics of super_block */ +#if !defined(AFS_LINUX24_ENV) lock_super(sb); +#endif MOD_INC_USE_COUNT; afs_globalVFS = sb; @@ -84,7 +93,9 @@ struct super_block *afs_read_super(struct super_block *sb, void *data, if (code) MOD_DEC_USE_COUNT; +#if !defined(AFS_LINUX24_ENV) unlock_super(sb); +#endif AFS_GUNLOCK(); return code ? NULL : sb; @@ -110,13 +121,23 @@ static int afs_root(struct super_block *afsp) (struct vcache*)0, WRITE_LOCK); if (tvp) { extern struct inode_operations afs_dir_iops; +#if defined(AFS_LINUX24_ENV) + extern struct file_operations afs_dir_fops; +#endif /* "/afs" is a directory, reset inode ops accordingly. */ tvp->v.v_op = &afs_dir_iops; +#if defined(AFS_LINUX24_ENV) + tvp->v.v_fop = &afs_dir_fops; +#endif /* setup super_block and mount point inode. */ afs_globalVp = tvp; +#if defined(AFS_LINUX24_ENV) + afsp->s_root = d_alloc_root((struct inode*)tvp); +#else afsp->s_root = d_alloc_root((struct inode*)tvp, NULL); +#endif afsp->s_root->d_op = &afs_dentry_operations; } else code = ENOENT; @@ -212,15 +233,27 @@ void afs_delete_inode(struct inode *ip) struct vcache *vc = (struct vcache*)ip; AFS_GLOCK(); +#if defined(AFS_LINUX24_ENV) + lock_kernel(); + if (atomic_read(&ip->i_count) > 1) +#else if (ip->i_count > 1) +#endif printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip); ObtainWriteLock(&vc->lock, 504); afs_InactiveVCache(vc, credp); +#if defined(AFS_LINUX24_ENV) + atomic_set(&ip->i_count, 0); +#else ip->i_count = 0; +#endif ip->i_nlink = 0; /* iput checks this after calling this routine. */ ReleaseWriteLock(&vc->lock); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); } @@ -273,16 +306,22 @@ int afs_remount_fs(struct super_block *sbp, int *, char *) * statp is in user space, so we need to cobble together a statfs, then * copy it. */ +#if defined(AFS_LINUX24_ENV) +int afs_statfs(struct super_block *sbp, struct statfs *statp) +#else int afs_statfs(struct super_block *sbp, struct statfs *statp, int size) +#endif { struct statfs stat; AFS_STATCNT(afs_statfs); +#if !defined(AFS_LINUX24_ENV) if (size < sizeof(struct statfs)) return; memset(&stat, 0, size); +#endif stat.f_type = 0; /* Can we get a real type sometime? */ stat.f_bsize = sbp->s_blocksize; stat.f_blocks = stat.f_bfree = stat.f_bavail = stat.f_files = @@ -290,12 +329,25 @@ int afs_statfs(struct super_block *sbp, struct statfs *statp, int size) stat.f_fsid.val[0] = AFS_VFSMAGIC; stat.f_fsid.val[1] = AFS_VFSFSID; stat.f_namelen = 256; - + +#if defined(AFS_LINUX24_ENV) + *statp = stat; +#else memcpy_tofs(statp, &stat, size); +#endif return 0; } +#if defined(AFS_LINUX24_ENV) +struct super_operations afs_sops = { + read_inode: afs_read_inode, + write_inode: afs_write_inode, + delete_inode: afs_delete_inode, + put_super: afs_put_super, + statfs: afs_statfs, +}; +#else struct super_operations afs_sops = { afs_read_inode, afs_write_inode, /* afs_write_inode - see doc above. */ @@ -309,6 +361,7 @@ struct super_operations afs_sops = { NULL, /* afs_clear_inode */ NULL, /* afs_umount_begin */ }; +#endif /************** Support routines ************************/ diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index de2c51f6a..e5ce3dcb1 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -26,10 +26,18 @@ #include "../afs/afs_stats.h" #include "../h/mm.h" #include "../h/pagemap.h" +#if defined(AFS_LINUX24_ENV) +#include "../h/smp_lock.h" +#endif extern struct vcache *afs_globalVp; extern struct dentry_operations *afs_dops; +#if defined(AFS_LINUX24_ENV) +extern struct inode_operations afs_file_iops; +extern struct address_space_operations afs_file_aops; +struct address_space_operations afs_symlink_aops; +#endif extern struct inode_operations afs_dir_iops; extern struct inode_operations afs_symlink_iops; @@ -215,7 +223,11 @@ tagain: len = strlen(de->name); /* filldir returns -EINVAL when the buffer is full. */ - code = (*filldir)(dirbuf, de->name, len, offset, ino); +#ifdef AFS_LINUX24_ENV + code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_DIR); +#else + code = (*filldir)(dirbuf, de->name, len, offset, ino); +#endif DRelease(de, 0); if (code) break; @@ -301,10 +313,16 @@ static int afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) int code; AFS_GLOCK(); +#if defined(AFS_LINUX24_ENV) + afs_Trace3(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vcp, + ICL_TYPE_POINTER, vmap->vm_start, + ICL_TYPE_INT32, vmap->vm_end - vmap->vm_start); +#else afs_Trace4(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, vmap->vm_start, ICL_TYPE_INT32, vmap->vm_end - vmap->vm_start, ICL_TYPE_INT32, vmap->vm_offset); +#endif /* get a validated vcache entry */ code = afs_InitReq(&treq, credp); @@ -322,36 +340,38 @@ static int afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) AFS_GLOCK(); } - ObtainWriteLock(&vcp->lock,531); - /* Set out vma ops so we catch the close. The following test should be - * the same as used in generic_file_mmap. - */ - if ((vmap->vm_flags & VM_SHARED) && (vmap->vm_flags & VM_MAYWRITE)) { - if (!afs_shared_mmap_ops_inited) { - afs_shared_mmap_ops_inited = 1; - afs_shared_mmap_ops = *vmap->vm_ops; - afs_shared_mmap_ops.close = afs_linux_vma_close; + if (code == 0) { + ObtainWriteLock(&vcp->lock,531); + /* Set out vma ops so we catch the close. The following test should be + * the same as used in generic_file_mmap. + */ + if ((vmap->vm_flags & VM_SHARED) && (vmap->vm_flags & VM_MAYWRITE)) { + if (!afs_shared_mmap_ops_inited) { + afs_shared_mmap_ops_inited = 1; + afs_shared_mmap_ops = *vmap->vm_ops; + afs_shared_mmap_ops.close = afs_linux_vma_close; + } + vmap->vm_ops = &afs_shared_mmap_ops; } - vmap->vm_ops = &afs_shared_mmap_ops; - } - else { - if (!afs_private_mmap_ops_inited) { - afs_private_mmap_ops_inited = 1; - afs_private_mmap_ops = *vmap->vm_ops; - afs_private_mmap_ops.close = afs_linux_vma_close; + else { + if (!afs_private_mmap_ops_inited) { + afs_private_mmap_ops_inited = 1; + afs_private_mmap_ops = *vmap->vm_ops; + afs_private_mmap_ops.close = afs_linux_vma_close; + } + vmap->vm_ops = &afs_private_mmap_ops; } - vmap->vm_ops = &afs_private_mmap_ops; - } - /* Add an open reference on the first mapping. */ - if (vcp->mapcnt == 0) { - vcp->execsOrWriters++; - vcp->opens++; - vcp->states |= CMAPPED; + /* Add an open reference on the first mapping. */ + if (vcp->mapcnt == 0) { + vcp->execsOrWriters++; + vcp->opens++; + vcp->states |= CMAPPED; + } + ReleaseWriteLock(&vcp->lock); + vcp->mapcnt++; } - ReleaseWriteLock(&vcp->lock); - vcp->mapcnt++; AFS_GUNLOCK(); crfree(credp); @@ -364,7 +384,13 @@ int afs_linux_open(struct inode *ip, struct file *fp) cred_t *credp = crref(); AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif code = afs_open((struct vcache**)&ip, fp->f_flags, credp); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); @@ -385,26 +411,42 @@ static int afs_linux_release(struct inode *ip, struct file *fp) struct vcache *vcp = (struct vcache*)ip; AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif if (vcp->flushcnt) { vcp->flushcnt--; /* protected by AFS global lock. */ } else { code = afs_close(vcp, fp->f_flags, credp); } +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); return -code; } +#if defined(AFS_LINUX24_ENV) +static int afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync) +#else static int afs_linux_fsync(struct file *fp, struct dentry *dp) +#endif { int code; struct inode *ip = FILE_INODE(fp); cred_t *credp = crref(); AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif code = afs_fsync((struct vcache*)ip, credp); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); return -code; @@ -464,7 +506,11 @@ int afs_linux_flush(struct file *fp) cred_t *credp; /* Only do this on the last close of the file pointer. */ +#if defined(AFS_LINUX24_ENV) + if (atomic_read(&fp->f_count) > 1) +#else if (fp->f_count > 1) +#endif return 0; credp = crref(); @@ -486,6 +532,15 @@ int afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) +#if defined(AFS_LINUX24_ENV) +struct file_operations afs_dir_fops = { + read: generic_read_dir, + readdir: afs_linux_readdir, + ioctl: afs_xioctl, + open: afs_linux_open, + release: afs_linux_release, +}; +#else struct file_operations afs_dir_fops = { NULL, /* afs_linux_lseek */ afs_linux_dir_read, @@ -503,7 +558,21 @@ struct file_operations afs_dir_fops = { NULL, /* afs_linux_file_revalidate */ afs_linux_lock, }; +#endif +#if defined(AFS_LINUX24_ENV) +struct file_operations afs_file_fops = { + read: afs_linux_read, + write: afs_linux_write, + ioctl: afs_xioctl, + mmap: afs_linux_mmap, + open: afs_linux_open, + flush: afs_linux_flush, + release: afs_linux_release, + fsync: afs_linux_fsync, + lock: afs_linux_lock, +}; +#else struct file_operations afs_file_fops = { NULL, /* afs_linux_lseek */ afs_linux_read, @@ -521,6 +590,7 @@ struct file_operations afs_file_fops = { NULL, /* afs_linux_file_revalidate */ afs_linux_lock, }; +#endif /********************************************************************** @@ -538,9 +608,15 @@ static int afs_linux_revalidate(struct dentry *dp) struct vcache *vcp = (struct vcache*)dp->d_inode; AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif /* If it's a negative dentry, then there's nothing to do. */ if (!vcp) { +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); return 0; } @@ -550,6 +626,9 @@ static int afs_linux_revalidate(struct dentry *dp) if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */ check_bad_parent(dp); /* check and correct mvid */ vcache2inode(vcp); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); return 0; } @@ -559,6 +638,9 @@ static int afs_linux_revalidate(struct dentry *dp) if (!code) code = afs_VerifyVCache(vcp, &treq); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); @@ -584,9 +666,15 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) struct vcache *vcp = (struct vcache*)dp->d_inode; AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif /* If it's a negative dentry, then there's nothing to do. */ if (!vcp) { +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); return 0; } @@ -596,6 +684,9 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */ check_bad_parent(dp); /* check and correct mvid */ vcache2inode(vcp); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); return 0; } @@ -605,6 +696,9 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) if (!code) code = afs_VerifyVCache(vcp, &treq); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); @@ -614,16 +708,36 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) /* afs_dentry_iput */ static void afs_dentry_iput(struct dentry *dp, struct inode *ip) { +#if defined(AFS_LINUX24_ENV) + if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) { +#else if (ip->i_count == 0 || ip->i_count & 0xffff0000) { +#endif osi_Panic("Bad refCount %d on inode 0x%x\n", +#if defined(AFS_LINUX24_ENV) + atomic_read(&ip->i_count), ip); +#else ip->i_count, ip); +#endif } +#if defined(AFS_LINUX24_ENV) + atomic_dec(&ip->i_count); + if (!atomic_read(&ip->i_count)) { +#else ip->i_count --; if (!ip->i_count) { +#endif afs_delete_inode(ip); } } +#if defined(AFS_LINUX24_ENV) +struct dentry_operations afs_dentry_operations = { + d_revalidate: afs_linux_dentry_revalidate, + d_iput: afs_dentry_iput, +}; +struct dentry_operations *afs_dops = &afs_dentry_operations; +#else struct dentry_operations afs_dentry_operations = { afs_linux_dentry_revalidate, /* d_validate(struct dentry *) */ NULL, /* d_hash */ @@ -633,6 +747,7 @@ struct dentry_operations afs_dentry_operations = { afs_dentry_iput /* d_iput(struct dentry *, struct inode *) */ }; struct dentry_operations *afs_dops = &afs_dentry_operations; +#endif /********************************************************************** * AFS Linux inode operations @@ -665,10 +780,26 @@ int afs_linux_create(struct inode *dip, struct dentry *dp, int mode) if (!code) { vattr2inode(ip, &vattr); /* Reset ops if symlink or directory. */ +#if defined(AFS_LINUX24_ENV) + if (S_ISREG(ip->i_mode)) { + ip->i_op = &afs_file_iops; + ip->i_fop = &afs_file_fops; + ip->i_data.a_ops = &afs_file_aops; + } else if (S_ISDIR(ip->i_mode)) { + ip->i_op = &afs_dir_iops; + ip->i_fop = &afs_dir_fops; + } else if (S_ISLNK(ip->i_mode)) { + ip->i_op = &afs_symlink_iops; + ip->i_data.a_ops = &afs_symlink_aops; + ip->i_mapping = &ip->i_data; + } else + printk("afs_linux_create: FIXME\n"); +#else if (S_ISDIR(ip->i_mode)) ip->i_op = &afs_dir_iops; else if (S_ISLNK(ip->i_mode)) ip->i_op = &afs_symlink_iops; +#endif dp->d_op = afs_dops; d_instantiate(dp, ip); @@ -696,10 +827,26 @@ int afs_linux_lookup(struct inode *dip, struct dentry *dp) if (vcp) { struct inode *ip = (struct inode*)vcp; /* Reset ops if symlink or directory. */ +#if defined(AFS_LINUX24_ENV) + if (S_ISREG(ip->i_mode)) { + ip->i_op = &afs_file_iops; + ip->i_fop = &afs_file_fops; + ip->i_data.a_ops = &afs_file_aops; + } else if (S_ISDIR(ip->i_mode)) { + ip->i_op = &afs_dir_iops; + ip->i_fop = &afs_dir_fops; + } else if (S_ISLNK(ip->i_mode)) { + ip->i_op = &afs_symlink_iops; + ip->i_data.a_ops = &afs_symlink_aops; + ip->i_mapping = &ip->i_data; + } else + printk("afs_linux_lookup: FIXME\n"); +#else if (S_ISDIR(ip->i_mode)) ip->i_op = &afs_dir_iops; else if (S_ISLNK(ip->i_mode)) ip->i_op = &afs_symlink_iops; +#endif } dp->d_op = afs_dops; d_add(dp, (struct inode*)vcp); @@ -753,7 +900,11 @@ int afs_linux_unlink(struct inode *dip, struct dentry *dp) if (!list_empty(&dp->d_hash)) { d_drop(dp); /* Install a definite non-existence if we're the only user. */ +#if defined(AFS_LINUX24_ENV) + if (atomic_read(&dp->d_count) == 1) +#else if (dp->d_count == 1) +#endif putback = 1; } @@ -807,6 +958,9 @@ int afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) if (tvcp) { tvcp->v.v_op = &afs_dir_iops; +#if defined(AFS_LINUX24_ENV) + tvcp->v.v_fop = &afs_dir_fops; +#endif dp->d_op = afs_dops; d_instantiate(dp, (struct inode*)tvcp); } @@ -897,6 +1051,7 @@ static int afs_linux_ireadlink(struct inode *ip, char *target, int maxlen, return -code; } +#if !defined(AFS_LINUX24_ENV) /* afs_linux_readlink * Fill target (which is in user space) with contents of symlink. */ @@ -923,7 +1078,6 @@ struct dentry * afs_linux_follow_link(struct dentry *dp, char *name; struct dentry *res; - AFS_GLOCK(); name = osi_Alloc(PATH_MAX+1); if (!name) { @@ -949,6 +1103,7 @@ struct dentry * afs_linux_follow_link(struct dentry *dp, AFS_GUNLOCK(); return res; } +#endif /* afs_linux_readpage * all reads come through here. A strategy-like read call. @@ -973,9 +1128,20 @@ int afs_linux_readpage(struct file *fp, struct page *pp) set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */ clear_bit(PG_error, &pp->flags); +#if defined(AFS_LINUX24_ENV) + setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT, + PAGESIZE, UIO_READ, AFS_UIOSYS); +#else setup_uio(&tuio, &iovec, (char*)address, pp->offset, PAGESIZE, UIO_READ, AFS_UIOSYS); +#endif +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif if (!code) { if (tuio.uio_resid) /* zero remainder of page */ @@ -999,7 +1165,7 @@ int afs_linux_readpage(struct file *fp, struct page *pp) } #ifdef NOTUSED -/* afs_linux_writepage - is this used anywhere? */ +/* afs_linux_writepage - is this used anywhere? swap files via nfs? */ int afs_linux_writepage(struct inode *ip, struct page *) { return -EINVAL }; /* afs_linux_bmap - supports generic_readpage, but we roll our own. */ @@ -1060,12 +1226,21 @@ int afs_linux_updatepage(struct file *fp, struct page *pp, credp = crref(); AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, 99999); +#if defined(AFS_LINUX24_ENV) + setup_uio(&tuio, &iovec, page_addr + offset, + (pp->index << PAGE_CACHE_SHIFT) + offset, count, + UIO_WRITE, AFS_UIOSYS); +#else setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count, UIO_WRITE, AFS_UIOSYS); +#endif code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); @@ -1077,6 +1252,9 @@ int afs_linux_updatepage(struct file *fp, struct page *pp, ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, code); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif AFS_GUNLOCK(); crfree(credp); @@ -1084,8 +1262,42 @@ int afs_linux_updatepage(struct file *fp, struct page *pp, return code; } +#if defined(AFS_LINUX24_ENV) +static int afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to) +{ + long status; + loff_t pos = ((loff_t)page->index<mapping->host; + char *p = (char *)kmap(page); + int code; + + AFS_GLOCK(); + lock_kernel(); + code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS); + unlock_kernel(); + AFS_GUNLOCK(); + + if (code<0) + goto fail; + p[code] = '\0'; /* null terminate? */ + SetPageUptodate(page); + kunmap(page); + UnlockPage(page); + return 0; + +fail: + SetPageError(page); + kunmap(page); + UnlockPage(page); + return code; +} + +struct address_space_operations afs_symlink_aops = { + readpage: afs_symlink_filler +}; + +struct inode_operations afs_symlink_iops = { + readlink: page_readlink, + follow_link: page_follow_link, + setattr: afs_notify_change, +}; +#else struct inode_operations afs_symlink_iops = { NULL, /* file operations */ NULL, /* create */ @@ -1162,3 +1429,4 @@ struct inode_operations afs_symlink_iops = { NULL, /* updatepage */ afs_linux_revalidate, /* tho the code appears to indicate not used? */ }; +#endif diff --git a/src/afs/Makefile b/src/afs/Makefile index aa9f848e0..a73f40f7b 100644 --- a/src/afs/Makefile +++ b/src/afs/Makefile @@ -32,7 +32,7 @@ kinstall: AFS_component_version_number.c case ${SYS_NAME} in \ sgi_* ) \ gencat -m afszcm.cat afs_trace.msf ;; \ - i386_linux* ) \ + *_linux* ) \ gencat --new afszcm.cat afs_trace.msf ;; \ * ) \ gencat afszcm.cat afs_trace.msf ;; \ diff --git a/src/afs/SOLARIS/osi_inode.c b/src/afs/SOLARIS/osi_inode.c index 6982a43e8..306b282fa 100644 --- a/src/afs/SOLARIS/osi_inode.c +++ b/src/afs/SOLARIS/osi_inode.c @@ -39,7 +39,11 @@ getinode(vfsp, dev, inode, ipp, credp,perror) *perror = 0; - if (!vfsp && !(vfsp = vfs_devsearch(dev))) { + if (!vfsp +#if !defined(AFS_SUN58_ENV) + && !(vfsp = vfs_devsearch(dev)) +#endif + ) { return (ENODEV); } if (code = (*ufs_igetp)(vfsp, inode, &ip, credp)) { diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index e9b25fa4f..343df6dc5 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -433,7 +433,9 @@ _init() #else read_binding_file(sysbind, sb_hashtab); #endif +#if !defined(AFS_SUN58_ENV) make_syscallname("afs", AFS_SYSCALL); +#endif if (sysent[AFS_SYSCALL].sy_call == nosys) { if ((sysn = mod_getsysname(AFS_SYSCALL)) != NULL) { diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 797f9815e..518186300 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -511,7 +511,7 @@ struct AFS_UCRED *acred; { acmd = F_SETLK; } #endif -#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) +#if (defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)) && !defined(AFS_SUN58_ENV) if ((acmd == F_GETLK) || (acmd == F_RGETLK)) { #else if (acmd == F_GETLK) { @@ -525,7 +525,7 @@ struct AFS_UCRED *acred; { return code; } else if ((acmd == F_SETLK) || (acmd == F_SETLKW) -#if defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV) +#if (defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)) && !defined(AFS_SUN58_ENV) || (acmd == F_RSETLK)|| (acmd == F_RSETLKW)) { #else ) { @@ -548,7 +548,7 @@ struct AFS_UCRED *acred; { else if (af->l_type == F_UNLCK) code = LOCK_UN; else return EINVAL; /* unknown lock type */ if (((acmd == F_SETLK) -#if defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) +#if (defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV)) && !defined(AFS_SUN58_ENV) || (acmd == F_RSETLK) #endif ) && code != LOCK_UN) diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c index a17c0149a..32bfc5cba 100644 --- a/src/afs/afs_analyze.c +++ b/src/afs/afs_analyze.c @@ -36,6 +36,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afs/afs_cell.c b/src/afs/afs_cell.c index 9bb5046ff..2b271e1b5 100644 --- a/src/afs/afs_cell.c +++ b/src/afs/afs_cell.c @@ -32,6 +32,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index c57216ab7..16bc447e7 100644 --- a/src/afs/afs_conn.c +++ b/src/afs/afs_conn.c @@ -32,6 +32,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 8fe31b417..e2ddf743b 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -51,6 +51,13 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +# include +# define ipif_local_addr ipif_lcl_addr +# ifndef V4_PART_OF_V6 +# define V4_PART_OF_V6(v6) v6.s6_addr32[3] +# endif +# endif #include #endif diff --git a/src/afs/afs_user.c b/src/afs/afs_user.c index 65aaeaced..18c317d57 100644 --- a/src/afs/afs_user.c +++ b/src/afs/afs_user.c @@ -32,6 +32,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afs/afs_util.c b/src/afs/afs_util.c index b1e1a4b99..4d22160ad 100644 --- a/src/afs/afs_util.c +++ b/src/afs/afs_util.c @@ -34,6 +34,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index aa24dafbb..385374ce2 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -585,22 +585,37 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, struct list_head *cur; struct list_head *head = &ip->i_dentry; int all = 1; - retry: + restart: +#if defined(AFS_LINUX24_ENV) + spin_lock(&dcache_lock); +#endif cur = head; while ((cur = cur->next) != head) { struct dentry *dentry = list_entry(cur, struct dentry, d_alias); +#if defined(AFS_LINUX24_ENV) + if (!atomic_read(&dentry->d_count)) { +#else if (!dentry->d_count) { +#endif AFS_GUNLOCK(); +#if defined(AFS_LINUX24_ENV) + dget_locked(dentry); + spin_unlock(&dcache_lock); +#else dget(dentry); +#endif d_drop(dentry); dput(dentry); AFS_GLOCK(); - goto retry; + goto restart; } else { all = 0; } } +#if defined(AFS_LINUX24_ENV) + spin_unlock(&dcache_lock); +#endif if (all) vn --; } } @@ -904,8 +919,17 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, { struct inode *ip = (struct inode*)tvc; sema_init(&ip->i_sem, 1); +#if defined(AFS_LINUX24_ENV) + sema_init(&ip->i_zombie, 1); + init_waitqueue_head(&ip->i_wait); + spin_lock_init(&ip->i_data.i_shared_lock); + INIT_LIST_HEAD(&ip->i_data.pages); + ip->i_data.host = (void*) ip; + ip->i_mapping = &ip->i_data; +#else sema_init(&ip->i_atomic_write, 1); init_waitqueue(&ip->i_wait); +#endif INIT_LIST_HEAD(&ip->i_hash); INIT_LIST_HEAD(&ip->i_dentry); if (afs_globalVFS) { diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 909a48c4b..427e31563 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -37,6 +37,9 @@ #if defined(AFS_SUN56_ENV) #include #include +#if defined(AFS_SUN58_ENV) +#include +#endif #include #endif diff --git a/src/afsd/Makefile b/src/afsd/Makefile index d748260f5..debf72594 100644 --- a/src/afsd/Makefile +++ b/src/afsd/Makefile @@ -88,6 +88,8 @@ install: all ${INSTALL} -f afs.rc.solaris ${DESTDIR}root.client/usr/vice/etc/modload/afs.rc ;;\ sun4x_57 ) \ ${INSTALL} -f afs.rc.solaris.2.7 ${DESTDIR}root.client/usr/vice/etc/modload/afs.rc ;;\ + sun4x_58 ) \ + ${INSTALL} -f afs.rc.solaris.2.8 ${DESTDIR}root.client/usr/vice/etc/modload/afs.rc ;;\ sun4x_5? ) \ ${INSTALL} -f afs.rc.solaris.2_5 ${DESTDIR}root.client/usr/vice/etc/modload/afs.rc ;;\ alpha_osf* ) \ diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index fb311f1f0..57eb222c9 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -1368,7 +1368,7 @@ mainproc(as, arock) #endif #else #ifdef AFS_SUN5_ENV - if ((mount("",cacheMountDir,mountFlags,"afs", (char *)0, 0)) < 0) { + if ((mount("AFS",cacheMountDir,mountFlags,"afs", (char *)0, 0)) < 0) { #else #if defined(AFS_SGI_ENV) mountFlags = MS_FSS; @@ -1464,7 +1464,7 @@ char **argv; { #endif static int HandleMTab() { -#if defined (AFS_SUN_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) +#if (defined (AFS_SUN_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)) && !defined(AFS_SUN58_ENV) FILE *tfilep; #ifdef AFS_SUN5_ENV char tbuf[16]; diff --git a/src/comerr/Makefile b/src/comerr/Makefile index b1625c49b..d0575c64e 100644 --- a/src/comerr/Makefile +++ b/src/comerr/Makefile @@ -86,7 +86,7 @@ doc: com_err.dvi # compile_et: compile_et.o error_table.o case $(SYS_NAME) in \ - i386_linux* ) \ + *_linux* ) \ ${CC} ${CFLAGS} -o compile_et compile_et.o error_table.o ${utilib};; \ * ) \ ${CC} ${CFLAGS} -o compile_et compile_et.o error_table.o ${utilib} -ll;; \ diff --git a/src/config/NTMakefile.i386_nt40 b/src/config/NTMakefile.i386_nt40 index 638eb7269..c7707a50b 100644 --- a/src/config/NTMakefile.i386_nt40 +++ b/src/config/NTMakefile.i386_nt40 @@ -144,7 +144,8 @@ afscdefs =\ -I$(DESTDIR)\include\afs \ -I$(DESTDIR)\include\rx \ -DWIN32_LEAN_AND_MEAN \ - -DSTRICT + -DSTRICT \ + -D_WIN32_IE=0x0400 afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES) diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 4c25810bb..33d64d40b 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -77,6 +77,7 @@ #define SYS_NAME_ID_sunx86_56 936 #define SYS_NAME_ID_sunx86_55 937 #define SYS_NAME_ID_sun4x_57 938 +#define SYS_NAME_ID_sun4x_58 939 #define SYS_NAME_ID_vax_ul4 1003 @@ -107,6 +108,13 @@ #define SYS_NAME_ID_i386_linux2 1500 #define SYS_NAME_ID_i386_linux22 1501 +#define SYS_NAME_ID_i386_linux24 1502 + +#define SYS_NAME_ID_ppc_linux2 1600 +#define SYS_NAME_ID_ppc_linux22 1601 +#define SYS_NAME_ID_ppc_linux24 1602 + + /* * Placeholder to keep system-wide standard flags since this file is included by all diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 9dbb4b622..5613adf65 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -41,7 +41,11 @@ #include "conf-winnt.h" #else #ifdef AFS_LINUX20_ENV +#ifdef AFS_PPC_LINUX20_ENV +#include "conf-ppc-linux.h" +#else #include "conf-i386-linux.h" +#endif #else Sorry, you lose. Figure out what the machine looks like and fix this file to include it. diff --git a/src/libafs/MakefileProto.SOLARIS b/src/libafs/MakefileProto.SOLARIS index 873062af4..666f5ef8f 100644 --- a/src/libafs/MakefileProto.SOLARIS +++ b/src/libafs/MakefileProto.SOLARIS @@ -34,7 +34,7 @@ CC = /opt/SUNWspro/bin/cc KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \ -DSYSV -dn ${ARCH_DEFS} - + KDEFS_32 = KDEFS_64 = -xarch=v9 @@ -42,17 +42,17 @@ KDEFS_64 = -xarch=v9 CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} # Name of directory to hold object files and libraries. - + KOBJ = MODLOAD - + KOBJ = MODLOAD32 MODLOAD64 # This tells Makefile.common to use it's single directory build target. - + COMPDIRS = single_compdir - + COMPDIRS = solaris_compdirs @@ -81,7 +81,7 @@ setup: ## This is the target for a Solaris 7. Here we build both the 32 bit and ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively - + ${COMPDIRS}: for t in ${KOBJ} ; do \ echo Building directory: $$t ; \ @@ -106,7 +106,7 @@ ${COMPDIRS}: LIBAFS = libafs.o LIBAFSNONFS = libafs.nonfs.o - + DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS} DEST_LIBAFSNONFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFSNONFS} @@ -130,7 +130,7 @@ ${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS) $(RM) -f $@ $(LD) -r -o $@ $(AFSAOBJS) ${AFSNONFSOBJS} - + MODLOADDIR = ${DESTDIR}root.client/usr/vice/etc/modload libafs: ${LIBAFSNONFS} diff --git a/src/lwp/Makefile b/src/lwp/Makefile index dda928744..cfacbe4fe 100644 --- a/src/lwp/Makefile +++ b/src/lwp/Makefile @@ -66,7 +66,7 @@ process.o : process.s process.c $(CC) -c -I${SRCDIR}include -KPIC -G0 process.s;; \ sgi_61 | sgi_62 | sgi_63 ) \ $(CC) -c ${XCFLAGS} -I${SRCDIR}include -KPIC -G0 process.s;; \ - hp* | i386_linux* | sgi_64 | sgi_65) \ + hp* | *_linux* | sgi_64 | sgi_65) \ ${CC} ${CFLAGS} -c process.c;; \ ncrx86_*) \ /usr/ccs/lib/cpp -P -I${SRCDIR}include process.s process.ss; \ diff --git a/src/lwp/process.c b/src/lwp/process.c index ad6e676c2..706752bdf 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -31,7 +31,11 @@ extern char PRE_Block; /* used in lwp.c and process.s */ #elif defined(AFS_HPUX_ENV) #define LWP_SP 1 #elif defined(AFS_LINUX20_ENV) +#if defined(AFS_PPC_LINUX20_ENV) +#define LWP_SP 0 +#else #define LWP_SP 4 +#endif #else Need offset to SP in jmp_buf for this platform. #endif diff --git a/src/rx/LINUX/rx_kmutex.h b/src/rx/LINUX/rx_kmutex.h index 66ed1c838..6a53dd110 100644 --- a/src/rx/LINUX/rx_kmutex.h +++ b/src/rx/LINUX/rx_kmutex.h @@ -39,8 +39,11 @@ typedef struct afs_kmutex { int owner; } afs_kmutex_t; +#if defined(AFS_LINUX24_ENV) +typedef wait_queue_head_t afs_kcondvar_t; +#else typedef struct wait_queue *afs_kcondvar_t; - +#endif static inline int MUTEX_ISMINE(afs_kmutex_t *l) { @@ -50,7 +53,11 @@ static inline int MUTEX_ISMINE(afs_kmutex_t *l) static inline void afs_mutex_init(afs_kmutex_t *l) { +#if defined(AFS_LINUX24_ENV) + init_MUTEX(&l->sem); +#else l->sem = MUTEX; +#endif l->owner = 0; } #define MUTEX_INIT(a,b,c,d) afs_mutex_init(a) @@ -85,7 +92,11 @@ static inline void MUTEX_EXIT(afs_kmutex_t *l) up(&l->sem); } +#if defined(AFS_LINUX24_ENV) +#define CV_INIT(cv,b,c,d) init_waitqueue_head((wait_queue_head_t *)(cv)) +#else #define CV_INIT(cv,b,c,d) init_waitqueue((struct wait_queue**)(cv)) +#endif #define CV_DESTROY(cv) /* CV_WAIT and CV_TIMEDWAIT rely on the fact that the Linux kernel has @@ -99,7 +110,11 @@ static inline CV_WAIT(afs_kcondvar_t *cv, afs_kmutex_t *l) if (isAFSGlocked) AFS_GUNLOCK(); MUTEX_EXIT(l); +#if defined(AFS_LINUX24_ENV) + interruptible_sleep_on((wait_queue_head_t *)cv); +#else interruptible_sleep_on((struct wait_queue**)cv); +#endif MUTEX_ENTER(l); if (isAFSGlocked) AFS_GLOCK(); @@ -115,7 +130,11 @@ static inline CV_TIMEDWAIT(afs_kcondvar_t *cv, afs_kmutex_t *l, int waittime) if (isAFSGlocked) AFS_GUNLOCK(); MUTEX_EXIT(l); +#if defined(AFS_LINUX24_ENV) + t = interruptible_sleep_on_timeout((wait_queue_head_t *)cv, t); +#else t = interruptible_sleep_on_timeout((struct wait_queue**)cv, t); +#endif MUTEX_ENTER(l); if (isAFSGlocked) AFS_GLOCK(); @@ -123,8 +142,13 @@ static inline CV_TIMEDWAIT(afs_kcondvar_t *cv, afs_kmutex_t *l, int waittime) return 0; } +#if defined(AFS_LINUX24_ENV) +#define CV_SIGNAL(cv) wake_up((wait_queue_head_t *)cv) +#define CV_BROADCAST(cv) wake_up((wait_queue_head_t *)cv) +#else #define CV_SIGNAL(cv) wake_up((struct wait_queue**)cv) #define CV_BROADCAST(cv) wake_up((struct wait_queue**)cv) +#endif #else diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index 9d3dcfa84..37a39f41f 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -15,6 +15,9 @@ #include "../afs/param.h" #ifdef AFS_LINUX22_ENV #include "../rx/rx_kcommon.h" +#if defined(AFS_LINUX24_ENV) +#include "../h/smp_lock.h" +#endif #include /* rxk_NewSocket @@ -38,7 +41,11 @@ struct osi_socket *rxk_NewSocket(short aport) code = sockp->ops->bind(sockp, (struct sockaddr*)&myaddr, sizeof(myaddr)); if (code<0) { +#if defined(AFS_LINUX24_ENV) + printk("sock_release(rx_socket) FIXME\n"); +#else sock_release(sockp); +#endif return NULL; } diff --git a/src/rx/Makefile b/src/rx/Makefile index afcc7efcc..44e2a0f49 100644 --- a/src/rx/Makefile +++ b/src/rx/Makefile @@ -39,7 +39,7 @@ LIBS = librx.a ${SRCDIR}lib/liblwp.a ${SRCDIR}lib/afs/libcmd.a \ LINK = ${CC} ${CFLAGS} -o $@ $@.o ${LIBS} ${SRCDIR}lib/afs/libsys.a ${XLIBS} KSRCS = rx.c rx.h rx_clock.c rx_clock.h rx_event.c rx_event.h \ - rx_globals.c rx_globals.h rx_kernel.h \ + rx_globals.c rx_globals.h rx_kernel.h rx_misc.h \ rx_null.c rx_null.h rx_queue.h rx_getaddr.c rx_packet.c rx_packet.h \ rx_multi.h rx_kcommon.h rx_kcommon.c \ xdr.c xdr.h xdr_array.c xdr_arrayn.c xdr_rx.c rx_misc.c rx_rdwr.c \ @@ -124,7 +124,7 @@ kinstall: includes $(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \ hp_ux* ) \ $(INSTALL) HPUX/*.[ch] $(KERNELDIR)rx;; \ - i386_linux* ) \ + *_linux* ) \ $(INSTALL) LINUX/*.[ch] $(KERNELDIR)rx;; \ rs_aix* ) \ $(INSTALL) AIX/*.[ch] $(KERNELDIR)rx;; \ diff --git a/src/rx/SOLARIS/rx_knet.c b/src/rx/SOLARIS/rx_knet.c index 254b8c7a9..c732bc914 100644 --- a/src/rx/SOLARIS/rx_knet.c +++ b/src/rx/SOLARIS/rx_knet.c @@ -21,6 +21,9 @@ #include "../sys/stream.h" #include "../sys/tihdr.h" #include "../sys/fcntl.h" +#ifdef AFS_SUN58_ENV +#include "../netinet/ip6.h" +#endif #include "../inet/ip.h" #include "../netinet/udp.h" diff --git a/src/venus/kdump.c b/src/venus/kdump.c index f270d8f9b..89d4c32f0 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -2423,8 +2423,13 @@ void print_vnode(kmem, vep, ptr, pnt) vep->i_nrpages); printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op, vep->i_dev, vep->i_rdev, vep->i_sb); +#ifdef AFS_LINUX24_ENV + printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n", + vep->i_sem.count, vep->i_sem.sleepers, vep->i_sem.wait); +#else printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count, vep->i_sem.waking, vep->i_sem.wait); +#endif printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n", vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev, vep->i_list.next, -- 2.39.5