本文整理汇总了C++中cache_purge函数的典型用法代码示例。如果您正苦于以下问题:C++ cache_purge函数的具体用法?C++ cache_purge怎么用?C++ cache_purge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_purge函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: genfs_rename_cache_purge
/*
* genfs_rename_cache_purge: Purge the name cache. To be called by
* gro_rename on success. The only pair of vnodes that may be
* identical is {fdvp, tdvp}.
*/
void
genfs_rename_cache_purge(struct vnode *fdvp, struct vnode *fvp,
struct vnode *tdvp, struct vnode *tvp)
{
KASSERT(fdvp != NULL);
KASSERT(fvp != NULL);
KASSERT(tdvp != NULL);
KASSERT(fdvp != fvp);
KASSERT(fdvp != tvp);
KASSERT(tdvp != fvp);
KASSERT(tdvp != tvp);
KASSERT(fvp != tvp);
KASSERT(fdvp->v_type == VDIR);
KASSERT(tdvp->v_type == VDIR);
/*
* XXX What actually needs to be purged?
*/
cache_purge(fdvp);
if (fvp->v_type == VDIR)
cache_purge(fvp);
if (tdvp != fdvp)
cache_purge(tdvp);
if ((tvp != NULL) && (tvp->v_type == VDIR))
cache_purge(tvp);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:36,代码来源:genfs_rename.c
示例2: cache_do_rename
static void cache_do_rename(const char *from, const char *to)
{
pthread_mutex_lock(&cache.lock);
cache_purge(from);
cache_purge(to);
cache_purge_parent(from);
cache_purge_parent(to);
pthread_mutex_unlock(&cache.lock);
}
开发者ID:mbouaziz,项目名称:xcurlftpfs,代码行数:9,代码来源:cache.c
示例3: _xfs_rename
static int
_xfs_rename(
struct vop_rename_args /* {
struct vnode *a_fdvp;
struct vnode *a_fvp;
struct componentname *a_fcnp;
struct vnode *a_tdvp;
struct vnode *a_tvp;
struct componentname *a_tcnp;
} */ *ap)
{
struct vnode *fvp = ap->a_fvp;
struct vnode *tvp = ap->a_tvp;
struct vnode *fdvp = ap->a_fdvp;
struct vnode *tdvp = ap->a_tdvp;
/* struct componentname *tcnp = ap->a_tcnp; */
/* struct componentname *fcnp = ap->a_fcnp;*/
int error = EPERM;
if (error)
goto out;
/* Check for cross-device rename */
if ((fvp->v_mount != tdvp->v_mount) ||
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
goto out;
}
if (tvp && tvp->v_usecount > 1) {
error = EBUSY;
goto out;
}
if (fvp->v_type == VDIR) {
if (tvp != NULL && tvp->v_type == VDIR)
cache_purge(tdvp);
cache_purge(fdvp);
}
out:
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
vrele(fdvp);
vrele(fvp);
vgone(fvp);
if (tvp)
vgone(tvp);
return (error);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:53,代码来源:xfs_vnops.c
示例4: osi_VM_FlushVCache
/* Try to discard pages, in order to recycle a vcache entry.
*
* We also make some sanity checks: ref count, open count, held locks.
*
* We also do some non-VM-related chores, such as releasing the cred pointer
* (for AIX and Solaris) and releasing the gnode (for AIX).
*
* Locking: afs_xvcache lock is held. If it is dropped and re-acquired,
* *slept should be set to warn the caller.
*
* Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it
* is not dropped and re-acquired for any platform. It may be that *slept is
* therefore obsolescent.
*
*/
int
osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
struct vnode *vp;
int code;
vp = AFSTOV(avc);
if (!VI_TRYLOCK(vp))
return EBUSY;
code = osi_fbsd_checkinuse(avc);
if (code) {
VI_UNLOCK(vp);
return code;
}
/* must hold the vnode before calling cache_purge()
* This code largely copied from vfs_subr.c:vlrureclaim() */
vholdl(vp);
VI_UNLOCK(vp);
AFS_GUNLOCK();
cache_purge(vp);
AFS_GLOCK();
vdrop(vp);
return 0;
}
开发者ID:hwr,项目名称:openafs,代码行数:44,代码来源:osi_vm.c
示例5: cache_invalidate_dir
static void cache_invalidate_dir(const char *path)
{
pthread_mutex_lock(&cache.lock);
cache_purge(path);
cache_purge_parent(path);
pthread_mutex_unlock(&cache.lock);
}
开发者ID:mbouaziz,项目名称:xcurlftpfs,代码行数:7,代码来源:cache.c
示例6: vnop_remove_9p
static int
vnop_remove_9p(struct vnop_remove_args *ap)
{
vnode_t dvp, vp;
node_9p *dnp, *np;
int e;
TRACE();
dvp = ap->a_dvp;
vp = ap->a_vp;
dnp = NTO9P(dvp);
np = NTO9P(vp);
if (dvp == vp) {
panic("parent == node");
return EINVAL;
}
if (ISSET(ap->a_flags, VNODE_REMOVE_NODELETEBUSY) &&
vnode_isinuse(vp, 0))
return EBUSY;
nlock_9p(dnp, NODE_LCK_EXCLUSIVE);
nlock_9p(np, NODE_LCK_EXCLUSIVE);
if ((e=remove_9p(np->nmp, np->fid)))
goto error;
cache_purge(vp);
vnode_recycle(vp);
error:
nunlock_9p(np);
nunlock_9p(dnp);
return e;
}
开发者ID:aredridel,项目名称:mac9p,代码行数:35,代码来源:vnops.c
示例7: obexftp_open
/**
Send an custom Siemens OBEX rename request.
\param cli an obexftp_client_t created by obexftp_open().
\param sourcename remote filename to be renamed
\param targetname remote target filename
\return the result of Siemens rename request
*/
int obexftp_rename(obexftp_client_t *cli, const char *sourcename, const char *targetname)
{
obex_object_t *object = NULL;
int ret;
return_val_if_fail(cli != NULL, -EINVAL);
cli->infocb(OBEXFTP_EV_SENDING, sourcename, 0, cli->infocb_data);
DEBUG(2, "%s() Moving %s -> %s\n", __func__, sourcename, targetname);
object = obexftp_build_rename (cli->obexhandle, cli->connection_id, sourcename, targetname);
if(object == NULL)
return -1;
cache_purge(&cli->cache, NULL);
ret = cli_sync_request(cli, object);
if(ret < 0)
cli->infocb(OBEXFTP_EV_ERR, sourcename, 0, cli->infocb_data);
else
cli->infocb(OBEXFTP_EV_OK, sourcename, 0, cli->infocb_data);
return ret;
}
开发者ID:Wonfee,项目名称:obexftp,代码行数:34,代码来源:client.c
示例8: _xfs_remove
static int
_xfs_remove(
struct vop_remove_args /* {
struct vnodeop_desc *a_desc;
struct vnode * a_dvp;
struct vnode * a_vp;
struct componentname * a_cnp;
} */ *ap)
{
struct vnode *vp = ap->a_vp;
struct thread *td = curthread;
struct ucred *credp = td->td_ucred;
/*
struct vnode *dvp = ap->a_dvp;
struct componentname *cnp = ap->a_cnp;
*/
int error;
if (vp->v_type == VDIR || vp->v_usecount != 1)
return (EPERM);
error = xfs_remove(VPTOXFSVP(ap->a_dvp)->v_bh.bh_first,
VPTOXFSVP(ap->a_vp)->v_bh.bh_first,
ap->a_cnp,credp);
cache_purge(vp);
return error;
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:28,代码来源:xfs_vnops.c
示例9: fuse_vnop_remove
/*
struct vnop_remove_args {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
};
*/
static int
fuse_vnop_remove(struct vop_remove_args *ap)
{
struct vnode *dvp = ap->a_dvp;
struct vnode *vp = ap->a_vp;
struct componentname *cnp = ap->a_cnp;
int err;
FS_DEBUG2G("inode=%ju name=%*s\n",
(uintmax_t)VTOI(vp), (int)cnp->cn_namelen, cnp->cn_nameptr);
if (fuse_isdeadfs(vp)) {
return ENXIO;
}
if (vnode_isdir(vp)) {
return EPERM;
}
cache_purge(vp);
err = fuse_internal_remove(dvp, vp, cnp, FUSE_UNLINK);
if (err == 0)
fuse_internal_vnode_disappear(vp);
return err;
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:33,代码来源:fuse_vnops.c
示例10: ufs_reclaim
/*
* Reclaim an inode so that it can be used for other purposes.
*/
int
ufs_reclaim(struct vnode *vp, struct proc *p)
{
struct inode *ip;
#ifdef DIAGNOSTIC
extern int prtactive;
if (prtactive && vp->v_usecount != 0)
vprint("ufs_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);
}
#ifdef UFS_DIRHASH
if (ip->i_dirhash != NULL)
ufsdirhash_free(ip);
#endif
ufs_quota_delete(ip);
return (0);
}
开发者ID:genua,项目名称:anoubis_os,代码行数:34,代码来源:ufs_inode.c
示例11: 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
示例12: with
/**
Send an OBEX PUT, optionally with (some) SETPATHs for a local file.
\param cli an obexftp_client_t created by obexftp_open().
\param filename local file to send
\param remotename remote name to write
\return the result of the OBEX PUT (and SETPATH) request(s).
\note Puts to filename's basename if remotename is NULL or ends with a slash.
*/
int obexftp_put_file(obexftp_client_t *cli, const char *filename, const char *remotename)
{
obex_object_t *object;
int ret;
return_val_if_fail(cli != NULL, -EINVAL);
return_val_if_fail(filename != NULL, -EINVAL);
if (cli->out_data) {
DEBUG(1, "%s: Warning: buffer still active?\n", __func__);
}
cli->infocb(OBEXFTP_EV_SENDING, filename, 0, cli->infocb_data);
// TODO: if remotename ends with a slash: add basename
if (!remotename) {
remotename = strrchr(filename, '/');
if (remotename)
remotename++;
else
remotename = filename;
}
if (OBEXFTP_USE_SPLIT_SETPATH(cli->quirks) && remotename && strchr(remotename, '/')) {
char *basepath, *basename;
split_file_path(remotename, &basepath, &basename);
ret = obexftp_setpath(cli, basepath, 0);
if(ret < 0) {
cli->infocb(OBEXFTP_EV_ERR, basepath, 0, cli->infocb_data);
return ret;
}
DEBUG(2, "%s() Sending %s -> %s\n", __func__, filename, basename);
object = build_object_from_file (cli->obexhandle, cli->connection_id, filename, basename);
free(basepath);
free(basename);
} else {
DEBUG(2, "%s() Sending %s -> %s\n", __func__, filename, remotename);
object = build_object_from_file (cli->obexhandle, cli->connection_id, filename, remotename);
}
cli->fd = open(filename, O_RDONLY | O_BINARY, 0);
if(cli->fd < 0)
ret = -1;
else {
cli->out_data = NULL; /* dont free, isnt ours */
cache_purge(&cli->cache, NULL);
ret = cli_sync_request(cli, object);
}
/* close(cli->fd); */
if(ret < 0)
cli->infocb(OBEXFTP_EV_ERR, filename, 0, cli->infocb_data);
else
cli->infocb(OBEXFTP_EV_OK, filename, 0, cli->infocb_data);
return ret;
}
开发者ID:Wonfee,项目名称:obexftp,代码行数:69,代码来源:client.c
示例13: vnop_rename_9p
static int
vnop_rename_9p(struct vnop_rename_args *ap)
{
struct componentname *tcnp;
vnode_t fdvp, tdvp, fvp;
node_9p *fdnp, *fnp;
dir_9p d;
char *s;
int e;
TRACE();
fdvp = ap->a_fdvp;
tdvp = ap->a_tdvp;
fvp = ap->a_fvp;
tcnp = ap->a_tcnp;
fdnp = NTO9P(fdvp);
fnp = NTO9P(fvp);
if (fdvp!=tdvp || NTO9P(fdvp)!=NTO9P(tdvp))
return ENOTSUP;
nlock_9p(fdnp, NODE_LCK_EXCLUSIVE);
nlock_9p(fnp, NODE_LCK_EXCLUSIVE);
nulldir(&d);
e = ENOMEM;
s = malloc_9p(tcnp->cn_namelen+1);
if (s == NULL)
goto error;
bcopy(tcnp->cn_nameptr, s, tcnp->cn_namelen);
s[tcnp->cn_namelen] = 0;
d.name = s;
e = wstat_9p(fnp->nmp, fnp->fid, &d);
free_9p(s);
if (e == 0) {
cache_purge(fvp);
cache_purge(fdvp);
}
error:
nunlock_9p(fnp);
nunlock_9p(fdnp);
return e;
}
开发者ID:aredridel,项目名称:mac9p,代码行数:44,代码来源:vnops.c
示例14: request
/**
Send OBEX SETPATH request (multiple requests if split path flag is set).
\param cli an obexftp_client_t created by obexftp_open().
\param name path to change into
\param create flag whether to create missing folders or fail
\return the result of the OBEX SETPATH request(s).
\note handles NULL, "", "/" and everything else correctly.
*/
int obexftp_setpath(obexftp_client_t *cli, const char *name, int create)
{
obex_object_t *object;
int ret = 0;
char *copy, *tail, *p;
return_val_if_fail(cli != NULL, -EINVAL);
DEBUG(2, "%s() Changing to %s\n", __func__, name);
if (OBEXFTP_USE_SPLIT_SETPATH(cli->quirks) && name && *name && strchr(name, '/')) {
tail = copy = strdup(name);
for (p = strchr(tail, '/'); tail; ) {
if (p) {
*p = '\0';
p++;
}
cli->infocb(OBEXFTP_EV_SENDING, tail, 0, cli->infocb_data);
DEBUG(2, "%s() Setpath \"%s\" (create:%d)\n", __func__, tail, create);
/* try without the create flag */
object = obexftp_build_setpath (cli->obexhandle, cli->connection_id, tail, 0);
ret = cli_sync_request(cli, object);
if ((ret < 0) && create) {
/* try again with create flag set maybe? */
object = obexftp_build_setpath (cli->obexhandle, cli->connection_id, tail, 1);
ret = cli_sync_request(cli, object);
}
if (ret < 0) break;
tail = p;
if (p)
p = strchr(p, '/');
/* prevent a trailing slash from messing all up with a cd top */
if (tail && *tail == '\0')
break;
}
free (copy);
} else {
cli->infocb(OBEXFTP_EV_SENDING, name, 0, cli->infocb_data);
DEBUG(2, "%s() Setpath \"%s\"\n", __func__, name);
object = obexftp_build_setpath (cli->obexhandle, cli->connection_id, name, create);
ret = cli_sync_request(cli, object);
}
if (create)
cache_purge(&cli->cache, NULL); /* no way to know where we started */
if(ret < 0)
cli->infocb(OBEXFTP_EV_ERR, name, 0, cli->infocb_data);
else
cli->infocb(OBEXFTP_EV_OK, name, 0, cli->infocb_data);
return ret;
}
开发者ID:Wonfee,项目名称:obexftp,代码行数:66,代码来源:client.c
示例15: osi_VM_FlushPages
/* Purge VM for a file when its callback is revoked.
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
{
struct vnode *vp = AFSTOV(avc);
if (!vp)
return;
cache_purge(vp);
uvm_vnp_uncache(vp);
uvm_vnp_setsize(vp, avc->f.m.Length);
}
开发者ID:adeason,项目名称:openafs,代码行数:15,代码来源:osi_vm.c
示例16: dns_main_loop
int dns_main_loop()
{
struct timeval tv;
fd_set active_rfds;
int retval;
dns_request_t m;
dns_request_t *ptr, *next;
//int purge_time = config.purge_time / 60;
int purge_time = CACHE_CHECK_TIME / DNS_TICK_TIME; //(30sec) modified by CMC 8/4/2001
while( !dns_main_quit ){
/* set the one second time out */
tv.tv_sec = DNS_TICK_TIME; //modified by CMC 8/3/2001
tv.tv_usec = 0;
/* now copy the main rfds in the active one as it gets modified by select*/
active_rfds = rfds;
retval = select( FD_SETSIZE, &active_rfds, NULL, NULL, &tv );
if (retval){
/* data is now available */
dns_read_packet( dns_sock, &m );
dns_handle_request( &m );
}else{
/* select time out */
ptr = dns_request_list;
while( ptr ){
next = ptr->next;
ptr->time_pending++;
if( ptr->time_pending > DNS_TIMEOUT/DNS_TICK_TIME ){
/* CMC: ptr->time_pending= DNS_TIMEOUT ~ DNS_TIMEOUT+DNS_TICK_TIME */
debug("Request timed out\n");
/* send error back */
dns_construct_error_reply(ptr);
dns_write_packet( dns_sock, ptr->src_addr, ptr->src_port, ptr );
dns_request_list = dns_list_remove( dns_request_list, ptr );
}
ptr = next;
} /* while(ptr) */
/* purge cache */
purge_time--;
if( purge_time <= 0 ){ //modified by CMC 8/4/2001
cache_purge( config.purge_time );
//purge_time = config.purge_time / 60;
purge_time = CACHE_CHECK_TIME / DNS_TICK_TIME; //(30sec) modified by CMC 8/3/2001
}
} /* if (retval) */
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:54,代码来源:dproxy.c
示例17: cache_destroy
// destroy cache
void cache_destroy (struct cache_t **cache, void (*destroy)(void **data))
{
// check parameters
if (!cache || !*cache)
return;
// destroy object cache
cache_purge(*cache, destroy);
free((*cache)->objects);
free(*cache);
*cache = NULL;
}
开发者ID:m101,项目名称:libfall4c,代码行数:13,代码来源:cache.c
示例18: cache_purge_parent
static void cache_purge_parent(const char *path)
{
const char *s = strrchr(path, '/');
if (s) {
if (s == path)
g_hash_table_remove(cache.table, "/");
else {
char *parent = g_strndup(path, s - path);
cache_purge(parent);
g_free(parent);
}
}
}
开发者ID:mbouaziz,项目名称:xcurlftpfs,代码行数:13,代码来源:cache.c
示例19: null_reclaim
static int
null_reclaim(struct vnop_reclaim_args * ap)
{
struct vnode * vp;
struct null_node * xp;
struct vnode * lowervp;
struct null_mount * null_mp = MOUNTTONULLMOUNT(vnode_mount(ap->a_vp));
NULLFSDEBUG("%s %p\n", __FUNCTION__, ap->a_vp);
vp = ap->a_vp;
xp = VTONULL(vp);
lowervp = xp->null_lowervp;
lck_mtx_lock(&null_mp->nullm_lock);
vnode_removefsref(vp);
if (lowervp != NULL) {
/* root and second don't have a lowervp, so nothing to release and nothing
* got hashed */
if (xp->null_flags & NULL_FLAG_HASHED) {
/* only call this if we actually made it into the hash list. reclaim gets
called also to
clean up a vnode that got created when it didn't need to under race
conditions */
null_hashrem(xp);
}
vnode_getwithref(lowervp);
vnode_rele(lowervp);
vnode_put(lowervp);
}
if (vp == null_mp->nullm_rootvp) {
null_mp->nullm_rootvp = NULL;
} else if (vp == null_mp->nullm_secondvp) {
null_mp->nullm_secondvp = NULL;
} else if (vp == null_mp->nullm_thirdcovervp) {
null_mp->nullm_thirdcovervp = NULL;
}
lck_mtx_unlock(&null_mp->nullm_lock);
cache_purge(vp);
vnode_clearfsnode(vp);
FREE(xp, M_TEMP);
return 0;
}
开发者ID:aglab2,项目名称:darwin-xnu,代码行数:51,代码来源:null_vnops.c
示例20: smbfs_rmdir
/*
* smbfs_remove directory call
*/
int
smbfs_rmdir(void *v)
{
struct vop_rmdir_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct vnode *dvp = ap->a_dvp;
struct componentname *cnp = ap->a_cnp;
/* struct smbmount *smp = VTOSMBFS(vp);*/
struct smbnode *dnp = VTOSMB(dvp);
struct smbnode *np = VTOSMB(vp);
struct smb_cred scred;
int error;
if (dvp == vp) {
vrele(dvp);
vput(dvp);
return (EINVAL);
}
smb_makescred(&scred, curlwp, cnp->cn_cred);
error = smbfs_smb_rmdir(np, &scred);
if (error == 0)
np->n_flag |= NGONE;
dnp->n_flag |= NMODIFIED;
smbfs_attr_cacheremove(dvp);
VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
VN_KNOTE(vp, NOTE_DELETE);
cache_purge(dvp);
cache_purge(vp);
vput(vp);
vput(dvp);
return (error);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:41,代码来源:smbfs_vnops.c
注:本文中的cache_purge函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论