这篇教程C++ vfs_sync函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vfs_sync函数的典型用法代码示例。如果您正苦于以下问题:C++ vfs_sync函数的具体用法?C++ vfs_sync怎么用?C++ vfs_sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vfs_sync函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cmd_sync/* * Command for running sync. */staticint cmd_sync(int nargs, char **args) { (void) nargs; (void) args; vfs_sync(); return 0;}
开发者ID:krnprdp,项目名称:os161-src,代码行数:12,
示例2: cmd_quit/* * Command for shutting down. */staticint cmd_quit(int nargs, char **args) { (void) nargs; (void) args; vfs_sync(); sys_reboot(RB_POWEROFF); thread_exit(); return 0;}
开发者ID:krnprdp,项目名称:os161-src,代码行数:13,
示例3: vfs_unmount/*********************************************************************************************************** Function name: vfs_unmount** Descriptions: 取消挂载文件系统** input parameters: path 目录 PATH** param 参数** output parameters: NONE** Returned value: 0 OR -1*********************************************************************************************************/int vfs_unmount(const char *path, const char *param){ mount_point_t *point; char *pathbuf; char *filepath; int ret; pathbuf = kmalloc(PATH_BUF_LEN, GFP_KERNEL); if (pathbuf == NULL) { seterrno(ENOMEM); return -1; } mutex_lock(&mount_point_lock, 0); point = vfs_mount_point_lookup2(pathbuf, &filepath, path); /* 查找挂载点 */ if (point == NULL) { mutex_unlock(&mount_point_lock); kfree(pathbuf); return -1; } if (point->fs->unmount == NULL) { mutex_unlock(&mount_point_lock); kfree(pathbuf); seterrno(ENOSYS); return -1; } if (atomic_read(&point->ref) != 0) { mutex_unlock(&mount_point_lock); kfree(pathbuf); seterrno(EBUSY); return -1; } vfs_sync(path); seterrno(0); ret = point->fs->unmount(point, param); /* 取消挂载文件系统 */ if (ret == 0) { if (point->dev != NULL) { atomic_dec(&point->dev->ref); } atomic_dec(&point->fs->ref); mount_point_remove(point); } mutex_unlock(&mount_point_lock); kfree(pathbuf); return ret;}
开发者ID:charlestac,项目名称:smileos,代码行数:62,
示例4: cmd_quit/* * Command for shutting down. */staticintcmd_quit(int nargs, char **args){ (void)nargs; (void)args; vfs_sync(); sys_reboot(RB_POWEROFF); #if OPT_A2 thread_exit(0); #endif /* OPT_A2 */ return 0;}
开发者ID:1337codeMonkey,项目名称:OS-NNN,代码行数:17,
示例5: panicvoidpanic(const char *fmt, ...){ va_list ap; /* * When we reach panic, the system is usually fairly screwed up. * It's not entirely uncommon for anything else we try to do * here to trigger more panics. * * This variable makes sure that if we try to do something here, * and it causes another panic, *that* panic doesn't try again; * trying again almost inevitably causes infinite recursion. * * This is not excessively paranoid - these things DO happen! */ static volatile int evil; if (evil == 0) { evil = 1; /* * Not only do we not want to be interrupted while * panicking, but we also want the console to be * printing in polling mode so as not to do context * switches. So turn interrupts off on this CPU. */ splhigh(); } if (evil == 1) { evil = 2; /* Kill off other threads and halt other CPUs. */ thread_panic(); } if (evil == 2) { evil = 3; /* Print the message. */ kprintf("panic: "); putch_prepare(); va_start(ap, fmt); __vprintf(console_send, NULL, fmt, ap); va_end(ap); putch_complete(); } if (evil == 3) { evil = 4; /* Try to sync the disks. */ vfs_sync(); } if (evil == 4) { evil = 5; /* Shut down or reboot the system. */ mainbus_panic(); } /* * Last resort, just in case. */ for (;;);}
开发者ID:SimplyRamya24,项目名称:Kernel-Development,代码行数:69,
示例6: dr_suspendintdr_suspend(dr_sr_handle_t *srh){ dr_handle_t *handle; int force; int dev_errs_idx; uint64_t dev_errs[DR_MAX_ERR_INT]; int rc = DDI_SUCCESS; handle = srh->sr_dr_handlep; force = dr_cmd_flags(handle) & SBD_FLAG_FORCE; /* * update the signature block */ CPU_SIGNATURE(OS_SIG, SIGST_QUIESCE_INPROGRESS, SIGSUBST_NULL, CPU->cpu_id); i_ndi_block_device_tree_changes(&handle->h_ndi); prom_printf("/nDR: suspending user threads.../n"); srh->sr_suspend_state = DR_SRSTATE_USER; if (((rc = dr_stop_user_threads(srh)) != DDI_SUCCESS) && dr_check_user_stop_result) { dr_resume(srh); return (rc); } if (!force) { struct dr_ref drc = {0}; prom_printf("/nDR: checking devices.../n"); dev_errs_idx = 0; drc.arr = dev_errs; drc.idx = &dev_errs_idx; drc.len = DR_MAX_ERR_INT; /* * Since the root node can never go away, it * doesn't have to be held. */ ddi_walk_devs(ddi_root_node(), dr_check_unsafe_major, &drc); if (dev_errs_idx) { handle->h_err = drerr_int(ESBD_UNSAFE, dev_errs, dev_errs_idx, 1); dr_resume(srh); return (DDI_FAILURE); } PR_QR("done/n"); } else { prom_printf("/nDR: dr_suspend invoked with force flag/n"); }#ifndef SKIP_SYNC /* * This sync swap out all user pages */ vfs_sync(SYNC_ALL);#endif /* * special treatment for lock manager */ lm_cprsuspend();#ifndef SKIP_SYNC /* * sync the file system in case we never make it back */ sync();#endif /* * now suspend drivers */ prom_printf("DR: suspending drivers.../n"); srh->sr_suspend_state = DR_SRSTATE_DRIVER; srh->sr_err_idx = 0; /* No parent to hold busy */ if ((rc = dr_suspend_devices(ddi_root_node(), srh)) != DDI_SUCCESS) { if (srh->sr_err_idx && srh->sr_dr_handlep) { (srh->sr_dr_handlep)->h_err = drerr_int(ESBD_SUSPEND, srh->sr_err_ints, srh->sr_err_idx, 1); } dr_resume(srh); return (rc); } drmach_suspend_last(); /* * finally, grab all cpus */ srh->sr_suspend_state = DR_SRSTATE_FULL; /* * if watchdog was activated, disable it *///.........这里部分代码省略.........
开发者ID:andreiw,项目名称:polaris,代码行数:101,
示例7: sbdp_suspendintsbdp_suspend(sbdp_sr_handle_t *srh){ int force; int rc = DDI_SUCCESS; force = (srh && (srh->sr_flags & SBDP_IOCTL_FLAG_FORCE)); /* * if no force flag, check for unsafe drivers */ if (force) { SBDP_DBG_QR("/nsbdp_suspend invoked with force flag"); } /* * update the signature block */ CPU_SIGNATURE(OS_SIG, SIGST_QUIESCE_INPROGRESS, SIGSUBST_NULL, CPU->cpu_id); /* * first, stop all user threads */ SBDP_DBG_QR("SBDP: suspending user threads.../n"); SR_SET_STATE(srh, SBDP_SRSTATE_USER); if (((rc = sbdp_stop_user_threads(srh)) != DDI_SUCCESS) && sbdp_check_user_stop_result) { sbdp_resume(srh); return (rc); }#ifndef SKIP_SYNC /* * This sync swap out all user pages */ vfs_sync(SYNC_ALL);#endif /* * special treatment for lock manager */ lm_cprsuspend();#ifndef SKIP_SYNC /* * sync the file system in case we never make it back */ sync();#endif /* * now suspend drivers */ SBDP_DBG_QR("SBDP: suspending drivers.../n"); SR_SET_STATE(srh, SBDP_SRSTATE_DRIVER); /* * Root node doesn't have to be held in any way. */ if ((rc = sbdp_suspend_devices(ddi_root_node(), srh)) != DDI_SUCCESS) { sbdp_resume(srh); return (rc); } /* * finally, grab all cpus */ SR_SET_STATE(srh, SBDP_SRSTATE_FULL); /* * if watchdog was activated, disable it */ if (watchdog_activated) { mutex_enter(&tod_lock); saved_watchdog_seconds = tod_ops.tod_clear_watchdog_timer(); mutex_exit(&tod_lock); SR_SET_FLAG(srh, SR_FLAG_WATCHDOG); } else { SR_CLEAR_FLAG(srh, SR_FLAG_WATCHDOG); } mutex_enter(&cpu_lock); pause_cpus(NULL); sbdp_stop_intr(); /* * update the signature block */ CPU_SIGNATURE(OS_SIG, SIGST_QUIESCED, SIGSUBST_NULL, CPU->cpu_id); return (rc);}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:93,
注:本文中的vfs_sync函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vfs_unbusy函数代码示例 C++ vfs_symlink函数代码示例 |