From: Simon Wilkinson Date: Sun, 17 Apr 2011 20:30:39 +0000 (+0100) Subject: Tidy up uio_t meaning X-Git-Tag: openafs-devel-1_7_1~428 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=ca465e432d67b067fc3854781b8702aaff577cc7 Tidy up uio_t meaning On IRIX, uio_t is typedef'd to "struct uio". On Darwin, uio_t is typedef'd to "struct uio *". Reduce the confusion by just not using "uio_t" in places where it isn't being defined for us, and avoiding it completely in cross-platform code. Change-Id: I0cee370e25d10b1ca4627832097a9a9f1e83b4c2 Reviewed-on: http://gerrit.openafs.org/4748 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index fbd20e9..3c20fd9 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -333,7 +333,7 @@ osi_InitCacheInfo(char *aname) * kernel space. */ int -osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) +osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw) { struct file *filp = osifile->filp; mm_segment_t old_fs = {0}; @@ -401,7 +401,7 @@ osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) * Setup a uio struct. */ void -setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, +setup_uio(struct uio *uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, int count, uio_flag_t flag, uio_seg_t seg) { iovecp->iov_base = (char *)buf; @@ -420,7 +420,7 @@ setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, * UIO_WRITE : uio -> dp */ int -uiomove(char *dp, int length, uio_flag_t rw, uio_t * uiop) +uiomove(char *dp, int length, uio_flag_t rw, struct uio *uiop) { int count; struct iovec *iov; diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 6c9390b..a2c16f5 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -224,14 +224,14 @@ afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) { /* UIO manipulation */ typedef enum { AFS_UIOSYS, AFS_UIOUSER } uio_seg_t; typedef enum { UIO_READ, UIO_WRITE } uio_flag_t; -typedef struct uio { +struct uio { struct iovec *uio_iov; int uio_iovcnt; afs_offs_t uio_offset; uio_seg_t uio_seg; int uio_resid; uio_flag_t uio_flag; -} uio_t; +}; #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt #define afsio_offset uio_offset diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h index c91500c..3d576b4 100644 --- a/src/afs/LINUX/osi_prototypes.h +++ b/src/afs/LINUX/osi_prototypes.h @@ -37,7 +37,7 @@ extern afs_rwlock_t afs_xnfssrv; /* osi_file.c */ extern afs_rwlock_t afs_xosi; extern int osi_InitCacheInfo(char *aname); -extern int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw); +extern int osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw); extern struct file *afs_linux_raw_open(afs_dcache_id_t *ainode); /* osi_ioctl.c */ diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 0106099..81039d6 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1433,7 +1433,7 @@ afs_linux_ireadlink(struct inode *ip, char *target, int maxlen, uio_seg_t seg) { int code; cred_t *credp = crref(); - uio_t tuio; + struct uio tuio; struct iovec iov; setup_uio(&tuio, &iov, target, (afs_offs_t) 0, maxlen, UIO_READ, seg); @@ -1722,7 +1722,7 @@ afs_linux_fillpage(struct file *fp, struct page *pp) { afs_int32 code; char *address; - uio_t *auio; + struct uio *auio; struct iovec *iovecp; struct inode *ip = FILE_INODE(fp); afs_int32 cnt = page_count(pp); @@ -1741,7 +1741,7 @@ afs_linux_fillpage(struct file *fp, struct page *pp) address = kmap(pp); ClearPageError(pp); - auio = osi_Alloc(sizeof(uio_t)); + auio = osi_Alloc(sizeof(struct uio)); iovecp = osi_Alloc(sizeof(struct iovec)); setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ, @@ -1773,7 +1773,7 @@ afs_linux_fillpage(struct file *fp, struct page *pp) kunmap(pp); - osi_Free(auio, sizeof(uio_t)); + osi_Free(auio, sizeof(struct uio)); osi_Free(iovecp, sizeof(struct iovec)); crfree(credp); @@ -1816,7 +1816,7 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, struct list_head *page_list, unsigned num_pages) { afs_int32 page_ix; - uio_t *auio; + struct uio *auio; afs_offs_t offset; struct iovec* iovecp; struct nocache_read_request *ancr; @@ -1834,7 +1834,7 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, /* background thread must free: iovecp, auio, ancr */ iovecp = osi_Alloc(num_pages * sizeof(struct iovec)); - auio = osi_Alloc(sizeof(uio_t)); + auio = osi_Alloc(sizeof(struct uio)); auio->uio_iov = iovecp; auio->uio_iovcnt = num_pages; auio->uio_flag = UIO_READ; @@ -1920,7 +1920,7 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping, /* If there is nothing for the background thread to handle, * it won't be freeing the things that we never gave it */ osi_Free(iovecp, num_pages * sizeof(struct iovec)); - osi_Free(auio, sizeof(uio_t)); + osi_Free(auio, sizeof(struct uio)); osi_Free(ancr, sizeof(struct nocache_read_request)); } /* we do not flush, release, or unmap pages--that will be @@ -1934,7 +1934,7 @@ static int afs_linux_bypass_readpage(struct file *fp, struct page *pp) { cred_t *credp = NULL; - uio_t *auio; + struct uio *auio; struct iovec *iovecp; struct nocache_read_request *ancr; int code; @@ -1953,7 +1953,7 @@ afs_linux_bypass_readpage(struct file *fp, struct page *pp) ClearPageError(pp); /* receiver frees */ - auio = osi_Alloc(sizeof(uio_t)); + auio = osi_Alloc(sizeof(struct uio)); iovecp = osi_Alloc(sizeof(struct iovec)); /* address can be NULL, because we overwrite it with 'pp', below */ @@ -2160,7 +2160,7 @@ afs_linux_page_writeback(struct inode *ip, struct page *pp, char *buffer; afs_offs_t base; int code = 0; - uio_t tuio; + struct uio tuio; struct iovec iovec; int f_flags = 0; diff --git a/src/afs/LINUX24/osi_file.c b/src/afs/LINUX24/osi_file.c index 98f931e..8751388 100644 --- a/src/afs/LINUX24/osi_file.c +++ b/src/afs/LINUX24/osi_file.c @@ -318,7 +318,7 @@ osi_InitCacheInfo(char *aname) * kernel space. */ int -osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) +osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw) { struct file *filp = &osifile->file; KERNEL_SPACE_DECL; @@ -386,7 +386,7 @@ osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) * Setup a uio struct. */ void -setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, +setup_uio(struct uio *uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, int count, uio_flag_t flag, uio_seg_t seg) { iovecp->iov_base = (char *)buf; @@ -405,7 +405,7 @@ setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, * UIO_WRITE : uio -> dp */ int -uiomove(char *dp, int length, uio_flag_t rw, uio_t * uiop) +uiomove(char *dp, int length, uio_flag_t rw, struct uio *uiop) { int count; struct iovec *iov; diff --git a/src/afs/LINUX24/osi_machdep.h b/src/afs/LINUX24/osi_machdep.h index 1aacbf6..d371176 100644 --- a/src/afs/LINUX24/osi_machdep.h +++ b/src/afs/LINUX24/osi_machdep.h @@ -197,14 +197,14 @@ typedef struct task_struct afs_proc_t; /* UIO manipulation */ typedef enum { AFS_UIOSYS, AFS_UIOUSER } uio_seg_t; typedef enum { UIO_READ, UIO_WRITE } uio_flag_t; -typedef struct uio { +struct uio { struct iovec *uio_iov; int uio_iovcnt; afs_offs_t uio_offset; uio_seg_t uio_seg; int uio_resid; uio_flag_t uio_flag; -} uio_t; +}; #define afsio_iov uio_iov #define afsio_iovcnt uio_iovcnt #define afsio_offset uio_offset diff --git a/src/afs/LINUX24/osi_prototypes.h b/src/afs/LINUX24/osi_prototypes.h index 5a1e59e..ad2522c 100644 --- a/src/afs/LINUX24/osi_prototypes.h +++ b/src/afs/LINUX24/osi_prototypes.h @@ -37,7 +37,7 @@ extern afs_rwlock_t afs_xnfssrv; /* osi_file.c */ extern afs_rwlock_t afs_xosi; extern int osi_InitCacheInfo(char *aname); -extern int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw); +extern int osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw); extern struct file *afs_linux_raw_open(afs_dcache_id_t *ainode, ino_t *hint); /* osi_ioctl.c */ diff --git a/src/afs/LINUX24/osi_vnodeops.c b/src/afs/LINUX24/osi_vnodeops.c index df01f85..f86b0d2 100644 --- a/src/afs/LINUX24/osi_vnodeops.c +++ b/src/afs/LINUX24/osi_vnodeops.c @@ -1409,7 +1409,7 @@ afs_linux_ireadlink(struct inode *ip, char *target, int maxlen, uio_seg_t seg) { int code; cred_t *credp = crref(); - uio_t tuio; + struct uio tuio; struct iovec iov; setup_uio(&tuio, &iov, target, (afs_offs_t) 0, maxlen, UIO_READ, seg); @@ -1545,7 +1545,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) afs_int32 isize; #endif - uio_t *auio; + struct uio *auio; struct iovec *iovecp; struct inode *ip = FILE_INODE(fp); afs_int32 cnt = page_count(pp); @@ -1562,7 +1562,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) clear_bit(PG_error, &pp->flags); #endif /* if bypasscache, receiver frees, else we do */ - auio = osi_Alloc(sizeof(uio_t)); + auio = osi_Alloc(sizeof(struct uio)); iovecp = osi_Alloc(sizeof(struct iovec)); setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ, @@ -1640,7 +1640,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) goto done; /* free if not bypassing cache */ - osi_Free(auio, sizeof(uio_t)); + osi_Free(auio, sizeof(struct uio)); osi_Free(iovecp, sizeof(struct iovec)); if (!code && AFS_CHUNKOFFSET(offset) == 0) { @@ -1676,7 +1676,7 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp, afs_offs_t base; int code = 0; cred_t *credp; - uio_t tuio; + struct uio tuio; struct iovec iovec; int f_flags = 0; @@ -1786,7 +1786,7 @@ afs_linux_updatepage(struct file *fp, struct page *pp, unsigned long offset, u8 *page_addr = (u8 *) afs_linux_page_address(pp); int code = 0; cred_t *credp; - uio_t tuio; + struct uio tuio; struct iovec iovec; set_bit(PG_locked, &pp->flags); diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c index c52ba16..e9fcb52 100644 --- a/src/afs/afs_bypasscache.c +++ b/src/afs/afs_bypasscache.c @@ -296,7 +296,7 @@ done: static afs_int32 afs_NoCacheFetchProc(struct rx_call *acall, struct vcache *avc, - uio_t *auio, + struct uio *auio, afs_int32 release_pages, afs_int32 size) { @@ -497,7 +497,7 @@ cleanup: osi_Free(areq, sizeof(struct vrequest)); osi_Free(bparms->auio->uio_iov, bparms->auio->uio_iovcnt * sizeof(struct iovec)); - osi_Free(bparms->auio, sizeof(uio_t)); + osi_Free(bparms->auio, sizeof(struct uio)); osi_Free(bparms, sizeof(struct nocache_read_request)); return code; } @@ -509,7 +509,7 @@ afs_PrefetchNoCache(struct vcache *avc, afs_ucred_t *acred, struct nocache_read_request *bparms) { - uio_t *auio; + struct uio *auio; struct iovec *iovecp; struct vrequest *areq; afs_int32 code = 0; @@ -617,7 +617,7 @@ done: osi_Free(tcallspec, sizeof(struct tlocal1)); osi_Free(iovecp, auio->uio_iovcnt * sizeof(struct iovec)); osi_Free(bparms, sizeof(struct nocache_read_request)); - osi_Free(auio, sizeof(uio_t)); + osi_Free(auio, sizeof(struct uio)); return code; } diff --git a/src/afs/afs_bypasscache.h b/src/afs/afs_bypasscache.h index af90bc4..cac210d 100644 --- a/src/afs/afs_bypasscache.h +++ b/src/afs/afs_bypasscache.h @@ -71,7 +71,6 @@ #define AFS_CACHE_BYPASS_DISABLED -1 #ifdef UKERNEL -typedef struct uio uio_t; #ifndef PAGE_SIZE #define PAGE_SIZE 1024 * sizeof(long) / 8 #endif @@ -94,7 +93,7 @@ struct nocache_read_request { int32 length; #elif defined(AFS_LINUX24_ENV) || defined(AFS_USR_LINUX24_ENV) /* The tested platform, as CITI impl. just packs ab->parms */ - uio_t * auio; + struct uio *auio; struct vrequest *areq; afs_size_t offset; afs_size_t length; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 200f5c5..2f37d5a 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -637,11 +637,11 @@ extern void afs_osi_SetTime(osi_timeval_t * atv); extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink, struct dentry **dpp); extern int osi_InitCacheInfo(char *aname); -extern int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw); -extern void setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf, +extern int osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw); +extern void setup_uio(struct uio *uiop, struct iovec *iovecp, const char *buf, afs_offs_t pos, int count, uio_flag_t flag, uio_seg_t seg); -extern int uiomove(char *dp, int length, uio_flag_t rw, uio_t * uiop); +extern int uiomove(char *dp, int length, uio_flag_t rw, struct uio *uiop); extern void osi_linux_free_inode_pages(void); #endif extern void osi_linux_mask(void);