Lines Matching +full:swap +full:- +full:size +full:- +full:gb

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
92 while ((ch = getopt(argc, argv, "AadEfghklLmqsUF:")) != -1) { in main()
174 if (strcmp(fsp->fs_type, FSTAB_SW) != 0) in main()
176 if (strstr(fsp->fs_mntops, "noauto") != NULL) in main()
179 strstr(fsp->fs_mntops, "late") && in main()
183 strstr(fsp->fs_mntops, "late") == NULL && in main()
186 Eflag |= (strstr(fsp->fs_mntops, "trimonce") != NULL); in main()
187 swfile = swap_on_off(fsp->fs_spec, 1, in main()
188 fsp->fs_mntops); in main()
195 printf("%s: %sing %s as swap device\n", in main()
210 printf("%s: %sing %s as swap device\n", in main()
230 /* Swap on vnode-backed md(4) device. */ in swap_on_off()
232 (fnmatch(_PATH_DEV MD_NAME "[0-9]*", name, 0) == 0 || in swap_on_off()
233 fnmatch(MD_NAME "[0-9]*", name, 0) == 0 || in swap_on_off()
245 /* Swap on encrypted device by GEOM_ELI. */ in swap_on_off()
251 /* Swap on special file. */ in swap_on_off()
256 /* Strip off .bde or .eli suffix from swap device name */
281 /* Use built-in defaults for geli(8). */ in swap_on_geli_args()
286 sflag = " -s "; in swap_on_geli_args()
294 aalgo = p + sizeof("aalgo=") - 1; in swap_on_geli_args()
295 aflag = " -a "; in swap_on_geli_args()
297 ealgo = p + sizeof("ealgo=") - 1; in swap_on_geli_args()
298 eflag = " -e "; in swap_on_geli_args()
300 keylen_str = p + sizeof("keylen=") - 1; in swap_on_geli_args()
312 lflag = " -l "; in swap_on_geli_args()
314 sectorsize_str = p + sizeof("sectorsize=") - 1; in swap_on_geli_args()
334 Tflag = " -T "; in swap_on_geli_args()
355 * If we do not have a sector size at this point, fill in in swap_on_geli_args()
356 * pagesize as sector size. in swap_on_geli_args()
367 (void)asprintf(&args, "%s%s%s%s%s%s%s%s%s -d", in swap_on_geli_args()
430 fd = -1; in swap_on_off_md()
433 name_len = strlen(name) - strlen(DOT_ELI); in swap_on_off_md()
441 if (strlen(dname) == (sizeof(MD_NAME) - 1)) in swap_on_off_md()
442 mdunit = -1; in swap_on_off_md()
461 vnodefile = strdup(p + sizeof("file=") - 1); in swap_on_off_md()
472 if (mdunit == -1) { in swap_on_off_md()
473 error = run_cmd(&fd, "%s -l -n -f %s", in swap_on_off_md()
484 error = run_cmd(&fd, "%s -a -t vnode -n -f %s", in swap_on_off_md()
520 error = run_cmd(&fd, "%s -l -n -f %s -u %d", in swap_on_off_md()
531 error = run_cmd(NULL, "%s -a -t vnode -u %d -f %s", in swap_on_off_md()
541 if (mdunit == -1) { in swap_on_off_md()
542 error = run_cmd(&fd, "%s -l -n -f %s", in swap_on_off_md()
584 error = run_cmd(&fd, "%s -l -n -f %s -u %d", in swap_on_off_md()
599 /* Swap on encrypted device by GEOM_ELI. */ in swap_on_off_md()
602 mdpath[sizeof(mdpath) - 1] = '\0'; in swap_on_off_md()
607 mdpath[sizeof(mdpath) - 1] = '\0'; in swap_on_off_md()
613 error = run_cmd(NULL, "%s -d -u %d", in swap_on_off_md()
623 if (fd != -1) in swap_on_off_md()
639 if (rv == -1) { in run_cmd()
654 /* The argv array ends up NULL-terminated here. */ in run_cmd()
668 if (pipe(&pfd[0]) == -1) { in run_cmd()
670 return (-1); in run_cmd()
683 if (nfd == -1) in run_cmd()
693 _exit(-1); in run_cmd()
694 case -1: in run_cmd()
715 /* Find the device size. */ in swapon_trim()
727 ioarg[1] = sz - BBSIZE; in swapon_trim()
735 * Do not close the device until the swap pager has attempted to create in swapon_trim()
736 * another consumer. For GELI devices created with the 'detach -l' in swapon_trim()
738 * - that is, to disappear. This ordering ensures that the device will in swapon_trim()
755 if (error == -1) { in swap_on_off_sfile()
783 fprintf(stderr, "[-F fstab] -aLq | [-E] file ...\n"); in usage()
786 fprintf(stderr, "[-F fstab] -afLq | file ...\n"); in usage()
789 fprintf(stderr, "[-AghklmsU] [-a file ... | -d file ...]\n"); in usage()
812 size_t mibsize, size; in swaplist() local
826 strlcpy(buf, "1GB-blocks", sizeof(buf)); in swaplist()
830 blocksize = -1; in swaplist()
836 strlcpy(buf, "1kB-blocks", sizeof(buf)); in swaplist()
841 strlcpy(buf, "1MB-blocks", sizeof(buf)); in swaplist()
846 snprintf(buf, sizeof(buf), "%ld-blocks", blocksize); in swaplist()
851 if (sysctlnametomib("vm.swap_info", mib, &mibsize) == -1) in swaplist()
855 printf("%-13s %*s %*s\n", in swaplist()
863 size = sizeof xsw; in swaplist()
864 if (sysctl(mib, mibsize + 1, &xsw, &size, NULL, 0) == -1) in swaplist()
876 printf("/dev/%-8s %s ", devname(xsw.xsw_dev, S_IFCHR), in swaplist()