mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
619 B

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sys/mount.h>
  4. #include <sys/types.h>
  5. #include <sys/stat.h>
  6. #include <fcntl.h>
  7. #include <unistd.h>
  8. #include <sys/ioctl.h>
  9. #include <errno.h>
  10. int main(int argc, char **argv)
  11. {
  12. int c, f, rc=0;
  13. if (argc == 1) {
  14. fprintf(stderr,"Usage: %s /dev/rd/initrd "
  15. "[ /dev/rd/12 [ .. ] ]\n", argv[0]);
  16. return 1;
  17. }
  18. for (c=1; c < argc; c++) {
  19. if ((f=open(argv[c], O_RDWR)) == -1) {
  20. fprintf(stderr, "freeramdisk: cannot open %s: %s\n",
  21. argv[c], strerror(errno));
  22. rc++;
  23. } else {
  24. ioctl(f, BLKFLSBUF);
  25. close(f);
  26. }
  27. }
  28. return rc;
  29. }