本文整理汇总了C++中pool_put函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_put函数的具体用法?C++ pool_put怎么用?C++ pool_put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pool_put函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ffs_reclaim
/*
* Reclaim an inode so that it can be used for other purposes.
*/
int
ffs_reclaim(void *v)
{
struct vop_reclaim_args *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
int error;
if ((error = ufs_reclaim(vp, ap->a_p)) != 0)
return (error);
if (ip->i_din1 != NULL) {
#ifdef FFS2
if (ip->i_ump->um_fstype == UM_UFS2)
pool_put(&ffs_dinode2_pool, ip->i_din2);
else
#endif
pool_put(&ffs_dinode1_pool, ip->i_din1);
}
pool_put(&ffs_ino_pool, ip);
vp->v_data = NULL;
return (0);
}
开发者ID:DavidAlphaFox,项目名称:openbsd-kernel,代码行数:29,代码来源:ffs_vnops.c
示例2: mysqlfs_chown
static int mysqlfs_chown(const char *path, uid_t uid, gid_t gid)
{
int ret;
long inode;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "mysql_chown(\"%s\", %ld, %ld)\n", path, uid, gid);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if (inode < 0) {
pool_put(dbconn);
return inode;
}
ret = query_chown(dbconn, inode, uid, gid);
if(ret){
log_printf(LOG_ERROR, "Error: query_chown()\n");
pool_put(dbconn);
return -EIO;
}
pool_put(dbconn);
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:28,代码来源:mysqlfs.c
示例3: mysqlfs_chmod
static int mysqlfs_chmod(const char* path, mode_t mode)
{
int ret;
long inode;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "mysql_chmod(\"%s\", 0%3o)\n", path, mode);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if (inode < 0) {
pool_put(dbconn);
return inode;
}
ret = query_chmod(dbconn, inode, mode);
if(ret){
log_printf(LOG_ERROR, "Error: query_chmod()\n");
pool_put(dbconn);
return -EIO;
}
pool_put(dbconn);
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:28,代码来源:mysqlfs.c
示例4: ext2fs_reclaim
/*
* Reclaim an inode so that it can be used for other purposes.
*/
int
ext2fs_reclaim(void *v)
{
struct vop_reclaim_args *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip;
#ifdef DIAGNOSTIC
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ext2fs_reclaim: pushing active", vp);
#endif
/*
* Remove the inode from its hash chain.
*/
ip = VTOI(vp);
ufs_ihashrem(ip);
/*
* Purge old data structures associated with the inode.
*/
cache_purge(vp);
if (ip->i_devvp)
vrele(ip->i_devvp);
if (ip->i_e2din != NULL)
pool_put(&ext2fs_dinode_pool, ip->i_e2din);
pool_put(&ext2fs_inode_pool, ip);
vp->v_data = NULL;
return (0);
}
开发者ID:sofuture,项目名称:bitrig,代码行数:38,代码来源:ext2fs_vnops.c
示例5: mysqlfs_utime
static int mysqlfs_utime(const char *path, struct utimbuf *time)
{
int ret;
long inode;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "mysql_utime(\"%s\")\n", path);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if (inode < 0) {
pool_put(dbconn);
return inode;
}
ret = query_utime(dbconn, inode, time);
if (ret < 0) {
log_printf(LOG_ERROR, "Error: query_utime()\n");
pool_put(dbconn);
return -EIO;
}
pool_put(dbconn);
return 0;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:28,代码来源:mysqlfs.c
示例6: m_free
struct mbuf *
m_free(struct mbuf *m)
{
struct mbuf *n;
int s;
s = splvm();
mbstat.m_mtypes[m->m_type]--;
if (m->m_flags & M_PKTHDR)
m_tag_delete_chain(m);
if (m->m_flags & M_EXT) {
if (MCLISREFERENCED(m))
_MCLDEREFERENCE(m);
else if (m->m_flags & M_CLUSTER)
pool_put(&mclpool, m->m_ext.ext_buf);
else if (m->m_ext.ext_free)
(*(m->m_ext.ext_free))(m->m_ext.ext_buf,
m->m_ext.ext_size, m->m_ext.ext_arg);
else
free(m->m_ext.ext_buf,m->m_ext.ext_type);
m->m_ext.ext_size = 0;
}
m->m_flags = 0;
n = m->m_next;
pool_put(&mbpool, m);
splx(s);
return (n);
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:29,代码来源:uipc_mbuf.c
示例7: mysqlfs_symlink
static int mysqlfs_symlink(const char *from, const char *to)
{
int ret;
int inode;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "%s(\"%s\" -> \"%s\")\n", __func__, from, to);
ret = mysqlfs_mknod(to, S_IFLNK | 0755, 0);
if (ret < 0)
return ret;
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, to);
if(inode < 0){
pool_put(dbconn);
return -ENOENT;
}
ret = query_write(dbconn, inode, from, strlen(from), 0);
if (ret > 0) ret = 0;
pool_put(dbconn);
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:28,代码来源:mysqlfs.c
示例8: mysqlfs_mkdir
static int mysqlfs_mkdir(const char *path, mode_t mode){
int ret;
MYSQL *dbconn;
long inode;
char dir_path[PATH_MAX];
log_printf(LOG_D_CALL, "mysqlfs_mkdir(\"%s\", 0%o)\n", path, mode);
if(!(strlen(path) < PATH_MAX)){
log_printf(LOG_ERROR, "Error: Filename too long\n");
return -ENAMETOOLONG;
}
strncpy(dir_path, path, PATH_MAX);
dirname(dir_path);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, dir_path);
if(inode < 0){
pool_put(dbconn);
return -ENOENT;
}
ret = query_mkdir(dbconn, path, mode, inode);
if(ret < 0){
log_printf(LOG_ERROR, "Error: query_mkdir()\n");
pool_put(dbconn);
return ret;
}
pool_put(dbconn);
return 0;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:34,代码来源:mysqlfs.c
示例9: mysqlfs_readlink
static int mysqlfs_readlink(const char *path, char *buf, size_t size)
{
int ret;
long inode;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "%s(\"%s\")\n", __func__, path);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if(inode < 0){
pool_put(dbconn);
return -ENOENT;
}
memset (buf, 0, size);
ret = query_read(dbconn, inode, buf, size, 0);
log_printf(LOG_DEBUG, "readlink(%s): %s [%zd -> %d]\n", path, buf, size, ret);
pool_put(dbconn);
if (ret > 0) ret = 0;
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:25,代码来源:mysqlfs.c
示例10: sonewconn
/*
* When an attempt at a new connection is noted on a socket
* which accepts connections, sonewconn is called. If the
* connection is possible (subject to space constraints, etc.)
* then we allocate a new structure, properly linked into the
* data structure of the original socket, and return this.
* Connstatus may be 0 or SS_ISCONNECTED.
*
* Must be called at splsoftnet()
*/
struct socket *
sonewconn(struct socket *head, int connstatus)
{
struct socket *so;
int soqueue = connstatus ? 1 : 0;
splsoftassert(IPL_SOFTNET);
if (mclpools[0].pr_nout > mclpools[0].pr_hardlimit * 95 / 100)
return (NULL);
if (head->so_qlen + head->so_q0len > head->so_qlimit * 3)
return (NULL);
so = pool_get(&socket_pool, PR_NOWAIT|PR_ZERO);
if (so == NULL)
return (NULL);
so->so_type = head->so_type;
so->so_options = head->so_options &~ SO_ACCEPTCONN;
so->so_linger = head->so_linger;
so->so_state = head->so_state | SS_NOFDREF;
so->so_proto = head->so_proto;
so->so_timeo = head->so_timeo;
so->so_pgid = head->so_pgid;
so->so_euid = head->so_euid;
so->so_ruid = head->so_ruid;
so->so_egid = head->so_egid;
so->so_rgid = head->so_rgid;
so->so_cpid = head->so_cpid;
so->so_siguid = head->so_siguid;
so->so_sigeuid = head->so_sigeuid;
/*
* Inherit watermarks but those may get clamped in low mem situations.
*/
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) {
pool_put(&socket_pool, so);
return (NULL);
}
so->so_snd.sb_wat = head->so_snd.sb_wat;
so->so_snd.sb_lowat = head->so_snd.sb_lowat;
so->so_snd.sb_timeo = head->so_snd.sb_timeo;
so->so_rcv.sb_wat = head->so_rcv.sb_wat;
so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;
so->so_rcv.sb_timeo = head->so_rcv.sb_timeo;
soqinsque(head, so, soqueue);
if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH, NULL, NULL, NULL,
curproc)) {
(void) soqremque(so, soqueue);
pool_put(&socket_pool, so);
return (NULL);
}
if (connstatus) {
sorwakeup(head);
wakeup(&head->so_timeo);
so->so_state |= connstatus;
}
return (so);
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:68,代码来源:uipc_socket2.c
示例11: mysqlfs_open
static int mysqlfs_open(const char *path, struct fuse_file_info *fi)
{
MYSQL *dbconn;
long inode;
int ret;
log_printf(LOG_D_CALL, "mysqlfs_open(\"%s\")\n", path);
#ifdef STATUSDIR
/* take a short-circuit for the bogus virtual files */
if (0 == strncmp (path, status_pathname, len_status_pathname))
{
char *a = (char *) path + len_status_pathname;
log_printf(LOG_D_CALL, "%s(\"%s\")(@%d)\n", __FUNCTION__, a, __LINE__);
if (0 == strcmp (a, "/txt"))
{
fi->fh = inode_status_txt;
return 0;
}
else if (0 == strcmp (a, "/xml"))
{
fi->fh = inode_status_xml;
return 0;
}
/* otherwise, fall-thru to a inode-lookup failure */
}
#endif
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if(inode < 0){
pool_put(dbconn);
return -ENOENT;
}
/* Save inode for future use. Lets us skip path->inode translation. */
fi->fh = inode;
log_printf(LOG_D_OTHER, "inode(\"%s\") = %d\n", path, fi->fh);
ret = query_inuse_inc(dbconn, inode, 1);
if (ret < 0) {
pool_put(dbconn);
return ret;
}
pool_put(dbconn);
return 0;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:54,代码来源:mysqlfs.c
示例12: mysqlfs_unlink
static int mysqlfs_unlink(const char *path)
{
int ret;
long inode, parent, nlinks;
char name[PATH_MAX];
MYSQL *dbconn;
log_printf(LOG_D_CALL, "mysqlfs_unlink(\"%s\")\n", path);
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
ret = query_inode_full(dbconn, path, name, sizeof(name),
&inode, &parent, &nlinks);
if (ret < 0) {
if (ret != -ENOENT)
log_printf(LOG_ERROR, "Error: query_inode_full(%s): %s\n",
path, strerror(ret));
goto err_out;
}
ret = query_rmdirentry(dbconn, name, parent);
if (ret < 0) {
log_printf(LOG_ERROR, "Error: query_rmdirentry()\n");
goto err_out;
}
/* Only the last unlink() must set deleted flag.
* This is a shortcut - query_set_deleted() wouldn't
* set the flag if there is still an existing direntry
* anyway. But we'll save some DB processing here. */
if (nlinks > 1)
return 0;
ret = query_set_deleted(dbconn, inode);
if (ret < 0) {
log_printf(LOG_ERROR, "Error: query_set_deleted()\n");
goto err_out;
}
ret = query_purge_deleted(dbconn, inode);
if (ret < 0) {
log_printf(LOG_ERROR, "Error: query_purge_deleted()\n");
goto err_out;
}
pool_put(dbconn);
return 0;
err_out:
pool_put(dbconn);
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:54,代码来源:mysqlfs.c
示例13: mysqlfs_readdir
static int mysqlfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
(void) offset;
(void) fi;
int ret;
MYSQL *dbconn;
long inode;
log_printf(LOG_D_CALL, "mysqlfs_readdir(\"%s\")\n", path);
#ifdef STATUSDIR
if (0 == strcmp (path, status_pathname))
{
/* if printing the bogus "status" directory, dump the content and get out */
log_printf(LOG_D_CALL, "mysqlfs_readdir(\"%s\")(@%d)\n", path, __LINE__);
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
filler(buf, "txt", NULL, 0);
filler(buf, "xml", NULL, 0);
return 0;
}
#endif
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
inode = query_inode(dbconn, path);
if(inode < 0){
log_printf(LOG_ERROR, "Error: query_inode()\n");
pool_put(dbconn);
return inode;
}
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
#ifdef STATUSDIR
/* stuff in the bogus status subdir */
if (0 == strcmp (path, "/"))
{
log_printf(LOG_D_CALL, "mysqlfs_readdir(\"%s\")(@%d)\n", path, __LINE__);
filler(buf, status_pathname+1, NULL, 0);
}
#endif
ret = query_readdir(dbconn, inode, buf, filler);
pool_put(dbconn);
return 0;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:54,代码来源:mysqlfs.c
示例14: mysqlfs_read
static int mysqlfs_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
int ret;
MYSQL *dbconn;
log_printf(LOG_D_CALL, "mysqlfs_read(\"%s\" %[email protected]%llu)\n", path, size, offset);
#ifdef STATUSDIR
/* take a short-circuit for the bogus virtual files */
if (0 == strncmp (path, status_pathname, len_status_pathname))
{
char *a = (char *) path + len_status_pathname;
log_printf(LOG_D_CALL, "%s(\"%s\")(@%d)\n", __FUNCTION__, a, __LINE__);
return mysqlfs_status_read(a, buf, size, offset, fi);
}
#endif
/* see http://www.macosxhints.com/article.php?story=20060814124808745 */
if ( (0 < theopts->osxnospotlight) && (0 == strcmp (path, "/.metadata_never_index")))
{
char *a = PACKAGE_STRING; /* in case I cannot point directly to static content */
int l = MIN(strlen(PACKAGE_STRING)-offset,size); /* tossaway length calc */
strncpy (buf, a+offset, l);
return l;
}
if ((dbconn = pool_get()) == NULL)
return -EMFILE;
ret = query_read(dbconn, fi->fh, buf, size, offset);
pool_put(dbconn);
return ret;
}
开发者ID:bianster,项目名称:mysqlfs,代码行数:34,代码来源:mysqlfs.c
示例15: ata_free_xfer
void
ata_free_xfer(struct ata_channel *chp, struct ata_xfer *xfer)
{
struct atac_softc *atac = chp->ch_atac;
int s;
if (xfer->c_flags & C_WAITACT) {
/* Someone is waiting for this xfer, so we can't free now */
xfer->c_flags |= C_FREE;
wakeup(xfer);
return;
}
#if NATA_PIOBM /* XXX wdc dependent code */
if (xfer->c_flags & C_PIOBM) {
struct wdc_softc *wdc = CHAN_TO_WDC(chp);
/* finish the busmastering PIO */
(*wdc->piobm_done)(wdc->dma_arg,
chp->ch_channel, xfer->c_drive);
chp->ch_flags &= ~(ATACH_DMA_WAIT | ATACH_PIOBM_WAIT | ATACH_IRQ_WAIT);
}
#endif
if (atac->atac_free_hw)
(*atac->atac_free_hw)(chp);
s = splbio();
pool_put(&ata_xfer_pool, xfer);
splx(s);
}
开发者ID:goroutines,项目名称:rumprun,代码行数:30,代码来源:ata.c
示例16: vnet_ldc_reset
void
vnet_ldc_reset(struct ldc_conn *lc)
{
struct vnet_softc *sc = lc->lc_sc;
int i;
timeout_del(&sc->sc_handshake_to);
sc->sc_tx_prod = sc->sc_tx_cons = 0;
sc->sc_peer_state = VIO_DP_STOPPED;
sc->sc_vio_state = 0;
vnet_link_state(sc);
sc->sc_lm->lm_next = 1;
sc->sc_lm->lm_count = 1;
for (i = 1; i < sc->sc_lm->lm_nentries; i++)
sc->sc_lm->lm_slot[i].entry = 0;
for (i = 0; i < sc->sc_vd->vd_nentries; i++) {
if (sc->sc_vsd[i].vsd_buf) {
pool_put(&sc->sc_pool, sc->sc_vsd[i].vsd_buf);
sc->sc_vsd[i].vsd_buf = NULL;
}
sc->sc_vd->vd_desc[i].hdr.dstate = VIO_DESC_FREE;
}
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:25,代码来源:vnet.c
示例17: bn_clean
void bn_clean(bn_t a) {
#if ALLOC == DYNAMIC
if (a != NULL) {
if (a->dp != NULL) {
#if OPSYS == WINDOWS && ALIGN > 1
_aligned_free(a->dp);
#else
free(a->dp);
#endif
a->dp = NULL;
}
a->alloc = 0;
}
#endif
#if ALLOC == STATIC
if (a != NULL && a->dp != NULL) {
pool_put(a->dp);
a->dp = NULL;
}
#endif
if (a != NULL) {
a->used = 0;
a->sign = BN_POS;
}
}
开发者ID:0x64616E69656C,项目名称:supercop,代码行数:25,代码来源:relic_bn_mem.c
示例18: m_free
struct mbuf *
m_free(struct mbuf *m)
{
struct mbuf *n;
if (m == NULL)
return (NULL);
mtx_enter(&mbstatmtx);
mbstat.m_mtypes[m->m_type]--;
mtx_leave(&mbstatmtx);
n = m->m_next;
if (m->m_flags & M_ZEROIZE) {
m_zero(m);
/* propagate M_ZEROIZE to the next mbuf in the chain */
if (n)
n->m_flags |= M_ZEROIZE;
}
if (m->m_flags & M_PKTHDR)
m_tag_delete_chain(m);
if (m->m_flags & M_EXT)
m_extfree(m);
pool_put(&mbpool, m);
return (n);
}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:28,代码来源:uipc_mbuf.c
示例19: rtfree
void
rtfree(struct rtentry *rt)
{
struct ifaddr *ifa;
if (rt == NULL)
panic("rtfree");
rt->rt_refcnt--;
if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_UP) == 0) {
if (rt->rt_refcnt == 0 && (rt->rt_nodes->rn_flags & RNF_ACTIVE))
return; /* route still active but currently down */
if (rt->rt_nodes->rn_flags & (RNF_ACTIVE | RNF_ROOT))
panic("rtfree 2");
rttrash--;
if (rt->rt_refcnt < 0) {
printf("rtfree: %p not freed (neg refs)\n", rt);
return;
}
rt_timer_remove_all(rt);
ifa = rt->rt_ifa;
if (ifa)
IFAFREE(ifa);
rtlabel_unref(rt->rt_labelid);
#ifdef MPLS
if (rt->rt_flags & RTF_MPLS)
free(rt->rt_llinfo, M_TEMP);
#endif
Free(rt_key(rt));
pool_put(&rtentry_pool, rt);
}
}
开发者ID:7shi,项目名称:openbsd-loongson-vc,代码行数:33,代码来源:route.c
示例20: tmpfs_dirent_put
void
tmpfs_dirent_put(struct tmpfs_mount *mp, struct tmpfs_dirent *de)
{
tmpfs_mem_decr(mp, sizeof(struct tmpfs_dirent));
pool_put(&tmpfs_dirent_pool, de);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:7,代码来源:tmpfs_mem.c
注:本文中的pool_put函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论