Lines Matching refs:fname
117 int os_write_file(const char *fname, const void *buf, int size) in os_write_file() argument
121 fd = os_open(fname, OS_O_WRONLY | OS_O_CREAT | OS_O_TRUNC); in os_write_file()
123 printf("Cannot open file '%s'\n", fname); in os_write_file()
127 printf("Cannot write to file '%s'\n", fname); in os_write_file()
136 int os_read_file(const char *fname, void **bufp, int *sizep) in os_read_file() argument
142 fd = os_open(fname, OS_O_RDONLY); in os_read_file()
144 printf("Cannot open file '%s'\n", fname); in os_read_file()
149 printf("Cannot seek to end of file '%s'\n", fname); in os_read_file()
153 printf("Cannot seek to start of file '%s'\n", fname); in os_read_file()
158 printf("Not enough memory to read file '%s'\n", fname); in os_read_file()
163 printf("Cannot read from file '%s'\n", fname); in os_read_file()
438 char *fname; in os_dirent_ls() local
451 fname = malloc(len); in os_dirent_ls()
452 if (!fname) { in os_dirent_ls()
472 old_fname = fname; in os_dirent_ls()
473 fname = realloc(fname, len); in os_dirent_ls()
474 if (!fname) { in os_dirent_ls()
498 snprintf(fname, len, "%s/%s", dirname, next->name); in os_dirent_ls()
499 if (!stat(fname, &buf)) in os_dirent_ls()
510 free(fname); in os_dirent_ls()
529 int os_get_filesize(const char *fname, loff_t *size) in os_get_filesize() argument
534 ret = stat(fname, &buf); in os_get_filesize()
552 int os_write_ram_buf(const char *fname) in os_write_ram_buf() argument
557 fd = open(fname, O_CREAT | O_WRONLY, 0777); in os_write_ram_buf()
568 int os_read_ram_buf(const char *fname) in os_read_ram_buf() argument
574 ret = os_get_filesize(fname, &size); in os_read_ram_buf()
579 fd = open(fname, O_RDONLY); in os_read_ram_buf()
591 static int make_exec(char *fname, const void *data, int size) in make_exec() argument
595 strcpy(fname, "/tmp/u-boot.jump.XXXXXX"); in make_exec()
596 fd = mkstemp(fname); in make_exec()
602 if (chmod(fname, 0777)) in make_exec()
666 static int os_jump_to_file(const char *fname) in os_jump_to_file() argument
690 extra_args[1] = (char *)fname; in os_jump_to_file()
699 argv[0] = (char *)fname; in os_jump_to_file()
709 err = execv(fname, argv); in os_jump_to_file()
713 printf("Image filename '%s'\n", fname); in os_jump_to_file()
717 return unlink(fname); in os_jump_to_file()
722 char fname[30]; in os_jump_to_image() local
725 err = make_exec(fname, dest, size); in os_jump_to_image()
729 return os_jump_to_file(fname); in os_jump_to_image()
732 int os_find_u_boot(char *fname, int maxlen) in os_find_u_boot() argument
744 strcpy(fname, progname); in os_find_u_boot()
745 suffix = fname + len - 4; in os_find_u_boot()
749 fname[len - 3] = 's'; in os_find_u_boot()
750 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
757 p = strstr(fname, "/tpl/"); in os_find_u_boot()
760 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
771 fname[len - 4] = '\0'; in os_find_u_boot()
772 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
780 p = strstr(fname, "spl/"); in os_find_u_boot()
784 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
794 int os_spl_to_uboot(const char *fname) in os_spl_to_uboot() argument
801 return os_jump_to_file(fname); in os_spl_to_uboot()