MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / fs_open_wget

Function fs_open_wget

tinyemu/fs_net.c:837–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835
836
837static int fs_open_wget(FSDevice *fs1, FSINode *n, FSOpenWgetEnum open_type)
838{
839 char *url;
840 FSOpenInfo *oi;
841 char fname[FILEID_SIZE_MAX];
842 FSBaseURL *bu;
843
844 assert(n->u.reg.state == REG_STATE_UNLOADED);
845
846 fs_trim_cache(fs1, n->u.reg.size);
847
848 if (file_buffer_resize(&n->u.reg.fbuf, n->u.reg.size) < 0)
849 return -P9_EIO;
850 n->u.reg.state = REG_STATE_LOADING;
851 oi = mallocz(sizeof(*oi));
852 oi->cur_pos = 0;
853 oi->fs = fs1;
854 oi->n = n;
855 oi->open_type = open_type;
856 if (open_type != FS_OPEN_WGET_ARCHIVE_FILE) {
857 if (open_type == FS_OPEN_WGET_ARCHIVE)
858 init_list_head(&oi->archive_file_list);
859 file_id_to_filename(fname, n->u.reg.file_id);
860 bu = n->u.reg.base_url;
861 url = compose_path(bu->url, fname);
862 if (bu->encrypted) {
863 oi->dec_state = decrypt_file_init(&bu->aes_state, fs_open_write_cb, oi);
864 }
865 oi->xhr = fs_wget(url, bu->user, bu->password, oi, fs_open_cb, FALSE);
866 }
867 n->u.reg.open_info = oi;
868 return 0;
869}
870
871
872static void fs_preload_file(FSDevice *fs1, const char *filename)

Callers 3

fs_preload_fileFunction · 0.85
fs_preload_archiveFunction · 0.85
fs_openFunction · 0.85

Calls 8

fs_trim_cacheFunction · 0.85
file_buffer_resizeFunction · 0.85
malloczFunction · 0.85
init_list_headFunction · 0.85
file_id_to_filenameFunction · 0.85
decrypt_file_initFunction · 0.85
fs_wgetFunction · 0.85
compose_pathFunction · 0.70

Tested by

no test coverage detected