#include #include #include #include #include #include #include #include #include int g_arcfl; void flush_one(const char *ds) { int ret; char name[MAXPATHLEN + 1]; strcpy(name, ds); ret = ioctl(g_arcfl, 0xf10053, name); if (ret == -1) { printf("ioctl to arcflush device failed with %d=%s\n", errno, strerror(errno)); exit(1); } } void purge_one(const char *mntpnt) { int ret; char name[MAXPATHLEN + 1]; strcpy(name, mntpnt); ret = ioctl(g_arcfl, 0xf10054, name); if (ret == -1) { printf("ioctl to dnlc purge failed with %d=%s\n", errno, strerror(errno)); exit(1); } } int main(int argc, char **argv) { if (argc != 3) { printf("usage: arcflush \n"); exit(1); } g_arcfl = open("/devices/pseudo/arcflush@0:arcflush", O_RDWR); if (g_arcfl == -1) { printf("failed to open arcflush device: %s\n", strerror(errno)); exit(1); } flush_one(argv[1]); purge_one(argv[2]); close(g_arcfl); return (0); }