Lines Matching refs:tftpfile
399 struct tftp_handle *tftpfile;
417 tftpfile = (struct tftp_handle *) malloc(sizeof(*tftpfile));
418 if (!tftpfile)
421 memset(tftpfile, 0, sizeof(*tftpfile));
422 tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE;
423 tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata));
428 tftpfile->off = 0;
430 tftpfile->path = malloc(pathsize);
431 if (tftpfile->path == NULL) {
432 free(tftpfile);
439 res = snprintf(tftpfile->path, pathsize, "%s%s%s",
442 free(tftpfile->path);
443 free(tftpfile);
447 res = tftp_makereq(tftpfile);
450 free(tftpfile->path);
451 free(tftpfile);
454 f->f_fsdata = (void *) tftpfile;
463 struct tftp_handle *tftpfile;
464 tftpfile = (struct tftp_handle *) f->f_fsdata;
471 needblock = tftpfile->off / tftpfile->tftp_blksize + 1;
473 if (tftpfile->currblock > needblock) { /* seek backwards */
474 tftp_senderr(tftpfile, 0, "No error: read aborted");
475 tftp_makereq(tftpfile); /* no error check, it worked
479 while (tftpfile->currblock < needblock) {
482 res = tftp_getnextblock(tftpfile);
489 if (tftpfile->islastblock)
493 if (tftpfile->currblock == needblock) {
496 offinblock = tftpfile->off % tftpfile->tftp_blksize;
498 inbuffer = tftpfile->validsize - offinblock;
502 tftpfile->off);
507 bcopy(tftpfile->lastdata.t.th_data + offinblock,
511 tftpfile->off += count;
514 if ((tftpfile->islastblock) && (count == inbuffer))
533 struct tftp_handle *tftpfile;
534 tftpfile = (struct tftp_handle *) f->f_fsdata;
538 if (tftpfile) {
539 free(tftpfile->path);
540 free(tftpfile);
556 struct tftp_handle *tftpfile;
557 tftpfile = (struct tftp_handle *) f->f_fsdata;
563 sb->st_size = (off_t) tftpfile->tftp_tsize;
570 struct tftp_handle *tftpfile;
571 tftpfile = (struct tftp_handle *) f->f_fsdata;
575 tftpfile->off = offset;
578 tftpfile->off += offset;
584 return (tftpfile->off);