Lines Matching refs:ftp
62 static ssize_t hmcdrv_cache_get(const struct hmcdrv_ftp_cmdspec *ftp) in hmcdrv_cache_get() argument
67 if ((ftp->id != hmcdrv_cache_file.id) || in hmcdrv_cache_get()
68 strcmp(hmcdrv_cache_file.fname, ftp->fname)) in hmcdrv_cache_get()
71 if (ftp->ofs >= hmcdrv_cache_file.fsize) /* EOF ? */ in hmcdrv_cache_get()
81 len = hmcdrv_cache_file.fsize - ftp->ofs; in hmcdrv_cache_get()
83 if (len > ftp->len) in hmcdrv_cache_get()
84 len = ftp->len; in hmcdrv_cache_get()
89 pos = ftp->ofs - hmcdrv_cache_file.ofs; in hmcdrv_cache_get()
94 memcpy(ftp->buf, in hmcdrv_cache_get()
114 static ssize_t hmcdrv_cache_do(const struct hmcdrv_ftp_cmdspec *ftp, in hmcdrv_cache_do() argument
124 if ((ftp->len > 0) && (hmcdrv_cache_file.len >= ftp->len)) { in hmcdrv_cache_do()
130 struct hmcdrv_ftp_cmdspec cftp = *ftp; /* make a copy */ in hmcdrv_cache_do()
138 len, ftp->fname); in hmcdrv_cache_do()
140 if (len > ftp->len) in hmcdrv_cache_do()
141 len = ftp->len; in hmcdrv_cache_do()
143 hmcdrv_cache_file.ofs = ftp->ofs; in hmcdrv_cache_do()
146 memcpy(ftp->buf, hmcdrv_cache_file.content, len); in hmcdrv_cache_do()
149 len = func(ftp, &hmcdrv_cache_file.fsize); in hmcdrv_cache_do()
157 strscpy(hmcdrv_cache_file.fname, ftp->fname, in hmcdrv_cache_do()
159 hmcdrv_cache_file.id = ftp->id; in hmcdrv_cache_do()
161 ftp->id, hmcdrv_cache_file.fsize, ftp->fname); in hmcdrv_cache_do()
177 ssize_t hmcdrv_cache_cmd(const struct hmcdrv_ftp_cmdspec *ftp, in hmcdrv_cache_cmd() argument
182 if ((ftp->id == HMCDRV_FTP_DIR) || /* read cache */ in hmcdrv_cache_cmd()
183 (ftp->id == HMCDRV_FTP_NLIST) || in hmcdrv_cache_cmd()
184 (ftp->id == HMCDRV_FTP_GET)) { in hmcdrv_cache_cmd()
186 len = hmcdrv_cache_get(ftp); in hmcdrv_cache_cmd()
191 len = hmcdrv_cache_do(ftp, func); in hmcdrv_cache_cmd()
197 len = func(ftp, NULL); /* simply do original command */ in hmcdrv_cache_cmd()