Home | History | Annotate | Download | only in libsa

Lines Matching defs:tftpfile

99 static ssize_t tftp_size_of_file(struct tftp_handle *tftpfile);
254 struct tftp_handle *tftpfile;
258 tftpfile = (struct tftp_handle *)alloc(sizeof(*tftpfile));
259 if (!tftpfile)
262 tftpfile->iodesc = io = socktodesc(*(int *)(f->f_devdata));
264 tftpfile->off = 0;
265 tftpfile->path = path; /* XXXXXXX we hope it's static */
267 res = tftp_makereq(tftpfile);
270 dealloc(tftpfile, sizeof(*tftpfile));
273 f->f_fsdata = (void *)tftpfile;
281 struct tftp_handle *tftpfile;
285 tftpfile = (struct tftp_handle *)f->f_fsdata;
291 needblock = tftpfile->off / SEGSIZE + 1;
293 if (tftpfile->currblock > needblock) { /* seek backwards */
295 tftp_terminate(tftpfile);
297 tftp_makereq(tftpfile); /* no error check, it worked
301 while (tftpfile->currblock < needblock) {
309 res = tftp_getnextblock(tftpfile);
313 __func__, tftpfile->currblock, needblock);
317 if (tftpfile->islastblock)
321 if (tftpfile->currblock == needblock) {
324 offinblock = tftpfile->off % SEGSIZE;
326 if ((int)offinblock > tftpfile->validsize) {
329 tftpfile->off);
333 inbuffer = tftpfile->validsize - offinblock;
336 tftpfile->lastdata.t.th_data + offinblock,
340 tftpfile->off += count;
343 if ((tftpfile->islastblock) && (count == inbuffer))
363 struct tftp_handle *tftpfile;
364 tftpfile = (struct tftp_handle *)f->f_fsdata;
369 tftp_terminate(tftpfile);
372 dealloc(tftpfile, sizeof(*tftpfile));
384 tftp_size_of_file(struct tftp_handle *tftpfile)
388 if (tftpfile->currblock > 1) { /* move to start of file */
390 tftp_terminate(tftpfile);
392 tftp_makereq(tftpfile); /* no error check, it worked
397 filesize = tftpfile->validsize;
400 while (!tftpfile->islastblock) {
403 res = tftp_getnextblock(tftpfile);
407 __func__, tftpfile->currblock);
411 filesize += tftpfile->validsize;
422 struct tftp_handle *tftpfile;
423 tftpfile = (struct tftp_handle *)f->f_fsdata;
429 sb->st_size = tftp_size_of_file(tftpfile);
445 struct tftp_handle *tftpfile;
446 tftpfile = (struct tftp_handle *)f->f_fsdata;
450 tftpfile->off = offset;
453 tftpfile->off += offset;
459 return tftpfile->off;