当前位置: 首页>>代码示例>>C++>>正文


C++ osi_Panic函数代码示例

本文整理汇总了C++中osi_Panic函数的典型用法代码示例。如果您正苦于以下问题:C++ osi_Panic函数的具体用法?C++ osi_Panic怎么用?C++ osi_Panic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osi_Panic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: afs_DbgDisconFiles

/*!
 * Print list of disconnected files.
 *
 * \note Call with afs_DDirtyVCListLock read locked.
 */
void
afs_DbgDisconFiles(void)
{
    struct vcache *tvc;
    struct afs_q *q;
    int i = 0;

    afs_warn("List of dirty files: \n");

    ObtainReadLock(&afs_disconDirtyLock);
    for (q = QPrev(&afs_disconDirty); q != &afs_disconDirty; q = QPrev(q)) {
        tvc = QEntry(q, struct vcache, dirtyq);

	afs_warn("Cell=%u Volume=%u VNode=%u Unique=%u\n",
		tvc->f.fid.Cell,
		tvc->f.fid.Fid.Volume,
		tvc->f.fid.Fid.Vnode,
		tvc->f.fid.Fid.Unique);

	i++;
	if (i >= 30)
	    osi_Panic("afs_DbgDisconFiles: loop in dirty list\n");
    }
    ReleaseReadLock(&afs_disconDirtyLock);
}
开发者ID:hwr,项目名称:openafs,代码行数:30,代码来源:afs_disconnected.c

示例2: VnodeToSize

afs_int32
VnodeToSize(vnode_t * vp)
{
    int code;
    struct vattr vattr;

    /*
     * We lock xosi in osi_Stat, so we probably should
     * lock it here too - RWH.
     */
    ObtainWriteLock(&afs_xosi, 578);
    vattr.va_mask = AT_SIZE;
    AFS_GUNLOCK();
#ifdef AFS_SUN511_ENV
    code = VOP_GETATTR(vp, &vattr, 0, afs_osi_credp, NULL);
#else
    code = VOP_GETATTR(vp, &vattr, 0, afs_osi_credp);
#endif
    AFS_GLOCK();
    if (code) {
	osi_Panic("VnodeToSize");
    }
    ReleaseWriteLock(&afs_xosi);
    return (afs_int32) (vattr.va_size);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:25,代码来源:osi_file.c

示例3: afs_osi_Write

/* Generic write interface */
int
afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
	      afs_int32 asize)
{
    afs_ucred_t *oldCred;
    ssize_t resid;
    afs_int32 code;
    AFS_STATCNT(osi_Write);
    if (!afile)
	osi_Panic("afs_osi_Write called with null param");
    if (offset != -1)
	afile->offset = offset;
    AFS_GUNLOCK();
    code =
	gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
		 afile->offset, AFS_UIOSYS, 0, RLIM64_INFINITY, afs_osi_credp,
		 &resid);
    AFS_GLOCK();
    if (code == 0) {
	code = asize - resid;
	afile->offset += code;
    } else {
	if (code > 0) {
	    code = -code;
	}
    }
    if (afile->proc) {
	(*afile->proc) (afile, code);
    }
    return code;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:32,代码来源:osi_file.c

示例4: afs_osi_Write

/* Generic write interface */
int
afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
	      afs_int32 asize)
{
    afs_ucred_t *oldCred;
    long resid;
    afs_int32 code;
    AFS_STATCNT(osi_Write);
    if (!afile)
	osi_Panic("afs_osi_Write called with null param");
    if (offset != -1)
	afile->offset = offset;
    AFS_GUNLOCK();
    code =
	gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
		 afile->offset, AFS_UIOSYS, IO_UNIT, &resid);
    AFS_GLOCK();
    if (code == 0) {
	code = asize - resid;
	afile->offset += code;
    } else {
	if (code == ENOSPC)
	    afs_warnuser
		("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
	setuerror(code);
	if (code > 0) {
	    code = -code;
	}
    }
    if (afile->proc) {
	(*afile->proc) (afile, code);
    }
    return code;
}
开发者ID:haught,项目名称:openafs,代码行数:35,代码来源:osi_file.c

示例5: afs_evict_inode

static void
afs_evict_inode(struct inode *ip)
{
    struct vcache *vcp = VTOAFS(ip);

    if (vcp->vlruq.prev || vcp->vlruq.next)
	osi_Panic("inode freed while on LRU");
    if (vcp->hnext)
	osi_Panic("inode freed while still hashed");

    truncate_inode_pages(&ip->i_data, 0);
    end_writeback(ip);

#if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
#endif
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:17,代码来源:osi_vfsops.c

示例6: osi_NetReceive

int
osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr,
	       struct iovec *dvec, int nvecs, int *alength)
{
    struct uio u;
    int i;
    struct iovec iov[RX_MAXIOVECS];
    struct sockaddr *sa = NULL;
    int code;

    int haveGlock = ISAFS_GLOCK();
    /*AFS_STATCNT(osi_NetReceive); */

    if (nvecs > RX_MAXIOVECS)
	osi_Panic("osi_NetReceive: %d: Too many iovecs.\n", nvecs);

    for (i = 0; i < nvecs; i++)
	iov[i] = dvec[i];

    u.uio_iov = &iov[0];
    u.uio_iovcnt = nvecs;
    u.uio_offset = 0;
    u.uio_resid = *alength;
    u.uio_segflg = UIO_SYSSPACE;
    u.uio_rw = UIO_READ;
#ifdef AFS_FBSD50_ENV
    u.uio_td = NULL;
#else
    u.uio_procp = NULL;
#endif

    if (haveGlock)
	AFS_GUNLOCK();
    code = soreceive(asocket, &sa, &u, NULL, NULL, NULL);
    if (haveGlock)
	AFS_GLOCK();

    if (code) {
#if KNET_DEBUG
	if (code == EINVAL)
	    Debugger("afs NetReceive busted");
	else
	    printf("y");
#else
	return code;
#endif
    }
    *alength -= u.uio_resid;
    if (sa) {
	if (sa->sa_family == AF_INET) {
	    if (addr)
		*addr = *(struct sockaddr_in *)sa;
	} else
	    printf("Unknown socket family %d in NetReceive\n", sa->sa_family);
	FREE(sa, M_SONAME);
    }
    return code;
}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:58,代码来源:rx_knet.c

示例7: osi_NetSend

int
osi_NetSend(osi_socket asocket, struct sockaddr_in *addr, struct iovec *dvec,
	    int nvecs, afs_int32 alength, int istack)
{
    register afs_int32 code;
    int i;
    struct iovec iov[RX_MAXIOVECS];
    struct uio u;
    int haveGlock = ISAFS_GLOCK();

    AFS_STATCNT(osi_NetSend);
    if (nvecs > RX_MAXIOVECS)
	osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs);

    for (i = 0; i < nvecs; i++)
	iov[i] = dvec[i];

    u.uio_iov = &iov[0];
    u.uio_iovcnt = nvecs;
    u.uio_offset = 0;
    u.uio_resid = alength;
    u.uio_segflg = UIO_SYSSPACE;
    u.uio_rw = UIO_WRITE;
#ifdef AFS_FBSD50_ENV
    u.uio_td = NULL;
#else
    u.uio_procp = NULL;
#endif

    addr->sin_len = sizeof(struct sockaddr_in);

    if (haveGlock)
	AFS_GUNLOCK();
#if KNET_DEBUG
    printf("+");
#endif
#ifdef AFS_FBSD50_ENV
    code =
	sosend(asocket, (struct sockaddr *)addr, &u, NULL, NULL, 0,
	       curthread);
#else
    code =
	sosend(asocket, (struct sockaddr *)addr, &u, NULL, NULL, 0, curproc);
#endif
#if KNET_DEBUG
    if (code) {
	if (code == EINVAL)
	    Debugger("afs NetSend busted");
	else
	    printf("z");
    }
#endif
    if (haveGlock)
	AFS_GLOCK();
    return code;
}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:56,代码来源:rx_knet.c

示例8: osi_NetReceive

int
osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr,
	       struct iovec *dvec, int nvecs, int *alength)
{
    struct uio u;
    int i, code;
    struct iovec iov[RX_MAXIOVECS];
    struct mbuf *nam = NULL;

    int haveGlock = ISAFS_GLOCK();

    memset(&u, 0, sizeof(u));
    memset(&iov, 0, sizeof(iov));

    if (nvecs > RX_MAXIOVECS)
	osi_Panic("osi_NetReceive: %d: too many iovecs\n", nvecs);

    for (i = 0; i < nvecs; i++)
	iov[i] = dvec[i];

    u.uio_iov = &iov[0];
    u.uio_iovcnt = nvecs;
    u.uio_offset = 0;
    u.uio_resid = *alength;
    u.uio_segflg = UIO_SYSSPACE;
    u.uio_rw = UIO_READ;
    u.uio_procp = NULL;

    if (haveGlock)
	AFS_GUNLOCK();
    code = soreceive(asocket, (addr ? &nam : NULL), &u, NULL, NULL, NULL
#if defined(AFS_OBSD45_ENV)
		     , 0
#endif
		     );
    if (haveGlock)
	AFS_GLOCK();

    if (code) {
#ifdef RXKNET_DEBUG
	printf("rx code %d termState %d\n", code, afs_termState);
#endif
	while (afs_termState == AFSOP_STOP_RXEVENT)
	    afs_osi_Sleep(&afs_termState);
	return code;
    }

    *alength -= u.uio_resid;
    if (addr && nam) {
	memcpy(addr, mtod(nam, caddr_t), nam->m_len);
	m_freem(nam);
    }

    return code;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:55,代码来源:rx_knet.c

示例9: afs_mutex_exit

void
afs_mutex_exit(afs_kmutex_t * l)
{
    if (l->owner != current->pid)
	osi_Panic("mutex_exit: 0x%lx held by %d", (unsigned long)l, l->owner);
    l->owner = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
    mutex_unlock(&l->mutex);
#else
    up(&l->sem);
#endif
}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:12,代码来源:rx_kmutex.c

示例10: afs_mutex_enter

void
afs_mutex_enter(afs_kmutex_t * l)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
    mutex_lock(&l->mutex);
#else
    down(&l->sem);
#endif
    if (l->owner)
	osi_Panic("mutex_enter: 0x%lx held by %d", (unsigned long)l, l->owner);
    l->owner = current->pid;
}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:12,代码来源:rx_kmutex.c

示例11: osi_NetReceive

int
osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov,
	       int iovcnt, int *lengthp)
{
    struct msghdr msg;
    int code;
#ifdef ADAPT_PMTU
    int sockerr;
    int esize;
#endif
    struct iovec tmpvec[RX_MAXWVECS + 2];
    struct socket *sop = (struct socket *)so;

    if (iovcnt > RX_MAXWVECS + 2) {
	osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt);
    }
#ifdef ADAPT_PMTU
    while (1) {
	sockerr=0;
	esize = sizeof(sockerr);
	kernel_getsockopt(sop, SOL_SOCKET, SO_ERROR, (char *)&sockerr, &esize);
	if (sockerr == 0)
	   break;
	handle_socket_error(so);
    }
#endif
    memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
    msg.msg_name = from;
    msg.msg_iov = tmpvec;
    msg.msg_iovlen = iovcnt;
    msg.msg_control = NULL;
    msg.msg_controllen = 0;
    msg.msg_flags = 0;

    code = kernel_recvmsg(sop, &msg, (struct kvec *)tmpvec, iovcnt,
			  *lengthp, 0);
    if (code < 0) {
	afs_try_to_freeze();

	/* Clear the error before using the socket again.
	 * Oh joy, Linux has hidden header files as well. It appears we can
	 * simply call again and have it clear itself via sock_error().
	 */
	flush_signals(current);	/* We don't want no stinkin' signals. */
	rxk_lastSocketError = code;
	rxk_nSocketErrors++;
    } else {
	*lengthp = code;
	code = 0;
    }

    return code;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:53,代码来源:rx_knet.c

示例12: afs_MemCacheOpen

void *
afs_MemCacheOpen(afs_dcache_id_t *ainode)
{
    struct memCacheEntry *mep;

    if (ainode->mem < 0 || ainode->mem > memMaxBlkNumber) {
	osi_Panic("afs_MemCacheOpen: invalid block #");
    }
    mep = (memCache + ainode->mem);
    afs_Trace3(afs_iclSetp, CM_TRACE_MEMOPEN, ICL_TYPE_INT32, ainode->mem,
	       ICL_TYPE_POINTER, mep, ICL_TYPE_POINTER, mep ? mep->data : 0);
    return (void *)mep;
}
开发者ID:adeason,项目名称:openafs,代码行数:13,代码来源:afs_memcache.c

示例13: osi_UFSOpen

void *
osi_UFSOpen(afs_int32 ainode)
{
    struct osi_file *afile;
    struct vnode *vp;
    extern int cacheDiskType;
    afs_int32 code;

    AFS_STATCNT(osi_UFSOpen);
    if (cacheDiskType != AFS_FCACHE_TYPE_UFS)
	osi_Panic("UFSOpen called for non-UFS cache\n");
    afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
    AFS_GUNLOCK();
#if defined(AFS_FBSD50_ENV)
    code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode, LK_EXCLUSIVE, &vp);
#else
    code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode, &vp);
#endif
    AFS_GLOCK();
    if (code == 0 && vp->v_type == VNON)
	code = ENOENT;
    if (code) {
	osi_FreeSmallSpace(afile);
	osi_Panic("UFSOpen: igetinode failed");
    }
#if defined(AFS_FBSD80_ENV)
    VOP_UNLOCK(vp, 0);
#elif defined(AFS_FBSD50_ENV)
    VOP_UNLOCK(vp, 0, curthread);
#else
    VOP_UNLOCK(vp, 0, curproc);
#endif
    afile->vnode = vp;
    afile->size = VTOI(vp)->i_size;
    afile->offset = 0;
    afile->proc = NULL;
    afile->inum = ainode;	/* for hint validity checking */
    return (void *)afile;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:39,代码来源:osi_file.c

示例14: afs_osi_Read

/* Generic read interface */
int
afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
	     afs_int32 asize)
{
    afs_ucred_t *oldCred;
    long resid;
    afs_int32 code;
    afs_int32 cnt1 = 0;
    AFS_STATCNT(osi_Read);

    /**
      * If the osi_file passed in is NULL, panic only if AFS is not shutting
      * down. No point in crashing when we are already shutting down
      */
    if (!afile) {
	if (afs_shuttingdown == AFS_RUNNING)
	    osi_Panic("osi_Read called with null param");
	else
	    return -EIO;
    }

    if (offset != -1)
	afile->offset = offset;
  retry_IO:
    AFS_GUNLOCK();
    code =
	gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
		 AFS_UIOSYS, IO_UNIT, &resid);
    AFS_GLOCK();
    if (code == 0) {
	code = asize - resid;
	afile->offset += code;
	osi_DisableAtimes(afile->vnode);
    } else {
	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32,
		   (afs_int32) resid, ICL_TYPE_INT32, code);
	/*
	 * To handle periodic low-level EFAULT failures that we've seen with the
	 * Weitek chip; in all observed failed cases a second read succeeded.
	 */
	if ((code == EFAULT) && (cnt1++ < 5)) {
	    afs_stats_cmperf.osiread_efaults++;
	    goto retry_IO;
	}
	setuerror(code);
	if (code > 0) {
	    code *= -1;
	}
    }
    return code;
}
开发者ID:chanke,项目名称:openafs-osd,代码行数:52,代码来源:osi_file.c

示例15: osi_UFSOpen

void *
osi_UFSOpen(afs_dcache_id_t *ainode)
{
    struct osi_file *afile = NULL;
    extern int cacheDiskType;

    AFS_STATCNT(osi_UFSOpen);
    if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
	osi_Panic("UFSOpen called for non-UFS cache\n");
    }
    if (!afs_osicred_initialized) {
	memset(&afs_osi_cred, 0, sizeof(afs_ucred_t));
	crhold(&afs_osi_cred);	/* don't let it evaporate, since it is static */
	afs_osicred_initialized = 1;
    }
    AFS_GUNLOCK();
    afile = kmalloc(sizeof(struct osi_file), GFP_NOFS);
    if (!afile) {
	osi_Panic("osi_UFSOpen: Failed to allocate %d bytes for osi_file.\n",
		  (int)sizeof(struct osi_file));
    }
    memset(afile, 0, sizeof(struct osi_file));

    afile->filp = afs_linux_raw_open(ainode);
    if (afile->filp) {
        afile->size = i_size_read(FILE_INODE(afile->filp));
    }
    AFS_GLOCK();

    if (!afile->filp) {
        osi_FreeLargeSpace(afile);
        return NULL;
    }

    afile->offset = 0;
    afile->proc = (int (*)())0;
    return (void *)afile;
}
开发者ID:openafs,项目名称:openafs,代码行数:38,代码来源:osi_file.c


注:本文中的osi_Panic函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。