From: Simon Wilkinson Date: Fri, 2 Oct 2009 10:51:52 +0000 (+0100) Subject: Remove pre-Linux 2.6 support X-Git-Tag: openafs-devel-1_5_66~126 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=109927bf6f54b58b76ac48ba41c2012c74937fed;hp=b7cc8bf2850c5650a9e47416af8bd488f9be9161 Remove pre-Linux 2.6 support This change removes support for kernels before Linux 2.6.0 from src/afs/LINUX. Older kernels should be supported by the src/afs/LINUX24 code. Reviewed-on: http://gerrit.openafs.org/567 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 30a69a5..62eb698 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -49,14 +49,7 @@ 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) */ @@ -284,11 +277,7 @@ get_hash_stats(void) /************** 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, int drop_glock) diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c index 3599aa3..266929c 100644 --- a/src/afs/LINUX/osi_cred.c +++ b/src/afs/LINUX/osi_cred.c @@ -42,9 +42,7 @@ crfree(cred_t * cr) return; } -#if defined(AFS_LINUX26_ENV) put_group_info(cr->cr_group_info); -#endif kfree(cr); } @@ -61,13 +59,8 @@ crdup(cred_t * cr) tmp->cr_gid = cr->cr_gid; tmp->cr_rgid = cr->cr_rgid; -#if defined(AFS_LINUX26_ENV) get_group_info(cr->cr_group_info); tmp->cr_group_info = cr->cr_group_info; -#else - memcpy(tmp->cr_groups, cr->cr_groups, NGROUPS * sizeof(gid_t)); - tmp->cr_ngroups = cr->cr_ngroups; -#endif return tmp; } @@ -82,23 +75,19 @@ crref(void) cr->cr_gid = current_fsgid(); cr->cr_rgid = current_gid(); -#if defined(AFS_LINUX26_ENV) task_lock(current); get_group_info(current_group_info()); cr->cr_group_info = current_group_info(); task_unlock(current); -#else - memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t)); - cr->cr_ngroups = current->ngroups; -#endif + return cr; } - /* Set the cred info into the current task */ void crset(cred_t * cr) { + struct group_info *old_info; #if defined(STRUCT_TASK_HAS_CRED) struct cred *new_creds; @@ -119,9 +108,6 @@ crset(cred_t * cr) current->fsgid = cr->cr_gid; current->gid = cr->cr_rgid; #endif -#if defined(AFS_LINUX26_ENV) -{ - struct group_info *old_info; /* using set_current_groups() will sort the groups */ get_group_info(cr->cr_group_info); @@ -139,8 +125,3 @@ crset(cred_t * cr) put_group_info(old_info); } -#else - memcpy(current->groups, cr->cr_groups, NGROUPS * sizeof(gid_t)); - current->ngroups = cr->cr_ngroups; -#endif -} diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index c2c7cc7..4a9187c 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -11,16 +11,12 @@ #include "afs/param.h" -#ifdef AFS_LINUX24_ENV #include "h/module.h" /* early to avoid printf->printk mapping */ -#endif #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* afs statistics */ #include "h/smp_lock.h" -#if defined(AFS_LINUX26_ENV) #include "h/namei.h" -#endif #if defined(LINUX_USE_FH) #include "h/exportfs.h" int cache_fh_type = -1; @@ -29,12 +25,9 @@ int cache_fh_len = -1; afs_lock_t afs_xosi; /* lock is for tvattr */ extern struct osi_dev cacheDev; -#if defined(AFS_LINUX24_ENV) extern struct vfsmount *afs_cacheMnt; -#endif extern struct super_block *afs_cacheSBp; -#if defined(AFS_LINUX26_ENV) struct file * afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint) { @@ -104,58 +97,6 @@ osi_UFSOpen(afs_dcache_id_t *ainode) afile->proc = (int (*)())0; return (void *)afile; } -#else -void * -osi_UFSOpen(afs_dcache_id_t *ainode) -{ - register struct osi_file *afile = NULL; - extern int cacheDiskType; - afs_int32 code = 0; - struct inode *tip = NULL; - struct file *filp = NULL; - AFS_STATCNT(osi_UFSOpen); - if (cacheDiskType != AFS_FCACHE_TYPE_UFS) { - osi_Panic("UFSOpen called for non-UFS cache\n"); - } - if (!afs_osicred_initialized) { - /* valid for alpha_osf, SunOS, Ultrix */ - memset((char *)&afs_osi_cred, 0, sizeof(AFS_UCRED)); - crhold(&afs_osi_cred); /* don't let it evaporate, since it is static */ - afs_osicred_initialized = 1; - } - afile = (struct osi_file *)osi_AllocLargeSpace(sizeof(struct osi_file)); - AFS_GUNLOCK(); - if (!afile) { - osi_Panic("osi_UFSOpen: Failed to allocate %d bytes for osi_file.\n", - sizeof(struct osi_file)); - } - memset(afile, 0, sizeof(struct osi_file)); - filp = &afile->file; - filp->f_dentry = &afile->dentry; - tip = iget(afs_cacheSBp, ainode->ufs); - if (!tip) - osi_Panic("Can't get inode %d\n", ainode->ufs); - 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_mode = FMODE_READ|FMODE_WRITE; - 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) - osi_Panic("Can't open inode %d\n", ainode->ufs); - afile->size = i_size_read(tip); - AFS_GLOCK(); - afile->offset = 0; - afile->proc = (int (*)())0; - afile->inum = ainode->ufs; /* for hint validity checking */ - return (void *)afile; -} -#endif #if defined(LINUX_USE_FH) /* @@ -204,23 +145,16 @@ void osi_get_fh(struct dentry *dp, afs_ufs_dcache_id_t *ainode) { int afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat) { - register afs_int32 code; AFS_STATCNT(osi_Stat); MObtainWriteLock(&afs_xosi, 320); astat->size = i_size_read(OSIFILE_INODE(afile)); -#if defined(AFS_LINUX26_ENV) astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec; astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec; -#else - astat->mtime = OSIFILE_INODE(afile)->i_mtime; - astat->atime = OSIFILE_INODE(afile)->i_atime; -#endif - code = 0; + MReleaseWriteLock(&afs_xosi); - return code; + return 0; } -#ifdef AFS_LINUX26_ENV int osi_UFSClose(register struct osi_file *afile) { @@ -234,24 +168,6 @@ osi_UFSClose(register struct osi_file *afile) osi_FreeLargeSpace(afile); return 0; } -#else -int -osi_UFSClose(register struct osi_file *afile) -{ - AFS_STATCNT(osi_Close); - if (afile) { - if (FILE_INODE(&afile->file)) { - struct file *filp = &afile->file; - if (filp->f_op && filp->f_op->release) - filp->f_op->release(FILE_INODE(filp), filp); - iput(FILE_INODE(filp)); - } - } - - osi_FreeLargeSpace(afile); - return 0; -} -#endif int osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize) @@ -281,7 +197,6 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize) #endif newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; -#if defined(AFS_LINUX24_ENV) newattrs.ia_ctime = CURRENT_TIME; /* avoid notify_change() since it wants to update dentry->d_parent */ @@ -289,11 +204,9 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize) code = inode_change_ok(inode, &newattrs); if (!code) { #ifdef INODE_SETATTR_NOT_VOID -#if defined(AFS_LINUX26_ENV) if (inode->i_op && inode->i_op->setattr) code = inode->i_op->setattr(afile->filp->f_dentry, &newattrs); else -#endif code = inode_setattr(inode, &newattrs); #else inode_setattr(inode, &newattrs); @@ -302,17 +215,6 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize) unlock_kernel(); if (!code) truncate_inode_pages(&inode->i_data, asize); -#else - i_size_write(inode, asize); - if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) { - code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs); - } - if (!code) { - truncate_inode_pages(inode, asize); - if (inode->i_op && inode->i_op->truncate) - inode->i_op->truncate(inode); - } -#endif code = -code; #ifdef STRUCT_INODE_HAS_I_MUTEX mutex_unlock(&inode->i_mutex); @@ -467,11 +369,7 @@ osi_InitCacheInfo(char *aname) int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) { -#ifdef AFS_LINUX26_ENV struct file *filp = osifile->filp; -#else - struct file *filp = &osifile->file; -#endif KERNEL_SPACE_DECL; int code = 0; struct iovec *iov; diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index bf9f8a0..f78562a 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -24,9 +24,7 @@ #include "afsincludes.h" #include "afs/afs_stats.h" /* statistics */ #include "afs/nfsclient.h" -#ifdef AFS_LINUX22_ENV #include "h/smp_lock.h" -#endif #ifdef AFS_LINUX26_ONEGROUP_ENV #define NUMPAGGROUPS 1 @@ -34,7 +32,6 @@ #define NUMPAGGROUPS 2 #endif -#if defined(AFS_LINUX26_ENV) static int afs_setgroups(cred_t **cr, struct group_info *group_info, int change_parent) { @@ -60,34 +57,9 @@ afs_setgroups(cred_t **cr, struct group_info *group_info, int change_parent) return (0); } -#else -static int -afs_setgroups(cred_t **cr, int ngroups, gid_t * gidset, int change_parent) -{ - int ngrps; - int i; - gid_t *gp; - - AFS_STATCNT(afs_setgroups); - - if (ngroups > NGROUPS) - return EINVAL; - - gp = (*cr)->cr_groups; - if (ngroups < NGROUPS) - gp[ngroups] = (gid_t) NOGROUP; - - for (i = ngroups; i > 0; i--) { - *gp++ = *gidset++; - } - - (*cr)->cr_ngroups = ngroups; - crset(*cr); - return (0); -} -#endif - -#if defined(AFS_LINUX26_ENV) +/* Returns number of groups. And we trust groups to be large enough to + * hold all the groups. + */ static struct group_info * afs_getgroups(cred_t * cr) { @@ -96,69 +68,7 @@ afs_getgroups(cred_t * cr) get_group_info(cr->cr_group_info); return cr->cr_group_info; } -#else -/* Returns number of groups. And we trust groups to be large enough to - * hold all the groups. - */ -static int -afs_getgroups(cred_t *cr, gid_t *groups) -{ - int i; - int n; - gid_t *gp; - - AFS_STATCNT(afs_getgroups); - - gp = cr->cr_groups; - n = cr->cr_ngroups; - - for (i = 0; (i < n) && (*gp != (gid_t) NOGROUP); i++) - *groups++ = *gp++; - return i; -} -#endif -#if !defined(AFS_LINUX26_ENV) -/* Only propogate the PAG to the parent process. Unix's propogate to - * all processes sharing the cred. - */ -int -set_pag_in_parent(int pag, int g0, int g1) -{ - int i; -#ifdef STRUCT_TASK_STRUCT_HAS_PARENT - gid_t *gp = current->parent->groups; - int ngroups = current->parent->ngroups; -#else - gid_t *gp = current->p_pptr->groups; - int ngroups = current->p_pptr->ngroups; -#endif - - if ((ngroups < 2) || (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG)) { - /* We will have to shift grouplist to make room for pag */ - if (ngroups + 2 > NGROUPS) { - return EINVAL; - } - for (i = ngroups - 1; i >= 0; i--) { - gp[i + 2] = gp[i]; - } - ngroups += 2; - } - gp[0] = g0; - gp[1] = g1; - if (ngroups < NGROUPS) - gp[ngroups] = NOGROUP; - -#ifdef STRUCT_TASK_STRUCT_HAS_PARENT - current->parent->ngroups = ngroups; -#else - current->p_pptr->ngroups = ngroups; -#endif - return 0; -} -#endif - -#if defined(AFS_LINUX26_ENV) int __setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, int change_parent) @@ -288,46 +198,6 @@ out: } #endif /* LINUX_KEYRING_SUPPORT */ -#else -int -__setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, - int change_parent) -{ - gid_t *gidset; - afs_int32 ngroups, code = 0; - int j; - - gidset = (gid_t *) osi_Alloc(NGROUPS * sizeof(gidset[0])); - ngroups = afs_getgroups(*cr, gidset); - - if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) { - /* We will have to shift grouplist to make room for pag */ - if (ngroups + 2 > NGROUPS) { - osi_Free((char *)gidset, NGROUPS * sizeof(int)); - return EINVAL; - } - for (j = ngroups - 1; j >= 0; j--) { - gidset[j + 2] = gidset[j]; - } - ngroups += 2; - } - *newpag = (pagvalue == -1 ? genpag() : pagvalue); - afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]); - code = afs_setgroups(cr, ngroups, gidset, change_parent); - - /* If change_parent is set, then we should set the pag in the parent as - * well. - */ - if (change_parent && !code) { - code = set_pag_in_parent(*newpag, gidset[0], gidset[1]); - } - - osi_Free((char *)gidset, NGROUPS * sizeof(int)); - return code; -} -#endif - - int setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, int change_parent) @@ -403,7 +273,6 @@ afs_xsetgroups(int gidsetsize, gid_t * grouplist) return (-code); } -#if defined(AFS_LINUX24_ENV) /* Intercept the standard uid32 system call. */ extern asmlinkage long (*sys_setgroups32p) (int gidsetsize, gid_t * grouplist); asmlinkage long @@ -437,7 +306,6 @@ afs_xsetgroups32(int gidsetsize, gid_t * grouplist) /* Linux syscall ABI returns errno as negative */ return (-code); } -#endif #if defined(AFS_PPC64_LINUX20_ENV) /* Intercept the uid16 system call as used by 32bit programs. */ @@ -507,7 +375,6 @@ afs32_xsetgroups(int gidsetsize, u16 * grouplist) return (-code); } -#ifdef AFS_LINUX24_ENV /* Intercept the uid32 system call as used by 32bit programs. */ extern long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist); asmlinkage long @@ -541,7 +408,6 @@ afs32_xsetgroups32(int gidsetsize, gid_t * grouplist) return (-code); } #endif -#endif #ifdef LINUX_KEYRING_SUPPORT diff --git a/src/afs/LINUX/osi_ioctl.c b/src/afs/LINUX/osi_ioctl.c index a25cdb2..4100982 100644 --- a/src/afs/LINUX/osi_ioctl.c +++ b/src/afs/LINUX/osi_ioctl.c @@ -55,29 +55,13 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL; #ifdef NEED_IOCTL32 -#ifdef AFS_LINUX26_ENV -#ifdef AFS_S390X_LINUX26_ENV +# ifdef AFS_S390X_LINUX26_ENV if (test_thread_flag(TIF_31BIT)) -#elif AFS_AMD64_LINUX20_ENV +# elif AFS_AMD64_LINUX20_ENV if (test_thread_flag(TIF_IA32)) -#else +# else if (test_thread_flag(TIF_32BIT)) -#endif /* AFS_S390X_LINUX26_ENV */ -#else -#ifdef AFS_SPARC64_LINUX24_ENV - if (current->thread.flags & SPARC_FLAG_32BIT) -#elif defined(AFS_SPARC64_LINUX20_ENV) - if (current->tss.flags & SPARC_FLAG_32BIT) -#elif defined(AFS_AMD64_LINUX20_ENV) - if (current->thread.flags & THREAD_IA32) -#elif defined(AFS_PPC64_LINUX20_ENV) - if (current->thread.flags & PPC_FLAG_32BIT) -#elif defined(AFS_S390X_LINUX20_ENV) - if (current->thread.flags & S390_FLAG_31BIT) -#else -#error Not done for this linux type -#endif /* AFS_LINUX26_ENV */ -#endif /* NEED_IOCTL32 */ +# endif /* AFS_S390X_LINUX26_ENV */ { if (copy_from_user(&sysargs32, (void *)arg, sizeof(struct afsprocdata32))) @@ -89,7 +73,7 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, (unsigned long)sysargs32.param3, (unsigned long)sysargs32.param4); } else -#endif +#endif /* NEED_IOCTL32 */ { if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata))) return -EFAULT; diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index b0017ff..7baa995 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -164,12 +164,7 @@ typedef struct afs_cred { /* maps to task field: */ uid_t cr_ruid; /* uid */ gid_t cr_gid; /* egid */ gid_t cr_rgid; /* gid */ -#if defined(AFS_LINUX26_ENV) struct group_info *cr_group_info; -#else - gid_t cr_groups[NGROUPS]; /* 32 groups - empty set to NOGROUP */ - int cr_ngroups; -#endif struct afs_cred *cr_next; } cred_t; #define AFS_UCRED struct afs_cred @@ -221,26 +216,12 @@ typedef struct uio { /* Get/set the inode in the osifile struct. */ #define FILE_INODE(F) (F)->f_dentry->d_inode -#ifdef AFS_LINUX26_ENV #define OSIFILE_INODE(a) FILE_INODE((a)->filp) -#else -#define OSIFILE_INODE(a) FILE_INODE(&(a)->file) -#endif #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) #define NEED_IOCTL32 #endif -/* page offset is obtained and stored here during module initialization - * We need a variable to do this because, the PAGE_OFFSET macro defined in - * include/asm/page.h can change from kernel to kernel and we cannot use - * the hardcoded version. - */ -extern unsigned long afs_linux_page_offset; - -/* function to help with the page offset stuff */ -#define afs_linux_page_address(page) (afs_linux_page_offset + PAGE_SIZE * (page - mem_map)) - #if defined(__KERNEL__) #include #include diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index eef087f..4848d94 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -16,17 +16,13 @@ #include /* early to avoid printf->printk mapping */ -#if defined(AFS_LINUX26_ENV) #include "h/dcache.h" #include "h/namei.h" #include "h/kthread.h" -#endif #include "afs/sysincludes.h" #include "afsincludes.h" #include "afs/afs_stats.h" -#if defined(AFS_LINUX24_ENV) #include "h/smp_lock.h" -#endif int afs_osicred_initialized = 0; AFS_UCRED afs_osi_cred; @@ -34,34 +30,13 @@ AFS_UCRED afs_osi_cred; void afs_osi_SetTime(osi_timeval_t * tvp) { -#if defined(AFS_LINUX24_ENV) - -#if defined(AFS_LINUX26_ENV) struct timespec tv; tv.tv_sec = tvp->tv_sec; tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC; -#else - struct timeval tv; - tv.tv_sec = tvp->tv_sec; - tv.tv_usec = tvp->tv_usec; -#endif AFS_STATCNT(osi_SetTime); do_settimeofday(&tv); -#else - extern int (*sys_settimeofdayp) (struct timeval * tv, - struct timezone * tz); - - KERNEL_SPACE_DECL; - - AFS_STATCNT(osi_SetTime); - - TO_USER_SPACE(); - if (sys_settimeofdayp) - (void)(*sys_settimeofdayp) (tvp, NULL); - TO_KERNEL_SPACE(); -#endif } void @@ -73,7 +48,6 @@ osi_linux_mask(void) SIG_UNLOCK(current); } -#if defined(AFS_LINUX24_ENV) /* LOOKUP_POSITIVE is becoming the default */ #ifndef LOOKUP_POSITIVE #define LOOKUP_POSITIVE 0 @@ -90,12 +64,7 @@ osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt, if (followlink) flags |= LOOKUP_FOLLOW; -#if defined(AFS_LINUX26_ENV) code = path_lookup(aname, flags, &nd); -#else - if (path_init(aname, flags, &nd)) - code = path_walk(aname, &nd); -#endif if (!code) { #if defined(STRUCT_NAMEIDATA_HAS_PATH) @@ -133,37 +102,7 @@ osi_lookupname(char *aname, uio_seg_t seg, int followlink, } return code; } -#else -int -osi_lookupname(char *aname, uio_seg_t seg, int followlink, struct dentry **dpp) -{ - struct dentry *dp = NULL; - int code; - - code = ENOENT; - 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; - code = 0; - } else - dput(dp); - } - - return code; -} -#endif - -#ifdef AFS_LINUX26_ENV -/* This is right even for Linux 2.4, but on that version d_path is inline - * and implemented in terms of __d_path, which is not exported. - */ int osi_abspath(char *aname, char *buf, int buflen, int followlink, char **pathp) { @@ -216,4 +155,3 @@ void afs_start_thread(void (*proc)(void), char *name) { kthread_run(afs_thread_wrapper, proc, "%s", name); } -#endif diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index fa39a63..8cf1e50 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -30,63 +30,31 @@ #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include #include #include -#endif #include "osi_pagecopy.h" extern struct file_system_type afs_fs_type; -#if !defined(AFS_LINUX24_ENV) -static long get_page_offset(void); -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) DEFINE_MUTEX(afs_global_lock); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) -DECLARE_MUTEX(afs_global_lock); #else -struct semaphore afs_global_lock = MUTEX; +DECLARE_MUTEX(afs_global_lock); #endif int afs_global_owner = 0; -#if !defined(AFS_LINUX24_ENV) -unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) int __init afs_init(void) -#else -int -init_module(void) -#endif { int err; AFS_RWLOCK_INIT(&afs_xosi, "afs_xosi"); -#if !defined(AFS_LINUX24_ENV) - /* obtain PAGE_OFFSET value */ - afs_linux_page_offset = get_page_offset(); - -#ifndef AFS_S390_LINUX22_ENV - if (afs_linux_page_offset == 0) { - /* couldn't obtain page offset so can't continue */ - printf("afs: Unable to obtain PAGE_OFFSET. Exiting.."); - return -EIO; - } -#endif /* AFS_S390_LINUX22_ENV */ -#endif /* !defined(AFS_LINUX24_ENV) */ - osi_Init(); -#ifdef AFS_LINUX26_ENV #if !defined(AFS_NONFSTRANS) osi_linux_nfssrv_init(); #endif -#endif #ifndef LINUX_KEYRING_SUPPORT err = osi_syscall_init(); @@ -113,10 +81,8 @@ init_module(void) #ifdef LINUX_KEYRING_SUPPORT osi_keyring_init(); #endif -#ifdef AFS_LINUX24_ENV osi_proc_init(); osi_ioctl_init(); -#endif #if defined(AFS_CACHE_BYPASS) afs_warn("Cache bypass patched libafs module init.\n"); #endif @@ -125,13 +91,8 @@ init_module(void) return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) void __exit afs_cleanup(void) -#else -void -cleanup_module(void) -#endif { #if defined(AFS_CACHE_BYPASS) afs_warn("Cache bypass patched libafs module cleaning up.\n"); @@ -149,59 +110,18 @@ cleanup_module(void) unregister_filesystem(&afs_fs_type); afs_destroy_inodecache(); -#ifdef AFS_LINUX26_ENV #if !defined(AFS_NONFSTRANS) osi_linux_nfssrv_shutdown(); #endif -#endif osi_linux_free_afs_memory(); -#ifdef AFS_LINUX24_ENV osi_ioctl_clean(); osi_proc_clean(); -#endif return; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) MODULE_LICENSE("http://www.openafs.org/dl/license10.html"); module_init(afs_init); module_exit(afs_cleanup); -#endif - - -#if !defined(AFS_LINUX24_ENV) -static long -get_page_offset(void) -{ -#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV) || defined(AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) - return PAGE_OFFSET; -#else - struct task_struct *p, *q; - - /* search backward thru the circular list */ -#if defined(EXPORTED_TASKLIST_LOCK) - read_lock(&tasklist_lock); -#endif - /* search backward thru the circular list */ -#ifdef DEFINED_PREV_TASK - for (q = current; p = q; q = prev_task(p)) { -#else - for (p = current; p; p = p->prev_task) { -#endif - if (p->pid == 1) { -#if defined(EXPORTED_TASKLIST_LOCK) - read_unlock(&tasklist_lock); -#endif - return p->addr_limit.seg; - } - } -#if defined(EXPORTED_TASKLIST_LOCK) - read_unlock(&tasklist_lock); -#endif - return 0; -#endif -} -#endif /* !AFS_LINUX24_ENV */ diff --git a/src/afs/LINUX/osi_pag_module.c b/src/afs/LINUX/osi_pag_module.c index d0f73fa..a315ec8 100644 --- a/src/afs/LINUX/osi_pag_module.c +++ b/src/afs/LINUX/osi_pag_module.c @@ -29,11 +29,9 @@ #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include #include #include -#endif static unsigned long nfs_server_addr = 0; #if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) @@ -51,27 +49,18 @@ MODULE_PARM(this_cell, "s"); #endif MODULE_PARM_DESC(this_cell, "Local cell name"); -#if defined(AFS_LINUX24_ENV) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) DEFINE_MUTEX(afs_global_lock); #else DECLARE_MUTEX(afs_global_lock); #endif struct proc_dir_entry *openafs_procfs; -#else -struct semaphore afs_global_lock = MUTEX; -#endif int afs_global_owner = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) int __init afspag_init(void) -#else -int -init_module(void) -#endif { -#if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV) +#if !defined(EXPORTED_PROC_ROOT_FS) char path[64]; #endif int err; @@ -81,7 +70,6 @@ init_module(void) err = osi_syscall_init(); if (err) return err; -#ifdef AFS_LINUX24_ENV #if defined(EXPORTED_PROC_ROOT_FS) openafs_procfs = proc_mkdir(PROC_FSDIRNAME, proc_root_fs); #else @@ -89,7 +77,6 @@ init_module(void) openafs_procfs = proc_mkdir(path, NULL); #endif osi_ioctl_init(); -#endif afspag_Init(htonl(nfs_server_addr)); if (this_cell) @@ -98,22 +85,16 @@ init_module(void) return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) void __exit afspag_cleanup(void) -#else -void -cleanup_module(void) -#endif { -#if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV) +#if !defined(EXPORTED_PROC_ROOT_FS) char path[64]; #endif osi_syscall_clean(); osi_linux_free_afs_memory(); -#ifdef AFS_LINUX24_ENV osi_ioctl_clean(); #if defined(EXPORTED_PROC_ROOT_FS) remove_proc_entry(PROC_FSDIRNAME, proc_root_fs); @@ -121,17 +102,13 @@ cleanup_module(void) sprintf(path, "fs/%s", PROC_FSDIRNAME); remove_proc_entry(path, NULL); #endif -#endif return; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) MODULE_LICENSE("http://www.openafs.org/dl/license10.html"); module_init(afspag_init); module_exit(afspag_cleanup); -#endif -#ifdef AFS_LINUX26_ENV /* Hack alert! * These will never be called in the standalone PAG manager, because * they are only referenced in afs_InitReq, and nothing calls that. @@ -152,4 +129,3 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter, { return EINVAL; } -#endif diff --git a/src/afs/LINUX/osi_probe.c b/src/afs/LINUX/osi_probe.c index 02bd9fd..9d6da56 100644 --- a/src/afs/LINUX/osi_probe.c +++ b/src/afs/LINUX/osi_probe.c @@ -46,26 +46,24 @@ /* Code to find the Linux syscall table */ #ifdef OSI_PROBE_STANDALONE -#define OSI_PROBE_DEBUG +# define OSI_PROBE_DEBUG #endif #ifndef OSI_PROBE_STANDALONE -#include -#include "afs/param.h" +# include +# include "afs/param.h" #endif + #if defined(ENABLE_LINUX_SYSCALL_PROBING) && defined(EXPORTED_INIT_MM) -#ifdef AFS_LINUX24_ENV #include /* early to avoid printf->printk mapping */ -#ifdef AFS_LINUX26_ENV #include /* for scsi_command_size */ -#endif #ifndef OSI_PROBE_STANDALONE -#include "afs/sysincludes.h" -#include "afsincludes.h" +# include "afs/sysincludes.h" +# include "afsincludes.h" #endif #include #include #ifdef CONFIG_H_EXISTS -#include +# include #endif #include #include @@ -73,11 +71,11 @@ #include #if defined(AFS_PPC64_LINUX26_ENV) -#include +# include #endif #ifdef AFS_AMD64_LINUX20_ENV -#include +# include #endif /* number of syscalls */ @@ -240,11 +238,7 @@ extern asmlinkage long sys_close(unsigned int) __attribute__((weak)); extern asmlinkage long sys_chdir(const char *) __attribute__((weak)); #endif extern asmlinkage ssize_t sys_write(unsigned int, const char *, size_t) __attribute__((weak)); -#ifdef AFS_LINUX26_ENV extern asmlinkage long sys_wait4(pid_t, int *, int, struct rusage *) __attribute__((weak)); -#else -extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *) __attribute__((weak)); -#endif extern asmlinkage long sys_exit (int) __attribute__((weak)); #if defined(EXPORTED_SYS_OPEN) extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak)); @@ -409,7 +403,6 @@ static int main_zapped_syscalls[] = { * The module-loading mechanism changed in Linux 2.6, and insmod's * loss is our gain: three new unimplemented system calls! */ -#if defined(AFS_LINUX26_ENV) #ifdef __NR_ __NR_create_module, #endif @@ -419,7 +412,6 @@ static int main_zapped_syscalls[] = { #ifdef __NR_get_kernel_syms __NR_get_kernel_syms, #endif -#endif /* AFS_LINUX26_ENV */ /* * On IA64, the old module-loading calls are indeed present and @@ -522,9 +514,6 @@ static probectl main_probe = { #elif defined(AFS_AMD64_LINUX26_ENV) /* On this platform, it's in a different section! */ (unsigned long)&generic_ro_fops, -#elif defined(AFS_AMD64_LINUX20_ENV) - /* On this platform, it's in a different section! */ - (unsigned long)&tasklist_lock, #else (unsigned long)&init_mm, #endif @@ -549,32 +538,20 @@ static probectl main_probe = { (unsigned long)(&generic_ro_fops) - 0x30000, 0, 0x6000, -#elif defined(AFS_AMD64_LINUX20_ENV) - (unsigned long)(&tasklist_lock) - 0x30000, - 0, - 0x6000, #elif defined(AFS_PPC64_LINUX26_ENV) (unsigned long)(&do_signal), 0xfff, 0x400, -#elif defined(AFS_PPC_LINUX20_ENV) || defined(AFS_PPC_LINUX20_ENV) - (unsigned long)&init_mm, - 0xffff, - 16384, #else (unsigned long)&init_mm, 0, 16384, #endif -#ifdef AFS_LINUX26_ENV (unsigned long)scsi_command_size, (unsigned long)scsi_command_size - 0x10000, 0x3ffff, 0x40000, -#else - 0, 0, 0, 0, -#endif /* number and list of unimplemented system calls */ ((sizeof(main_zapped_syscalls)/sizeof(main_zapped_syscalls[0])) - 1), @@ -665,14 +642,10 @@ static probectl ia32_probe = { 0, (0x180000 / sizeof(unsigned long *)), -#ifdef AFS_LINUX26_ENV (unsigned long)scsi_command_size, (unsigned long)scsi_command_size - 0x10000, 0x3ffff, 0x40000, -#else - 0, 0, 0, 0, -#endif /* number and list of unimplemented system calls */ @@ -804,14 +777,10 @@ static probectl sct32_probe = { 16384, #endif -#ifdef AFS_LINUX26_ENV (unsigned long)scsi_command_size, (unsigned long)scsi_command_size - 0x10000, 0x3ffff, 0x40000, -#else - 0, 0, 0, 0, -#endif /* number and list of unimplemented system calls */ ((sizeof(sct32_zapped_syscalls)/sizeof(sct32_zapped_syscalls[0])) - 1), @@ -899,14 +868,10 @@ static probectl emu_probe = { 0xfffff, 0x20000, -#ifdef AFS_LINUX26_ENV (unsigned long)scsi_command_size, (unsigned long)scsi_command_size - 0x10000, 0x3ffff, 0x40000, -#else - 0, 0, 0, 0, -#endif /* number and list of unimplemented system calls */ ((sizeof(emu_zapped_syscalls)/sizeof(emu_zapped_syscalls[0])) - 1), @@ -1481,7 +1446,7 @@ void osi_probe_exit(void) { } module_init(osi_probe_init); module_exit(osi_probe_exit); #endif -#endif + #else void *osi_find_syscall_table(int which) { diff --git a/src/afs/LINUX/osi_sleep.c b/src/afs/LINUX/osi_sleep.c index 433c82b..dd45ee3 100644 --- a/src/afs/LINUX/osi_sleep.c +++ b/src/afs/LINUX/osi_sleep.c @@ -82,11 +82,7 @@ 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 @@ -146,11 +142,7 @@ afs_addevent(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 = &dummyV; /* Dummy address for new events */ newp->refcount = 0; @@ -194,7 +186,6 @@ afs_osi_SleepSig(void *event) AFS_ASSERT_GLOCK(); AFS_GUNLOCK(); schedule(); -#ifdef AFS_LINUX26_ENV #ifdef CONFIG_PM if ( #ifdef PF_FREEZE @@ -217,7 +208,6 @@ afs_osi_SleepSig(void *event) refrigerator(); #endif #endif -#endif AFS_GLOCK(); if (signal_pending(current)) { retval = EINTR; @@ -296,7 +286,6 @@ osi_TimedSleep(char *event, afs_int32 ams, int aintok) code = EINTR; } else schedule_timeout(ticks); -#ifdef AFS_LINUX26_ENV #ifdef CONFIG_PM if ( #ifdef PF_FREEZE @@ -319,7 +308,6 @@ osi_TimedSleep(char *event, afs_int32 ams, int aintok) refrigerator(); #endif #endif -#endif AFS_GLOCK(); remove_wait_queue(&evp->cond, &wait); diff --git a/src/afs/LINUX/osi_syscall.c b/src/afs/LINUX/osi_syscall.c index 9dd6647..0a85aa6 100644 --- a/src/afs/LINUX/osi_syscall.c +++ b/src/afs/LINUX/osi_syscall.c @@ -15,9 +15,7 @@ #include "afs/param.h" -#ifdef AFS_LINUX24_ENV #include /* early to avoid printf->printk mapping */ -#endif #include "afs/sysincludes.h" #include "afsincludes.h" #include "h/unistd.h" /* For syscall numbers. */ @@ -29,10 +27,8 @@ #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include #include -#endif #ifndef NR_syscalls #define NR_syscalls 222 @@ -70,9 +66,7 @@ afs_sys_call_table[_S(SLOT)] = POINTER2SYSCALL FUNC; #endif -#if defined(AFS_S390X_LINUX24_ENV) && !defined(AFS_LINUX26_ENV) -#define _S(x) ((x)<<1) -#elif defined(AFS_IA64_LINUX20_ENV) +#if defined(AFS_IA64_LINUX20_ENV) #define _S(x) ((x)-1024) #else #define _S(x) x @@ -106,16 +100,9 @@ uint32_t syscall_jump_code[] = { extern long afs_xsetgroups(int gidsetsize, gid_t * grouplist); asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist); -#ifdef AFS_LINUX24_ENV extern int afs_xsetgroups32(int gidsetsize, gid_t * grouplist); asmlinkage int (*sys_setgroups32p) (int gidsetsize, __kernel_gid32_t * grouplist); -#endif - -#if !defined(AFS_LINUX24_ENV) -asmlinkage int (*sys_settimeofdayp) (struct timeval * tv, struct timezone * tz); -#endif - /***** AMD64 *****/ #ifdef AFS_AMD64_LINUX20_ENV @@ -124,10 +111,8 @@ static SYSCALLTYPE ia32_ni_syscall = 0; extern int afs32_xsetgroups(); asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist); -#ifdef AFS_LINUX24_ENV extern int afs32_xsetgroups32(); asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist); -#endif /* __NR_ia32_setgroups32 */ #endif /* AFS_AMD64_LINUX20_ENV */ @@ -156,38 +141,22 @@ static void sys32_setgroups_stub() printf("*** error! sys32_setgroups_stub called\n"); } -#endif /* AFS_AMD64_LINUX20_ENV */ +#endif /* AFS_PPC64_LINUX26_ENV */ /***** SPARC64 *****/ -#ifdef AFS_SPARC64_LINUX20_ENV #ifdef AFS_SPARC64_LINUX26_ENV static SYSCALLTYPE *afs_sys_call_table32; -#else -extern SYSCALLTYPE *afs_sys_call_table32; -#endif static SYSCALLTYPE afs_ni_syscall32 = 0; extern int afs32_xsetgroups(); -#ifdef AFS_SPARC64_LINUX26_ENV asmlinkage int (*sys32_setgroupsp) (int gidsetsize, __kernel_gid32_t * grouplist); -#else -asmlinkage int (*sys32_setgroupsp) (int gidsetsize, - __kernel_gid_t32 * grouplist); -#endif -#ifdef AFS_LINUX24_ENV /* This number is not exported for some bizarre reason. */ #define __NR_setgroups32 82 extern int afs32_xsetgroups32(); -#ifdef AFS_SPARC64_LINUX26_ENV asmlinkage int (*sys32_setgroups32p) (int gidsetsize, __kernel_gid32_t * grouplist); -#else -asmlinkage int (*sys32_setgroups32p) (int gidsetsize, - __kernel_gid_t32 * grouplist); -#endif -#endif asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4, @@ -422,10 +391,6 @@ int osi_syscall_init(void) afs_sys_call_table = osi_find_syscall_table(0); if (afs_sys_call_table) { -#if !defined(AFS_LINUX24_ENV) - /* XXX no sys_settimeofday on IA64? */ -#endif - /* check we aren't already loaded */ /* XXX this can't be right */ if (SYSCALL2POINTER afs_sys_call_table[_S(__NR_afs_syscall)] @@ -502,10 +467,6 @@ int osi_syscall_init(void) afs_sys_call_table = osi_find_syscall_table(0); if (afs_sys_call_table) { -#if !defined(AFS_LINUX24_ENV) - sys_settimeofdayp = - SYSCALL2POINTER afs_sys_call_table[_S(__NR_settimeofday)]; -#endif /* AFS_LINUX24_ENV */ /* check we aren't already loaded */ if (SYSCALL2POINTER afs_sys_call_table[_S(__NR_afs_syscall)] @@ -547,13 +508,11 @@ int osi_syscall_init(void) afs_ia32_sys_call_table[__NR_ia32_setgroups] = POINTER2SYSCALL afs32_xsetgroups; -#if AFS_LINUX24_ENV /* setup setgroups32 for IA32 */ sys32_setgroups32p = SYSCALL2POINTER afs_ia32_sys_call_table[__NR_ia32_setgroups32]; afs_ia32_sys_call_table[__NR_ia32_setgroups32] = POINTER2SYSCALL afs32_xsetgroups32; -#endif /* __NR_ia32_setgroups32 */ } #endif /* AFS_AMD64_LINUX20_ENV */ @@ -570,13 +529,11 @@ int osi_syscall_init(void) sys32_setgroupsp = SYSCALL2POINTER afs_sys_call_table32[__NR_setgroups]; afs_sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups; -#ifdef AFS_LINUX24_ENV /* setup setgroups32 for 32-bit SPARC */ sys32_setgroups32p = SYSCALL2POINTER afs_sys_call_table32[__NR_setgroups32]; afs_sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL afs32_xsetgroups32; -#endif } #endif /* AFS_SPARC64_LINUX20_ENV */ return 0; @@ -644,11 +601,9 @@ void osi_syscall_clean(void) afs_ia32_sys_call_table[__NR_ia32_setgroups] = POINTER2SYSCALL sys32_setgroupsp; -#ifdef AFS_LINUX24_ENV /* put back setgroups32 for IA32 */ afs_ia32_sys_call_table[__NR_ia32_setgroups32] = POINTER2SYSCALL sys32_setgroups32p; -#endif } #endif @@ -663,11 +618,9 @@ void osi_syscall_clean(void) afs_sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys32_setgroupsp; -#ifdef AFS_LINUX24_ENV /* put back setgroups32 for IA32 */ afs_sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL sys32_setgroups32p; -#endif } #endif } diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index b114b46..b0b8a28 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -21,23 +21,16 @@ #include "afs/sysincludes.h" #include "afsincludes.h" #include "afs/afs_stats.h" -#if !defined(AFS_LINUX26_ENV) -#include "h/locks.h" -#endif -#if defined(AFS_LINUX24_ENV) #include "h/smp_lock.h" -#endif struct vcache *afs_globalVp = 0; struct vfs *afs_globalVFS = 0; -#if defined(AFS_LINUX24_ENV) struct vfsmount *afs_cacheMnt; -#endif int afs_was_mounted = 0; /* Used to force reload if mount/unmount/mount */ extern struct super_operations afs_sops; -#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS) +#if !defined(AFS_NONFSTRANS) extern struct export_operations afs_export_ops; #endif extern afs_rwlock_t afs_xvcache; @@ -64,7 +57,6 @@ int afs_fill_super(struct super_block *sb, void *data, int silent); * read the "super block" for AFS - roughly eguivalent to struct vfs. * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super. */ -#if defined(AFS_LINUX26_ENV) #ifdef GET_SB_HAS_STRUCT_VFSMOUNT int afs_get_sb(struct file_system_type *fs_type, int flags, @@ -90,29 +82,13 @@ struct file_system_type afs_fs_type = { .kill_sb = kill_anon_super, .fs_flags = FS_BINARY_MOUNTDATA, }; -#elif defined(AFS_LINUX24_ENV) -DECLARE_FSTYPE(afs_fs_type, "afs", afs_read_super, 0); -#else -struct file_system_type afs_fs_type = { - "afs", /* name - used by mount operation. */ - 0, /* requires_dev - no for network filesystems. mount() will - * pass us an "unnamed" device. */ - afs_read_super, /* wrapper to afs_mount */ - NULL /* pointer to next file_system_type once registered. */ -}; -#endif -#if defined(AFS_LINUX26_ENV) struct backing_dev_info afs_backing_dev_info = { .ra_pages = 32, }; int afs_fill_super(struct super_block *sb, void *data, int silent) -#else -struct super_block * -afs_read_super(struct super_block *sb, void *data, int silent) -#endif { int code = 0; @@ -121,23 +97,12 @@ afs_read_super(struct super_block *sb, void *data, int silent) printf ("You must reload the AFS kernel extensions before remounting AFS.\n"); AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) return -EINVAL; -#else - return NULL; -#endif } afs_was_mounted = 1; /* Set basics of super_block */ -#if !defined(AFS_LINUX24_ENV) - lock_super(sb); -#endif -#if defined(AFS_LINUX26_ENV) __module_get(THIS_MODULE); -#else - MOD_INC_USE_COUNT; -#endif afs_globalVFS = sb; sb->s_blocksize = 1024; @@ -147,7 +112,7 @@ afs_read_super(struct super_block *sb, void *data, int silent) #if defined(HAVE_BDI_INIT) bdi_init(&afs_backing_dev_info); #endif -#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS) +#if !defined(AFS_NONFSTRANS) sb->s_export_op = &afs_export_ops; #endif #if defined(MAX_NON_LFS) @@ -167,23 +132,11 @@ afs_read_super(struct super_block *sb, void *data, int silent) code = afs_root(sb); if (code) { afs_globalVFS = NULL; -#if defined(AFS_LINUX26_ENV) module_put(THIS_MODULE); -#else - MOD_DEC_USE_COUNT; -#endif } -#if !defined(AFS_LINUX24_ENV) - unlock_super(sb); -#endif - AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) return code ? -EINVAL : 0; -#else - return code ? NULL : sb; -#endif } @@ -217,11 +170,7 @@ afs_root(struct super_block *afsp) /* setup super_block and mount point inode. */ afs_globalVp = tvp; -#if defined(AFS_LINUX24_ENV) afsp->s_root = d_alloc_root(ip); -#else - afsp->s_root = d_alloc_root(ip, NULL); -#endif afsp->s_root->d_op = &afs_dentry_operations; } else code = ENOENT; @@ -251,9 +200,7 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp) VATTR_NULL(&vattr); iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */ -#if defined(AFS_LINUX26_ENV) lock_kernel(); -#endif AFS_GLOCK(); code = afs_setattr(VTOAFS(ip), &vattr, credp); if (!code) { @@ -261,9 +208,7 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp) vattr2inode(ip, &vattr); } AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) unlock_kernel(); -#endif crfree(credp); return -code; } @@ -301,13 +246,11 @@ afs_destroy_inode(struct inode *inode) static void #if defined(HAVE_KMEM_CACHE_T) init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) -#else -#if defined(KMEM_CACHE_INIT) +#elif defined(KMEM_CACHE_INIT) init_once(struct kmem_cache * cachep, void * foo) #else init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) #endif -#endif { struct vcache *vcp = (struct vcache *) foo; @@ -384,21 +327,12 @@ afs_put_super(struct super_block *sbp) AFS_GLOCK(); AFS_STATCNT(afs_unmount); -#if !defined(AFS_LINUX26_ENV) - if (!suser()) { - AFS_GUNLOCK(); - return; - } -#endif - afs_globalVFS = 0; afs_globalVp = 0; osi_linux_free_inode_pages(); /* invalidate and release remaining AFS inodes. */ afs_shutdown(); -#if defined(AFS_LINUX24_ENV) mntput(afs_cacheMnt); -#endif osi_linux_verify_alloced_memory(); #if defined(HAVE_BDI_INIT) @@ -407,11 +341,7 @@ afs_put_super(struct super_block *sbp) AFS_GUNLOCK(); sbp->s_dev = 0; -#if defined(AFS_LINUX26_ENV) module_put(THIS_MODULE); -#else - MOD_DEC_USE_COUNT; -#endif } @@ -419,32 +349,14 @@ afs_put_super(struct super_block *sbp) * statp is in user space, so we need to cobble together a statfs, then * copy it. */ -#if defined(AFS_LINUX26_ENV) int #if defined(STATFS_TAKES_DENTRY) afs_statfs(struct dentry *dentry, struct kstatfs *statp) #else afs_statfs(struct super_block *sbp, struct kstatfs *statp) #endif -#elif 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 { -#if !defined(AFS_LINUX24_ENV) - struct statfs stat, *statp; - - if (size < sizeof(struct statfs)) - return; - - memset(&stat, 0, size); - statp = &stat; -#else memset(statp, 0, sizeof(*statp)); -#endif AFS_STATCNT(afs_statfs); @@ -461,9 +373,6 @@ afs_statfs(struct super_block *sbp, struct statfs *__statp, int size) statp->f_fsid.val[1] = AFS_VFSFSID; statp->f_namelen = 256; -#if !defined(AFS_LINUX24_ENV) - memcpy_tofs(__statp, &stat, size); -#endif return 0; } @@ -475,9 +384,6 @@ struct super_operations afs_sops = { .clear_inode = afs_clear_inode, .put_super = afs_put_super, .statfs = afs_statfs, -#if !defined(AFS_LINUX24_ENV) - .notify_change = afs_notify_change, -#endif }; /************** Support routines ************************/ @@ -498,27 +404,15 @@ iattr2vattr(struct vattr *vattrp, struct iattr *iattrp) if (iattrp->ia_valid & ATTR_SIZE) vattrp->va_size = iattrp->ia_size; if (iattrp->ia_valid & ATTR_ATIME) { -#if defined(AFS_LINUX26_ENV) vattrp->va_atime.tv_sec = iattrp->ia_atime.tv_sec; -#else - vattrp->va_atime.tv_sec = iattrp->ia_atime; -#endif vattrp->va_atime.tv_usec = 0; } if (iattrp->ia_valid & ATTR_MTIME) { -#if defined(AFS_LINUX26_ENV) vattrp->va_mtime.tv_sec = iattrp->ia_mtime.tv_sec; -#else - vattrp->va_mtime.tv_sec = iattrp->ia_mtime; -#endif vattrp->va_mtime.tv_usec = 0; } if (iattrp->ia_valid & ATTR_CTIME) { -#if defined(AFS_LINUX26_ENV) vattrp->va_ctime.tv_sec = iattrp->ia_ctime.tv_sec; -#else - vattrp->va_ctime.tv_sec = iattrp->ia_ctime; -#endif vattrp->va_ctime.tv_usec = 0; } } @@ -543,7 +437,6 @@ vattr2inode(struct inode *ip, struct vattr *vp) ip->i_uid = vp->va_uid; ip->i_gid = vp->va_gid; i_size_write(ip, vp->va_size); -#if defined(AFS_LINUX26_ENV) ip->i_atime.tv_sec = vp->va_atime.tv_sec; ip->i_atime.tv_nsec = 0; ip->i_mtime.tv_sec = vp->va_mtime.tv_sec; @@ -554,11 +447,6 @@ vattr2inode(struct inode *ip, struct vattr *vp) ip->i_mtime.tv_nsec = afs_sysnamegen; ip->i_ctime.tv_sec = vp->va_ctime.tv_sec; ip->i_ctime.tv_nsec = 0; -#else - ip->i_atime = vp->va_atime.tv_sec; - ip->i_mtime = vp->va_mtime.tv_sec; - ip->i_ctime = vp->va_ctime.tv_sec; -#endif } /* osi_linux_free_inode_pages diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c index 0fa7978..93b3548 100644 --- a/src/afs/LINUX/osi_vm.c +++ b/src/afs/LINUX/osi_vm.c @@ -49,13 +49,7 @@ osi_VM_FlushVCache(struct vcache *avc, int *slept) if (avc->opens != 0) return EBUSY; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) return vmtruncate(ip, 0); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) - truncate_inode_pages(ip, 0); -#else - invalidate_inode_pages(ip); -#endif return 0; } @@ -73,11 +67,7 @@ osi_VM_TryToSmush(struct vcache *avc, AFS_UCRED *acred, int sync) { struct inode *ip = AFSTOV(avc); -#if defined(AFS_LINUX26_ENV) invalidate_inode_pages(ip->i_mapping); -#else - invalidate_inode_pages(ip); -#endif } /* Flush and invalidate pages, for fsync() with INVAL flag @@ -103,19 +93,13 @@ osi_VM_StoreAllSegments(struct vcache *avc) if (avc->f.states & CPageWrite) return; /* someone already writing */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5) /* filemap_fdatasync() only exported in 2.4.5 and above */ ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) filemap_fdatawrite(ip->i_mapping); -#else - filemap_fdatasync(ip->i_mapping); -#endif filemap_fdatawait(ip->i_mapping); AFS_GLOCK(); ObtainWriteLock(&avc->lock, 121); -#endif } /* Purge VM for a file when its callback is revoked. @@ -130,17 +114,9 @@ osi_VM_StoreAllSegments(struct vcache *avc) void osi_VM_FlushPages(struct vcache *avc, AFS_UCRED *credp) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) struct inode *ip = AFSTOV(avc); truncate_inode_pages(&ip->i_data, 0); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) - struct inode *ip = AFSTOV(avc); - - truncate_inode_pages(ip, 0); -#else - invalidate_inode_pages(AFSTOV(avc)); -#endif } /* Purge pages beyond end-of-file, when truncating a file. @@ -152,13 +128,5 @@ osi_VM_FlushPages(struct vcache *avc, AFS_UCRED *credp) void osi_VM_Truncate(struct vcache *avc, int alen, AFS_UCRED *acred) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) vmtruncate(AFSTOV(avc), alen); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15) - struct inode *ip = AFSTOV(avc); - - truncate_inode_pages(ip, alen); -#else - invalidate_inode_pages(AFSTOV(avc)); -#endif } diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 354f68c..6674ce8 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -30,13 +30,9 @@ #include "h/mm_inline.h" #endif #include "h/pagemap.h" -#if defined(AFS_LINUX24_ENV) #include "h/smp_lock.h" -#endif -#if defined(AFS_LINUX26_ENV) #include "h/writeback.h" #include "h/pagevec.h" -#endif #if defined(AFS_CACHE_BYPASS) #include "afs/lock.h" #include "afs/afs_bypasscache.h" @@ -58,15 +54,12 @@ #define MAX_ERRNO 1000L #endif -#if defined(AFS_LINUX26_ENV) #define LockPage(pp) lock_page(pp) #define UnlockPage(pp) unlock_page(pp) extern struct backing_dev_info afs_backing_dev_info; -#endif extern struct vcache *afs_globalVp; extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp); -#if defined(AFS_LINUX24_ENV) /* Some uses of BKL are perhaps not needed for bypass or memcache-- * why don't we try it out? */ extern struct afs_cacheOps afs_UfsCacheOps; @@ -82,7 +75,6 @@ extern struct afs_cacheOps afs_UfsCacheOps; if(afs_cacheType == &afs_UfsCacheOps) \ unlock_kernel(); \ } while(0); -#endif /* AFS_LINUX24_ENV */ /* This function converts a positive error code from AFS into a negative @@ -234,9 +226,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) cred_t *credp = crref(); struct afs_fakestat_state fakestat; -#if defined(AFS_LINUX26_ENV) maybe_lock_kernel(); -#endif AFS_GLOCK(); AFS_STATCNT(afs_readdir); @@ -326,7 +316,6 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) } /* filldir returns -EINVAL when the buffer is full. */ -#if defined(AFS_LINUX26_ENV) || ((defined(AFS_LINUX24_ENV) || defined(pgoff2loff)) && defined(DECLARE_FSTYPE)) { unsigned int type = DT_UNKNOWN; struct VenusFid afid; @@ -366,9 +355,6 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) code = (*filldir) (dirbuf, de->name, len, offset, ino, type); AFS_GLOCK(); } -#else - code = (*filldir) (dirbuf, de->name, len, offset, ino); -#endif DRelease(de, 0); if (code) break; @@ -392,9 +378,7 @@ out: afs_PutFakeStat(&fakestat); out1: AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif return code; } @@ -419,16 +403,9 @@ 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_linux_VerifyVCache(vcp, NULL); @@ -453,15 +430,11 @@ afs_linux_open(struct inode *ip, struct file *fp) cred_t *credp = crref(); int code; -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); code = afs_open(&vcp, fp->f_flags, credp); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); @@ -474,40 +447,28 @@ afs_linux_release(struct inode *ip, struct file *fp) cred_t *credp = crref(); int code = 0; -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); code = afs_close(vcp, fp->f_flags, credp); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); } static int -#if defined(AFS_LINUX24_ENV) afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync) -#else -afs_linux_fsync(struct file *fp, struct dentry *dp) -#endif { int code; struct inode *ip = FILE_INODE(fp); cred_t *credp = crref(); -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); code = afs_fsync(VTOAFS(ip), credp); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); @@ -549,15 +510,14 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) code = afs_lockctl(vcp, &flock, cmd, credp); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV if ((code == 0 || flp->fl_type == F_UNLCK) && (cmd == F_SETLK || cmd == F_SETLKW)) { -# ifdef POSIX_LOCK_FILE_WAIT_ARG +#ifdef POSIX_LOCK_FILE_WAIT_ARG code = posix_lock_file(fp, flp, 0); -# else +#else flp->fl_flags &=~ FL_SLEEP; code = posix_lock_file(fp, flp); -# endif +#endif if (code && flp->fl_type != F_UNLCK) { struct AFS_FLOCK flock2; flock2 = flock; @@ -571,31 +531,30 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) * kernel, as lockctl knows nothing about byte range locks */ if (code == 0 && cmd == F_GETLK && flock.l_type == F_UNLCK) { -# if defined(POSIX_TEST_LOCK_CONFLICT_ARG) +#if defined(POSIX_TEST_LOCK_CONFLICT_ARG) if (posix_test_lock(fp, flp, &conflict)) { locks_copy_lock(flp, &conflict); flp->fl_type = F_UNLCK; crfree(credp); return 0; } -# elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT) +#elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT) if ((conflict = posix_test_lock(fp, flp))) { locks_copy_lock(flp, conflict); flp->fl_type = F_UNLCK; crfee(credp); return 0; } -# else +#else posix_test_lock(fp, flp); /* If we found a lock in the kernel's structure, return it */ if (flp->fl_type != F_UNLCK) { crfree(credp); return 0; } -# endif +#endif } -#endif /* Convert flock back to Linux's file_lock */ flp->fl_type = flock.l_type; flp->fl_pid = flock.l_pid; @@ -731,25 +690,8 @@ out: return afs_convert_code(code); } -#if !defined(AFS_LINUX24_ENV) -/* Not allowed to directly read a directory. */ -ssize_t -afs_linux_dir_read(struct file * fp, char *buf, size_t count, loff_t * ppos) -{ - return -EISDIR; -} -#endif - - - struct file_operations afs_dir_fops = { -#if !defined(AFS_LINUX24_ENV) - .read = afs_linux_dir_read, - .lock = afs_linux_lock, - .fsync = afs_linux_fsync, -#else .read = generic_read_dir, -#endif .readdir = afs_linux_readdir, #ifdef HAVE_UNLOCKED_IOCTL .unlocked_ioctl = afs_unlocked_xioctl, @@ -781,10 +723,10 @@ struct file_operations afs_file_fops = { .mmap = afs_linux_mmap, .open = afs_linux_open, .flush = afs_linux_flush, -#if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SENDFILE) +#if defined(STRUCT_FILE_OPERATIONS_HAS_SENDFILE) .sendfile = generic_file_sendfile, #endif -#if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE) +#if defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE) .splice_write = generic_file_splice_write, .splice_read = generic_file_splice_read, #endif @@ -857,9 +799,7 @@ afs_linux_revalidate(struct dentry *dp) if (afs_shuttingdown) return EIO; -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); #ifdef notyet @@ -870,9 +810,7 @@ afs_linux_revalidate(struct dentry *dp) check_bad_parent(dp); /* check and correct mvid */ AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV unlock_kernel(); -#endif return 0; } #endif @@ -893,14 +831,11 @@ afs_linux_revalidate(struct dentry *dp) afs_fill_inode(AFSTOV(vcp), &vattr); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif return afs_convert_code(code); } -#if defined(AFS_LINUX26_ENV) static int afs_linux_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { @@ -910,7 +845,6 @@ afs_linux_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *sta } return err; } -#endif /* Validate a dentry. Return 1 if unchanged, 0 if VFS layer should re-evaluate. * In kernels 2.2.10 and above, we are passed an additional flags var which @@ -920,15 +854,11 @@ afs_linux_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *sta * later on, we shouldn't have to do it until later. Perhaps in the future.. */ static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) #ifdef DOP_REVALIDATE_TAKES_NAMEIDATA afs_linux_dentry_revalidate(struct dentry *dp, struct nameidata *nd) #else afs_linux_dentry_revalidate(struct dentry *dp, int flags) #endif -#else -afs_linux_dentry_revalidate(struct dentry *dp) -#endif { struct vattr vattr; cred_t *credp = NULL; @@ -936,9 +866,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) int valid; struct afs_fakestat_state fakestate; -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); afs_InitFakeStat(&fakestate); @@ -959,10 +887,6 @@ afs_linux_dentry_revalidate(struct dentry *dp) credp = crref(); code = afs_InitReq(&treq, credp); if ( -#ifdef AFS_DARWIN_ENV - (strcmp(dp->d_name.name, ".DS_Store") == 0) || - (strcmp(dp->d_name.name, "Contents") == 0) || -#endif (strcmp(dp->d_name.name, ".directory") == 0)) { tryEvalOnly = 1; } @@ -1046,9 +970,7 @@ afs_linux_dentry_revalidate(struct dentry *dp) shrink_dcache_parent(dp); d_drop(dp); } -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif return valid; bad_dentry: @@ -1070,14 +992,10 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip) } AFS_GUNLOCK(); #ifdef DCACHE_NFSFS_RENAMED -#ifdef AFS_LINUX26_ENV spin_lock(&dp->d_lock); -#endif dp->d_flags &= ~DCACHE_NFSFS_RENAMED; -#ifdef AFS_LINUX26_ENV spin_unlock(&dp->d_lock); #endif -#endif iput(ip); } @@ -1127,9 +1045,7 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) vattr.va_mode = mode; vattr.va_type = mode & S_IFMT; -#if defined(AFS_LINUX26_ENV) maybe_lock_kernel(); -#endif AFS_GLOCK(); code = afs_create(VTOAFS(dip), (char *)name, &vattr, NONEXCL, mode, &vcp, credp); @@ -1146,15 +1062,12 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) } AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); } /* afs_linux_lookup */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) static struct dentry * #ifdef IOP_LOOKUP_TAKES_NAMEIDATA afs_linux_lookup(struct inode *dip, struct dentry *dp, @@ -1162,23 +1075,15 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp, #else afs_linux_lookup(struct inode *dip, struct dentry *dp) #endif -#else -static int -afs_linux_lookup(struct inode *dip, struct dentry *dp) -#endif { cred_t *credp = crref(); struct vcache *vcp = NULL; const char *comp = dp->d_name.name; struct inode *ip = NULL; -#if defined(AFS_LINUX26_ENV) struct dentry *newdp = NULL; -#endif int code; -#if defined(AFS_LINUX26_ENV) maybe_lock_kernel(); -#endif AFS_GLOCK(); code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp); @@ -1191,10 +1096,8 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) if ( #ifdef HAVE_KERNEL_HLIST_UNHASHED hlist_unhashed(&ip->i_hash) -#elif defined(AFS_LINUX26_ENV) - ip->i_hash.pprev == NULL #else - ip->i_hash.prev == NULL + ip->i_hash.pprev == NULL #endif ) insert_inode_hash(ip); @@ -1203,60 +1106,35 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion); AFS_GUNLOCK(); -#if defined(AFS_LINUX24_ENV) if (ip && S_ISDIR(ip->i_mode)) { struct dentry *alias; /* Try to invalidate an existing alias in favor of our new one */ alias = d_find_alias(ip); -#if defined(AFS_LINUX26_ENV) /* But not if it's disconnected; then we want d_splice_alias below */ if (alias && !(alias->d_flags & DCACHE_DISCONNECTED)) { -#else - if (alias) { -#endif if (d_invalidate(alias) == 0) { dput(alias); } else { iput(ip); -#if defined(AFS_LINUX26_ENV) unlock_kernel(); -#endif crfree(credp); return alias; } } } -#endif -#if defined(AFS_LINUX26_ENV) newdp = d_splice_alias(ip, dp); -#else - d_add(dp, ip); -#endif -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif crfree(credp); /* It's ok for the file to not be found. That's noted by the caller by * seeing that the dp->d_inode field is NULL. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) -#if defined(AFS_LINUX26_ENV) if (!code || code == ENOENT) return newdp; -#else - if (code == ENOENT) - return ERR_PTR(0); -#endif else return ERR_PTR(afs_convert_code(code)); -#else - if (code == ENOENT) - code = 0; - return afs_convert_code(code); -#endif } static int @@ -1288,9 +1166,7 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) const char *name = dp->d_name.name; struct vcache *tvc = VTOAFS(dp->d_inode); -#if defined(AFS_LINUX26_ENV) maybe_lock_kernel(); -#endif if (VREFCOUNT(tvc) > 1 && tvc->opens > 0 && !(tvc->f.states & CUnlinked)) { struct dentry *__dp; @@ -1324,14 +1200,10 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) tvc->uncred = credp; tvc->f.states |= CUnlinked; #ifdef DCACHE_NFSFS_RENAMED -#ifdef AFS_LINUX26_ENV spin_lock(&dp->d_lock); -#endif dp->d_flags |= DCACHE_NFSFS_RENAMED; -#ifdef AFS_LINUX26_ENV spin_unlock(&dp->d_lock); #endif -#endif } else { osi_FreeSmallSpace(__name); } @@ -1352,9 +1224,7 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) if (!code) d_drop(dp); out: -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); } @@ -1390,9 +1260,7 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) struct vattr vattr; const char *name = dp->d_name.name; -#if defined(AFS_LINUX26_ENV) maybe_lock_kernel(); -#endif VATTR_NULL(&vattr); vattr.va_mask = ATTR_MODE; vattr.va_mode = mode; @@ -1411,9 +1279,7 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) } AFS_GUNLOCK(); -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); } @@ -1458,7 +1324,6 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, const char *newname = newdp->d_name.name; struct dentry *rehash = NULL; -#if defined(AFS_LINUX26_ENV) /* Prevent any new references during rename operation. */ maybe_lock_kernel(); @@ -1466,17 +1331,9 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, d_drop(newdp); rehash = newdp; } -#else - if (!list_empty(&newdp->d_hash)) { - d_drop(newdp); - rehash = newdp; - } -#endif -#if defined(AFS_LINUX24_ENV) if (atomic_read(&olddp->d_count) > 1) shrink_dcache_parent(olddp); -#endif AFS_GLOCK(); code = afs_rename(VTOAFS(oldip), (char *)oldname, VTOAFS(newip), (char *)newname, credp); @@ -1488,9 +1345,7 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, if (rehash) d_rehash(rehash); -#if defined(AFS_LINUX26_ENV) maybe_unlock_kernel(); -#endif crfree(credp); return afs_convert_code(code); @@ -1539,7 +1394,6 @@ afs_linux_readlink(struct dentry *dp, char *target, int maxlen) /* afs_linux_follow_link * a file system dependent link following routine. */ -#if defined(AFS_LINUX24_ENV) static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd) { int code; @@ -1567,51 +1421,9 @@ out: return code; } -#else /* !defined(AFS_LINUX24_ENV) */ - -static struct dentry * -afs_linux_follow_link(struct dentry *dp, struct dentry *basep, - unsigned int follow) -{ - int code = 0; - char *name; - struct dentry *res; - - - AFS_GLOCK(); - name = osi_Alloc(PATH_MAX + 1); - if (!name) { - AFS_GUNLOCK(); - dput(basep); - return ERR_PTR(-EIO); - } - - code = afs_linux_ireadlink(dp->d_inode, name, PATH_MAX, AFS_UIOSYS); - AFS_GUNLOCK(); - - if (code < 0) { - dput(basep); - if (code < -MAX_ERRNO) - res = ERR_PTR(-EIO); - else - res = ERR_PTR(code); - } else { - name[code] = '\0'; - res = lookup_dentry(name, basep, follow); - } - - AFS_GLOCK(); - osi_Free(name, PATH_MAX + 1); - AFS_GUNLOCK(); - return res; -} -#endif /* AFS_LINUX24_ENV */ #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */ #if defined(AFS_CACHE_BYPASS) - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - static inline int afs_linux_can_bypass(struct inode *ip) { switch(cache_bypass_strategy) { @@ -1738,7 +1550,6 @@ out: return afs_convert_code(code); } -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ #endif /* defined(AFS_CACHE_BYPASS */ static int @@ -1939,20 +1750,13 @@ static int afs_linux_readpage(struct file *fp, struct page *pp) { afs_int32 code; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) char *address; afs_offs_t offset = ((loff_t) pp->index) << PAGE_CACHE_SHIFT; -#else - ulong address = afs_linux_page_address(pp); - afs_offs_t offset = pageoff(pp); -#endif #if defined(AFS_CACHE_BYPASS) afs_int32 bypasscache = 0; /* bypass for this read */ struct nocache_read_request *ancr; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) afs_int32 isize; #endif -#endif uio_t *auio; struct iovec *iovecp; struct inode *ip = FILE_INODE(fp); @@ -1960,24 +1764,17 @@ afs_linux_readpage(struct file *fp, struct page *pp) struct vcache *avc = VTOAFS(ip); cred_t *credp; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) AFS_GLOCK(); if (afs_linux_readpage_fastpath(fp, pp, &code)) { AFS_GUNLOCK(); return code; } AFS_GUNLOCK(); -#endif credp = crref(); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) address = kmap(pp); ClearPageError(pp); -#else - atomic_add(1, &pp->count); - set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */ - clear_bit(PG_error, &pp->flags); -#endif + /* if bypasscache, receiver frees, else we do */ auio = osi_Alloc(sizeof(uio_t)); iovecp = osi_Alloc(sizeof(struct iovec)); @@ -2011,9 +1808,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) } #endif -#ifdef AFS_LINUX24_ENV maybe_lock_kernel(); -#endif AFS_GLOCK(); AFS_DISCON_LOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip, @@ -2027,9 +1822,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) code); AFS_DISCON_UNLOCK(); AFS_GUNLOCK(); -#ifdef AFS_LINUX24_ENV maybe_unlock_kernel(); -#endif if (!code) { /* XXX valid for no-cache also? Check last bits of files... :) * Cognate code goes in afs_NoCacheFetchProc. */ @@ -2037,22 +1830,12 @@ afs_linux_readpage(struct file *fp, struct page *pp) memset((void *)(address + (PAGE_SIZE - auio->uio_resid)), 0, auio->uio_resid); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) flush_dcache_page(pp); SetPageUptodate(pp); -#else - set_bit(PG_uptodate, &pp->flags); -#endif } /* !code */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) kunmap(pp); UnlockPage(pp); -#else - clear_bit(PG_locked, &pp->flags); - wake_up(&pp->wait); - free_page(address); -#endif #if defined(AFS_CACHE_BYPASS) /* do not call afs_GetDCache if cache is bypassed */ @@ -2192,7 +1975,6 @@ afs_linux_readpages(struct file *fp, struct address_space *mapping, return 0; } -#if defined(AFS_LINUX24_ENV) static int afs_linux_writepage_sync(struct inode *ip, struct page *pp, unsigned long offset, unsigned int count) @@ -2223,16 +2005,11 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp, maybe_unlock_kernel(); crfree(credp); kunmap(pp); -#ifdef AFS_LINUX26_ENV #if defined(WRITEPAGE_ACTIVATE) return WRITEPAGE_ACTIVATE; #else return AOP_WRITEPAGE_ACTIVATE; #endif -#else - /* should mark it dirty? */ - return(0); -#endif } vcp->f.states |= CPageWrite; ReleaseWriteLock(&vcp->lock); @@ -2282,19 +2059,13 @@ afs_linux_writepage(struct page *pp) unsigned offset = PAGE_CACHE_SIZE; long status; -#if defined(AFS_LINUX26_ENV) if (PageReclaim(pp)) { -# if defined(WRITEPAGE_ACTIVATE) +#if defined(WRITEPAGE_ACTIVATE) return WRITEPAGE_ACTIVATE; -# else - return AOP_WRITEPAGE_ACTIVATE; -# endif - } #else - if (PageLaunder(pp)) { - return(fail_writepage(pp)); - } + return AOP_WRITEPAGE_ACTIVATE; #endif + } inode = (struct inode *)mapping->host; end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT; @@ -2310,76 +2081,17 @@ afs_linux_writepage(struct page *pp) do_it: status = afs_linux_writepage_sync(inode, pp, 0, offset); SetPageUptodate(pp); -#if defined(AFS_LINUX26_ENV) #if defined(WRITEPAGE_ACTIVATE) if ( status != WRITEPAGE_ACTIVATE ) #else if ( status != AOP_WRITEPAGE_ACTIVATE ) #endif -#endif UnlockPage(pp); if (status == offset) return 0; else return status; } -#else -/* afs_linux_updatepage - * What one would have thought was writepage - write dirty page to file. - * Called from generic_file_write. buffer is still in user space. pagep - * has been filled in with old data if we're updating less than a page. - */ -static int -afs_linux_updatepage(struct file *fp, struct page *pp, unsigned long offset, - unsigned int count, int sync) -{ - struct vcache *vcp = VTOAFS(FILE_INODE(fp)); - u8 *page_addr = (u8 *) afs_linux_page_address(pp); - int code = 0; - cred_t *credp; - uio_t tuio; - struct iovec iovec; - - set_bit(PG_locked, &pp->flags); - - credp = crref(); - AFS_GLOCK(); - AFS_DISCON_LOCK(); - afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp, - ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp), - ICL_TYPE_INT32, 99999); - setup_uio(&tuio, &iovec, page_addr + offset, - (afs_offs_t) (pageoff(pp) + offset), count, UIO_WRITE, - AFS_UIOSYS); - - code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); - - i_size_write(ip, vcp->f.m.Length); - ip->i_blocks = ((vcp->f.m.Length + 1023) >> 10) << 1; - - if (!code) { - struct vrequest treq; - - ObtainWriteLock(&vcp->lock, 533); - vcp->f.m.Date = osi_Time(); /* set modification time */ - if (!afs_InitReq(&treq, credp)) - code = afs_DoPartialWrite(vcp, &treq); - ReleaseWriteLock(&vcp->lock); - } - - code = code ? afs_convert_code(code) : count - tuio.uio_resid; - afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp, - ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp), - ICL_TYPE_INT32, code); - - AFS_DISCON_UNLOCK(); - AFS_GUNLOCK(); - crfree(credp); - - clear_bit(PG_locked, &pp->flags); - return code; -} -#endif /* afs_linux_permission * Check access rights - returns error if can't check or permission denied. @@ -2409,7 +2121,7 @@ afs_linux_permission(struct inode *ip, int mode) return afs_convert_code(code); } -#if defined(AFS_LINUX24_ENV) && !defined(HAVE_WRITE_BEGIN) +#if !defined(HAVE_WRITE_BEGIN) static int afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to) @@ -2418,9 +2130,6 @@ afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, code = afs_linux_writepage_sync(file->f_dentry->d_inode, page, offset, to - offset); -#if !defined(AFS_LINUX26_ENV) - kunmap(page); -#endif return code; } @@ -2429,16 +2138,10 @@ static int afs_linux_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { -/* sometime between 2.4.0 and 2.4.19, the callers of prepare_write began to - call kmap directly instead of relying on us to do it */ -#if !defined(AFS_LINUX26_ENV) - kmap(page); -#endif return 0; } -#endif +#else -#if defined(HAVE_WRITE_BEGIN) static int afs_linux_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, @@ -2474,23 +2177,11 @@ afs_linux_write_begin(struct file *file, struct address_space *mapping, static struct inode_operations afs_file_iops = { -#if defined(AFS_LINUX26_ENV) .permission = afs_linux_permission, .getattr = afs_linux_getattr, .setattr = afs_notify_change, -#elif defined(AFS_LINUX24_ENV) - .permission = afs_linux_permission, - .revalidate = afs_linux_revalidate, - .setattr = afs_notify_change, -#else - .default_file_ops = &afs_file_fops, - .readpage = afs_linux_readpage, - .revalidate = afs_linux_revalidate, - .updatepage = afs_linux_updatepage, -#endif }; -#if defined(AFS_LINUX24_ENV) static struct address_space_operations afs_file_aops = { .readpage = afs_linux_readpage, .readpages = afs_linux_readpages, @@ -2503,7 +2194,6 @@ static struct address_space_operations afs_file_aops = { .prepare_write = afs_linux_prepare_write, #endif }; -#endif /* Separate ops vector for directories. Linux 2.2 tests type of inode @@ -2511,11 +2201,7 @@ static struct address_space_operations afs_file_aops = { */ static struct inode_operations afs_dir_iops = { -#if !defined(AFS_LINUX24_ENV) - .default_file_ops = &afs_dir_fops, -#else .setattr = afs_notify_change, -#endif .create = afs_linux_create, .lookup = afs_linux_lookup, .link = afs_linux_link, @@ -2524,11 +2210,7 @@ static struct inode_operations afs_dir_iops = { .mkdir = afs_linux_mkdir, .rmdir = afs_linux_rmdir, .rename = afs_linux_rename, -#if defined(AFS_LINUX26_ENV) .getattr = afs_linux_getattr, -#else - .revalidate = afs_linux_revalidate, -#endif .permission = afs_linux_permission, }; @@ -2575,23 +2257,17 @@ static struct address_space_operations afs_symlink_aops = { static struct inode_operations afs_symlink_iops = { #if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) .readlink = page_readlink, -#if defined(HAVE_KERNEL_PAGE_FOLLOW_LINK) +# if defined(HAVE_KERNEL_PAGE_FOLLOW_LINK) .follow_link = page_follow_link, -#else +# else .follow_link = page_follow_link_light, .put_link = page_put_link, -#endif +# endif #else /* !defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) */ .readlink = afs_linux_readlink, .follow_link = afs_linux_follow_link, -#if !defined(AFS_LINUX24_ENV) - .permission = afs_linux_permission, - .revalidate = afs_linux_revalidate, -#endif #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */ -#if defined(AFS_LINUX24_ENV) .setattr = afs_notify_change, -#endif }; void @@ -2601,22 +2277,16 @@ afs_fill_inode(struct inode *ip, struct vattr *vattr) if (vattr) vattr2inode(ip, vattr); -#if defined(AFS_LINUX26_ENV) ip->i_mapping->backing_dev_info = &afs_backing_dev_info; -#endif /* Reset ops if symlink or directory. */ if (S_ISREG(ip->i_mode)) { ip->i_op = &afs_file_iops; -#if defined(AFS_LINUX24_ENV) ip->i_fop = &afs_file_fops; ip->i_data.a_ops = &afs_file_aops; -#endif } else if (S_ISDIR(ip->i_mode)) { ip->i_op = &afs_dir_iops; -#if defined(AFS_LINUX24_ENV) ip->i_fop = &afs_dir_fops; -#endif } else if (S_ISLNK(ip->i_mode)) { ip->i_op = &afs_symlink_iops;