10f66f451Sopenharmony_ci/* fsfreeze.c - freeze or thaw filesystem 20f66f451Sopenharmony_ci * 30f66f451Sopenharmony_ci * No standard. 40f66f451Sopenharmony_ci 50f66f451Sopenharmony_ciUSE_FSFREEZE(NEWTOY(fsfreeze, "<1>1f|u|[!fu]", TOYFLAG_USR|TOYFLAG_SBIN)) 60f66f451Sopenharmony_ci 70f66f451Sopenharmony_ciconfig FSFREEZE 80f66f451Sopenharmony_ci bool "fsfreeze" 90f66f451Sopenharmony_ci default y 100f66f451Sopenharmony_ci depends on TOYBOX_FIFREEZE 110f66f451Sopenharmony_ci help 120f66f451Sopenharmony_ci usage: fsfreeze {-f | -u} MOUNTPOINT 130f66f451Sopenharmony_ci 140f66f451Sopenharmony_ci Freeze or unfreeze a filesystem. 150f66f451Sopenharmony_ci 160f66f451Sopenharmony_ci -f Freeze 170f66f451Sopenharmony_ci -u Unfreeze 180f66f451Sopenharmony_ci*/ 190f66f451Sopenharmony_ci 200f66f451Sopenharmony_ci#define FOR_fsfreeze 210f66f451Sopenharmony_ci#include "toys.h" 220f66f451Sopenharmony_ci#include <linux/fs.h> 230f66f451Sopenharmony_ci 240f66f451Sopenharmony_civoid fsfreeze_main(void) 250f66f451Sopenharmony_ci{ 260f66f451Sopenharmony_ci int fd = xopenro(*toys.optargs); 270f66f451Sopenharmony_ci long p = 1; 280f66f451Sopenharmony_ci 290f66f451Sopenharmony_ci xioctl(fd, (toys.optflags & FLAG_f) ? FIFREEZE : FITHAW, &p); 300f66f451Sopenharmony_ci xclose(fd); 310f66f451Sopenharmony_ci} 32