diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-09-12 10:11:06 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-09-12 10:11:06 +0300 |
commit | 56fc5ee3406b110bdf9e041b8df37afc7716562d (patch) | |
tree | 588432cef6eb7bdbaa06cdcbf412f155f3695acd /rpmio | |
parent | d7c9ba442581f3ee703928b018180c4b078b77a9 (diff) | |
download | rpm-56fc5ee3406b110bdf9e041b8df37afc7716562d.tar.gz rpm-56fc5ee3406b110bdf9e041b8df37afc7716562d.tar.bz2 rpm-56fc5ee3406b110bdf9e041b8df37afc7716562d.zip |
Remove now unused DAV RPC code.
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmdav.c | 862 | ||||
-rw-r--r-- | rpmio/rpmdav.h | 108 |
2 files changed, 0 insertions, 970 deletions
diff --git a/rpmio/rpmdav.c b/rpmio/rpmdav.c index 470b4720c..da4d29ede 100644 --- a/rpmio/rpmdav.c +++ b/rpmio/rpmdav.c @@ -62,18 +62,6 @@ _free(const void * p) #ifdef WITH_NEON /* =============================================================== */ -static int davFree(urlinfo u) -{ - if (u != NULL && u->sess != NULL) { - u->capabilities = _free(u->capabilities); - if (u->lockstore != NULL) - ne_lockstore_destroy(u->lockstore); - u->lockstore = NULL; - ne_session_destroy(u->sess); - u->sess = NULL; - } - return 0; -} static void davProgress(void * userdata, off_t current, off_t total) { @@ -355,385 +343,6 @@ exit: return rc; } -/* =============================================================== */ -enum fetch_rtype_e { - resr_normal = 0, - resr_collection, - resr_reference, - resr_error -}; - -struct fetch_resource_s { - struct fetch_resource_s *next; - char *uri; - char *displayname; - enum fetch_rtype_e type; - size_t size; - time_t modtime; - int is_executable; - int is_vcr; /* Is version resource. 0: no vcr, 1 checkin 2 checkout */ - char *error_reason; /* error string returned for this resource */ - int error_status; /* error status returned for this resource */ -}; - -static void *fetch_destroy_item(struct fetch_resource_s *res) -{ - NE_FREE(res->uri); - NE_FREE(res->error_reason); - res = _free(res); - return NULL; -} - -#ifdef UNUSED -static void *fetch_destroy_list(struct fetch_resource_s *res) -{ - struct fetch_resource_s *next; - for (; res != NULL; res = next) { - next = res->next; - res = fetch_destroy_item(res); - } - return NULL; -} -#endif - -static void *fetch_create_item(void *userdata, const char *uri) -{ - struct fetch_resource_s * res = ne_calloc(sizeof(*res)); - return res; -} - -/* =============================================================== */ -struct fetch_context_s { - struct fetch_resource_s **resrock; - const char *uri; - unsigned int include_target; /* Include resource at href */ - urlinfo u; - int ac; - int nalloced; - ARGV_t av; - mode_t * modes; - size_t * sizes; - time_t * mtimes; -}; - -static void *fetch_destroy_context(struct fetch_context_s *ctx) -{ - if (ctx == NULL) - return NULL; - if (ctx->av != NULL) - ctx->av = argvFree(ctx->av); - ctx->modes = _free(ctx->modes); - ctx->sizes = _free(ctx->sizes); - ctx->mtimes = _free(ctx->mtimes); - ctx->u = urlFree(ctx->u, __FUNCTION__); - ctx->uri = _free(ctx->uri); - memset(ctx, 0, sizeof(*ctx)); - ctx = _free(ctx); - return NULL; -} - -static void *fetch_create_context(const char *uri) -{ - struct fetch_context_s * ctx; - urlinfo u; - - if (urlSplit(uri, &u)) - return NULL; - - ctx = ne_calloc(sizeof(*ctx)); - ctx->uri = xstrdup(uri); - ctx->u = urlLink(u, __FUNCTION__); - return ctx; -} - -static const ne_propname fetch_props[] = { - { "DAV:", "getcontentlength" }, - { "DAV:", "getlastmodified" }, - { "http://apache.org/dav/props/", "executable" }, - { "DAV:", "resourcetype" }, - { "DAV:", "checked-in" }, - { "DAV:", "checked-out" }, - { NULL, NULL } -}; - -#define ELM_resourcetype (NE_PROPS_STATE_TOP + 1) -#define ELM_collection (NE_PROPS_STATE_TOP + 2) - -static const struct ne_xml_idmap fetch_idmap[] = { - { "DAV:", "resourcetype", ELM_resourcetype }, - { "DAV:", "collection", ELM_collection } -}; - -static int fetch_startelm(void *userdata, int parent, - const char *nspace, const char *name, - const char **atts) -{ - ne_propfind_handler *pfh = userdata; - struct fetch_resource_s *r = ne_propfind_current_private(pfh); - int state = ne_xml_mapid(fetch_idmap, NE_XML_MAPLEN(fetch_idmap), - nspace, name); - - if (r == NULL || - !((parent == NE_207_STATE_PROP && state == ELM_resourcetype) || - (parent == ELM_resourcetype && state == ELM_collection))) - return NE_XML_DECLINE; - - if (state == ELM_collection) { - r->type = resr_collection; - } - - return state; -} - -static int fetch_compare(const struct fetch_resource_s *r1, - const struct fetch_resource_s *r2) -{ - /* Sort errors first, then collections, then alphabetically */ - if (r1->type == resr_error) { - return -1; - } else if (r2->type == resr_error) { - return 1; - } else if (r1->type == resr_collection) { - if (r2->type != resr_collection) { - return -1; - } else { - return strcmp(r1->uri, r2->uri); - } - } else { - if (r2->type != resr_collection) { - return strcmp(r1->uri, r2->uri); - } else { - return 1; - } - } -} - -static void fetch_results(void *userdata, const char *uri, - const ne_prop_result_set *set) -{ - struct fetch_context_s *ctx = userdata; - struct fetch_resource_s *current, *previous, *newres; - const char *clength, *modtime, *isexec; - const char *checkin, *checkout; - const ne_status *status = NULL; - const char * path = NULL; - - (void) urlPath(uri, &path); - if (path == NULL) - return; - - newres = ne_propset_private(set); - -if (_dav_debug < 0) -fprintf(stderr, "==> %s in uri %s\n", path, ctx->uri); - - if (ne_path_compare(ctx->uri, path) == 0 && !ctx->include_target) { - /* This is the target URI */ -if (_dav_debug < 0) -fprintf(stderr, "==> %s skipping target resource.\n", path); - /* Free the private structure. */ - free(newres); - return; - } - - newres->uri = ne_strdup(path); - - clength = ne_propset_value(set, &fetch_props[0]); - modtime = ne_propset_value(set, &fetch_props[1]); - isexec = ne_propset_value(set, &fetch_props[2]); - checkin = ne_propset_value(set, &fetch_props[4]); - checkout = ne_propset_value(set, &fetch_props[5]); - - if (clength == NULL) - status = ne_propset_status(set, &fetch_props[0]); - if (modtime == NULL) - status = ne_propset_status(set, &fetch_props[1]); - - if (newres->type == resr_normal && status != NULL) { - /* It's an error! */ - newres->error_status = status->code; - - /* Special hack for Apache 1.3/mod_dav */ - if (strcmp(status->reason_phrase, "status text goes here") == 0) { - const char *desc; - if (status->code == 401) { - desc = _("Authorization Required"); - } else if (status->klass == 3) { - desc = _("Redirect"); - } else if (status->klass == 5) { - desc = _("Server Error"); - } else { - desc = _("Unknown Error"); - } - newres->error_reason = ne_strdup(desc); - } else { - newres->error_reason = ne_strdup(status->reason_phrase); - } - newres->type = resr_error; - } - - if (isexec && strcasecmp(isexec, "T") == 0) { - newres->is_executable = 1; - } else { - newres->is_executable = 0; - } - - if (modtime) - newres->modtime = ne_httpdate_parse(modtime); - - if (clength) - newres->size = atoi(clength); - - /* is vcr */ - if (checkin) { - newres->is_vcr = 1; - } else if (checkout) { - newres->is_vcr = 2; - } else { - newres->is_vcr = 0; - } - - for (current = *ctx->resrock, previous = NULL; current != NULL; - previous = current, current = current->next) - { - if (fetch_compare(current, newres) >= 0) { - break; - } - } - if (previous) { - previous->next = newres; - } else { - *ctx->resrock = newres; - } - newres->next = current; -} - -static int davFetch(const urlinfo u, struct fetch_context_s * ctx) -{ - const char * path = NULL; - int depth = 1; /* XXX passed arg? */ - unsigned int include_target = 0; /* XXX passed arg? */ - struct fetch_resource_s * resitem = NULL; - struct fetch_resource_s ** resrock = &resitem; /* XXX passed arg? */ - ne_propfind_handler *pfh; - struct fetch_resource_s *current, *next; - mode_t st_mode; - int rc = 0; - int xx; - - (void) urlPath(u->url, &path); - pfh = ne_propfind_create(u->sess, ctx->uri, depth); - - /* HACK: need to set u->httpHasRange here. */ - - ctx->resrock = resrock; - ctx->include_target = include_target; - - ne_xml_push_handler(ne_propfind_get_parser(pfh), - fetch_startelm, NULL, NULL, pfh); - - ne_propfind_set_private(pfh, fetch_create_item, NULL); - - rc = ne_propfind_named(pfh, fetch_props, fetch_results, ctx); - - ne_propfind_destroy(pfh); - - for (current = resitem; current != NULL; current = next) { - const char *s, *se; - char * val; - - next = current->next; - - /* Collections have trailing '/' that needs trim. */ - /* The top level collection is returned as well. */ - se = current->uri + strlen(current->uri); - if (se[-1] == '/') { - if (strlen(current->uri) <= strlen(path)) { - current = fetch_destroy_item(current); - continue; - } - se--; - } - s = se; - while (s > current->uri && s[-1] != '/') - s--; - - val = ne_strndup(s, (se - s)); - - val = ne_path_unescape(val); - - xx = argvAdd(&ctx->av, val); -if (_dav_debug < 0) -fprintf(stderr, "*** argvAdd(%p,\"%s\")\n", &ctx->av, val); - NE_FREE(val); - - while (ctx->ac >= ctx->nalloced) { - if (ctx->nalloced <= 0) - ctx->nalloced = 1; - ctx->nalloced *= 2; - ctx->modes = xrealloc(ctx->modes, - (sizeof(*ctx->modes) * ctx->nalloced)); - ctx->sizes = xrealloc(ctx->sizes, - (sizeof(*ctx->sizes) * ctx->nalloced)); - ctx->mtimes = xrealloc(ctx->mtimes, - (sizeof(*ctx->mtimes) * ctx->nalloced)); - } - - switch (current->type) { - case resr_normal: - st_mode = S_IFREG; - break; - case resr_collection: - st_mode = S_IFDIR; - break; - case resr_reference: - case resr_error: - default: - st_mode = 0; - break; - } - ctx->modes[ctx->ac] = st_mode; - ctx->sizes[ctx->ac] = current->size; - ctx->mtimes[ctx->ac] = current->modtime; - ctx->ac++; - - current = fetch_destroy_item(current); - } - ctx->resrock = NULL; /* HACK: avoid leaving stack reference. */ - - return rc; -} - -static int davNLST(struct fetch_context_s * ctx) -{ - urlinfo u = NULL; - int rc; - int xx; - - rc = davInit(ctx->uri, &u); - if (rc || u == NULL) - goto exit; - - rc = davFetch(u, ctx); - switch (rc) { - case NE_OK: - break; - case NE_ERROR: - /* HACK: "301 Moved Permanently" on empty subdir. */ - if (!strncmp("301 ", ne_get_error(u->sess), sizeof("301 ")-1)) - break; - default: -if (_dav_debug) -fprintf(stderr, "*** Fetch from %s:%d failed:\n\t%s\n", - u->host, u->port, ne_get_error(u->sess)); - break; - } - -exit: - if (rc) - xx = davFree(u); - return rc; -} /* =============================================================== */ static int my_result(const char * msg, int ret, FILE * fp) @@ -1049,477 +658,6 @@ fprintf(stderr, "*** davClose(%p) rc %d\n", fd, rc); return rc; } -/* =============================================================== */ -int davMkdir(const char * path, mode_t mode) -{ - urlinfo u = NULL; - const char * src = NULL; - int rc; - - rc = davInit(path, &u); - if (rc) - goto exit; - - (void) urlPath(path, &src); - - rc = ne_mkcol(u->sess, path); - - if (rc) rc = -1; /* XXX HACK: errno impedance match */ - - /* XXX HACK: verify getrestype(remote) == resr_collection */ - -exit: -if (_dav_debug) -fprintf(stderr, "*** davMkdir(%s,0%o) rc %d\n", path, mode, rc); - return rc; -} - -int davRmdir(const char * path) -{ - urlinfo u = NULL; - const char * src = NULL; - int rc; - - rc = davInit(path, &u); - if (rc) - goto exit; - - (void) urlPath(path, &src); - - /* XXX HACK: only getrestype(remote) == resr_collection */ - - rc = ne_delete(u->sess, path); - - if (rc) rc = -1; /* XXX HACK: errno impedance match */ - -exit: -if (_dav_debug) -fprintf(stderr, "*** davRmdir(%s) rc %d\n", path, rc); - return rc; -} - -int davRename(const char * oldpath, const char * newpath) -{ - urlinfo u = NULL; - const char * src = NULL; - const char * dst = NULL; - int overwrite = 1; /* HACK: set this correctly. */ - int rc; - - rc = davInit(oldpath, &u); - if (rc) - goto exit; - - (void) urlPath(oldpath, &src); - (void) urlPath(newpath, &dst); - - /* XXX HACK: only getrestype(remote) != resr_collection */ - - rc = ne_move(u->sess, overwrite, src, dst); - - if (rc) rc = -1; /* XXX HACK: errno impedance match */ - -exit: -if (_dav_debug) -fprintf(stderr, "*** davRename(%s,%s) rc %d\n", oldpath, newpath, rc); - return rc; -} - -int davUnlink(const char * path) -{ - urlinfo u = NULL; - const char * src = NULL; - int rc; - - rc = davInit(path, &u); - if (rc) - goto exit; - - (void) urlPath(path, &src); - - /* XXX HACK: only getrestype(remote) != resr_collection */ - - rc = ne_delete(u->sess, src); - -exit: - if (rc) rc = -1; /* XXX HACK: errno impedance match */ - -if (_dav_debug) -fprintf(stderr, "*** davUnlink(%s) rc %d\n", path, rc); - return rc; -} - -#ifdef NOTYET -static int davChdir(const char * path) -{ - return davCommand("CWD", path, NULL); -} -#endif /* NOTYET */ - -/* =============================================================== */ - -static const char * statstr(const struct stat * st, - char * buf) -{ - sprintf(buf, - "*** dev %x ino %x mode %0o nlink %d uid %d gid %d rdev %x size %x\n", - (unsigned)st->st_dev, - (unsigned)st->st_ino, - st->st_mode, - (unsigned)st->st_nlink, - st->st_uid, - st->st_gid, - (unsigned)st->st_rdev, - (unsigned)st->st_size); - return buf; -} - -static int dav_st_ino = 0xdead0000; - -int davStat(const char * path, struct stat *st) -{ - struct fetch_context_s * ctx = NULL; - char buf[1024]; - int rc = -1; - -/* HACK: neon really wants collections with trailing '/' */ - ctx = fetch_create_context(path); - if (ctx == NULL) { -/* HACK: errno = ??? */ - goto exit; - } - rc = davNLST(ctx); - if (rc) { -/* HACK: errno = ??? */ - goto exit; - } - - memset(st, 0, sizeof(*st)); - st->st_mode = ctx->modes[0]; - st->st_size = ctx->sizes[0]; - st->st_mtime = ctx->mtimes[0]; - if (S_ISDIR(st->st_mode)) { - st->st_nlink = 2; - st->st_mode |= 0755; - } else - if (S_ISREG(st->st_mode)) { - st->st_nlink = 1; - st->st_mode |= 0644; - } - - /* XXX fts(3) needs/uses st_ino, make something up for now. */ - if (st->st_ino == 0) - st->st_ino = dav_st_ino++; -if (_dav_debug < 0) -fprintf(stderr, "*** davStat(%s) rc %d\n%s", path, rc, statstr(st, buf)); -exit: - ctx = fetch_destroy_context(ctx); - return rc; -} - -int davLstat(const char * path, struct stat *st) -{ - struct fetch_context_s * ctx = NULL; - char buf[1024]; - int rc = -1; - -/* HACK: neon really wants collections with trailing '/' */ - ctx = fetch_create_context(path); - if (ctx == NULL) { -/* HACK: errno = ??? */ - goto exit; - } - rc = davNLST(ctx); - if (rc) { -/* HACK: errno = ??? */ - goto exit; - } - - memset(st, 0, sizeof(*st)); - st->st_mode = ctx->modes[0]; - st->st_size = ctx->sizes[0]; - st->st_mtime = ctx->mtimes[0]; - if (S_ISDIR(st->st_mode)) { - st->st_nlink = 2; - st->st_mode |= 0755; - } else - if (S_ISREG(st->st_mode)) { - st->st_nlink = 1; - st->st_mode |= 0644; - } - - /* XXX fts(3) needs/uses st_ino, make something up for now. */ - if (st->st_ino == 0) - st->st_ino = dav_st_ino++; -if (_dav_debug < 0) -fprintf(stderr, "*** davLstat(%s) rc %d\n%s\n", path, rc, statstr(st, buf)); -exit: - ctx = fetch_destroy_context(ctx); - return rc; -} - -#ifdef NOTYET -static int davReadlink(const char * path, char * buf, size_t bufsiz) -{ - int rc; - rc = davNLST(path, DO_FTP_READLINK, NULL, buf, bufsiz); -if (_dav_debug < 0) -fprintf(stderr, "*** davReadlink(%s) rc %d\n", path, rc); - return rc; -} -#endif /* NOTYET */ #endif /* WITH_NEON */ -/* =============================================================== */ -int avmagicdir = 0x3607113; - -int avClosedir(DIR * dir) -{ - AVDIR avdir = (AVDIR)dir; - -if (_av_debug) -fprintf(stderr, "*** avClosedir(%p)\n", avdir); - -#if defined(HAVE_PTHREAD_H) - (void) pthread_mutex_destroy(&avdir->lock); -#endif - - avdir = _free(avdir); - return 0; -} - -struct dirent * avReaddir(DIR * dir) -{ - AVDIR avdir = (AVDIR)dir; - struct dirent * dp; - const char ** av; - unsigned char * dt; - int ac; - int i; - - if (avdir == NULL || !ISAVMAGIC(avdir) || avdir->data == NULL) { - /* XXX TODO: EBADF errno. */ - return NULL; - } - - dp = (struct dirent *) avdir->data; - av = (const char **) (dp + 1); - ac = avdir->size; - dt = (unsigned char *) (av + (ac + 1)); - i = avdir->offset + 1; - - if (i < 0 || i >= ac || av[i] == NULL) - return NULL; - - avdir->offset = i; - - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */ - dp->d_ino = i + 1; /* W2DO? */ - dp->d_reclen = 0; /* W2DO? */ - -#if !defined(hpux) && !defined(sun) -#if !defined(__APPLE__) - dp->d_off = 0; /* W2DO? */ -#endif - dp->d_type = dt[i]; -#endif - - strncpy(dp->d_name, av[i], sizeof(dp->d_name)); -if (_av_debug) -fprintf(stderr, "*** avReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name); - - return dp; -} - -DIR * avOpendir(const char * path) -{ - AVDIR avdir; - struct dirent * dp; - size_t nb = 0; - const char ** av; - unsigned char * dt; - char * t; - int ac; - -if (_av_debug) -fprintf(stderr, "*** avOpendir(%s)\n", path); - nb = sizeof(".") + sizeof(".."); - ac = 2; - - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1); - avdir = xcalloc(1, nb); - dp = (struct dirent *) (avdir + 1); - av = (const char **) (dp + 1); - dt = (unsigned char *) (av + (ac + 1)); - t = (char *) (dt + ac + 1); - - avdir->fd = avmagicdir; - avdir->data = (char *) dp; - avdir->allocation = nb; - avdir->size = ac; - avdir->offset = -1; - avdir->filepos = 0; - -#if defined(HAVE_PTHREAD_H) - (void) pthread_mutex_init(&avdir->lock, NULL); -#endif - - ac = 0; - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++; - dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++; - - av[ac] = NULL; - - return (DIR *) avdir; -} - -#ifdef WITH_NEON - -/* =============================================================== */ -int davmagicdir = 0x8440291; - -int davClosedir(DIR * dir) -{ - DAVDIR avdir = (DAVDIR)dir; - -if (_dav_debug < 0) -fprintf(stderr, "*** davClosedir(%p)\n", avdir); - -#if defined(HAVE_PTHREAD_H) - (void) pthread_mutex_destroy(&avdir->lock); -#endif - - avdir = _free(avdir); - return 0; -} - -struct dirent * davReaddir(DIR * dir) -{ - DAVDIR avdir = (DAVDIR)dir; - struct dirent * dp; - const char ** av; - unsigned char * dt; - int ac; - int i; - - if (avdir == NULL || !ISDAVMAGIC(avdir) || avdir->data == NULL) { - /* XXX TODO: EBADF errno. */ - return NULL; - } - - dp = (struct dirent *) avdir->data; - av = (const char **) (dp + 1); - ac = avdir->size; - dt = (unsigned char *) (av + (ac + 1)); - i = avdir->offset + 1; - - if (i < 0 || i >= ac || av[i] == NULL) - return NULL; - - avdir->offset = i; - - /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */ - dp->d_ino = i + 1; /* W2DO? */ - dp->d_reclen = 0; /* W2DO? */ - -#if !defined(hpux) && !defined(sun) -#if !defined(__APPLE__) - dp->d_off = 0; /* W2DO? */ -#endif - dp->d_type = dt[i]; -#endif - - strncpy(dp->d_name, av[i], sizeof(dp->d_name)); -if (_dav_debug < 0) -fprintf(stderr, "*** davReaddir(%p) %p \"%s\"\n", (void *)avdir, dp, dp->d_name); - - return dp; -} - -DIR * davOpendir(const char * path) -{ - struct fetch_context_s * ctx; - DAVDIR avdir; - struct dirent * dp; - size_t nb; - const char ** av, ** nav; - unsigned char * dt; - char * t; - int ac, nac; - int rc; - - /* HACK: glob does not pass dirs with trailing '/' */ - nb = strlen(path)+1; - if (path[nb-1] != '/') { - char * npath = alloca(nb+1); - *npath = '\0'; - (void) stpcpy( stpcpy(npath, path), "/"); - path = npath; - } - -if (_dav_debug < 0) -fprintf(stderr, "*** davOpendir(%s)\n", path); - - /* Load DAV collection into argv. */ - ctx = fetch_create_context(path); - if (ctx == NULL) { -/* HACK: errno = ??? */ - return NULL; - } - rc = davNLST(ctx); - if (rc) { -/* HACK: errno = ??? */ - return NULL; - } - - nb = 0; - ac = 0; - av = ctx->av; - if (av != NULL) - while (av[ac] != NULL) - nb += strlen(av[ac++]) + 1; - ac += 2; /* for "." and ".." */ - nb += sizeof(".") + sizeof(".."); - - nb += sizeof(*avdir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1); - avdir = xcalloc(1, nb); - dp = (struct dirent *) (avdir + 1); - nav = (const char **) (dp + 1); - dt = (unsigned char *) (nav + (ac + 1)); - t = (char *) (dt + ac + 1); - - avdir->fd = davmagicdir; - avdir->data = (char *) dp; - avdir->allocation = nb; - avdir->size = ac; - avdir->offset = -1; - avdir->filepos = 0; - -#if defined(HAVE_PTHREAD_H) - (void) pthread_mutex_init(&avdir->lock, NULL); -#endif - - nac = 0; - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++; - dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++; - - /* Copy DAV items into DIR elments. */ - ac = 0; - if (av != NULL) - while (av[ac] != NULL) { - nav[nac] = t; - dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG); - t = stpcpy(t, av[ac]); - ac++; - t++; - nac++; - } - nav[nac] = NULL; - - ctx = fetch_destroy_context(ctx); - - return (DIR *) avdir; -} - -#endif /* WITH_NEON */ diff --git a/rpmio/rpmdav.h b/rpmio/rpmdav.h index 2db424820..eade89c3f 100644 --- a/rpmio/rpmdav.h +++ b/rpmio/rpmdav.h @@ -5,72 +5,11 @@ * \file rpmio/rpmdav.h */ -#if defined(_RPMDAV_INTERNAL) -struct __dirstream { - int fd; /* File descriptor. */ - char * data; /* Directory block. */ - size_t allocation; /* Space allocated for the block. */ - size_t size; /* Total valid data in the block. */ - size_t offset; /* Current offset into the block. */ - off_t filepos; /* Position of next entry to read. */ - pthread_mutex_t lock; /* Mutex lock for this structure. */ -}; -#endif - -#if !defined(DT_DIR) || defined(__APPLE__) -# define DT_UNKNOWN 0 -# define DT_FIFO 1 -# define DT_CHR 2 -# define DT_DIR 4 -# define DT_BLK 6 -# define DT_REG 8 -# define DT_LNK 10 -# define DT_SOCK 12 -# define DT_WHT 14 -typedef struct __dirstream * AVDIR; -typedef struct __dirstream * DAVDIR; -#else -typedef DIR * AVDIR; -typedef DIR * DAVDIR; -#endif - - -/** - */ -extern int avmagicdir; -#define ISAVMAGIC(_dir) (!memcmp((_dir), &avmagicdir, sizeof(avmagicdir))) - -/** - */ -extern int davmagicdir; -#define ISDAVMAGIC(_dir) (!memcmp((_dir), &davmagicdir, sizeof(davmagicdir))) - #ifdef __cplusplus extern "C" { #endif /** - * Close an argv directory. - * @param dir argv DIR - * @return 0 always - */ -int avClosedir(DIR * dir); - -/** - * Return next entry from an argv directory. - * @param dir argv DIR - * @return next entry - */ -struct dirent * avReaddir(DIR * dir); - -/** - * Create an argv directory from URL collection. - * @param path URL for collection path - * @return argv DIR - */ -DIR * avOpendir(const char * path); - -/** * Send a http request. * @param ctrl * @param httpCmd http command @@ -109,53 +48,6 @@ int davSeek(void * cookie, _libio_pos_t pos, int whence); */ int davClose(void * cookie); -/** - */ -int davMkdir(const char * path, mode_t mode); - -/** - */ -int davRmdir(const char * path); - -/** - */ -int davRename(const char * oldpath, const char * newpath); - -/** - */ -int davUnlink(const char * path); - -/** - * Close a DAV collection. - * @param dir argv DIR - * @return 0 always - */ -int davClosedir(DIR * dir); - -/** - * Return next entry from a DAV collection. - * @param dir argv DIR - * @return next entry - */ -struct dirent * davReaddir(DIR * dir); - -/** - * Create an argv directory from DAV collection. - * @param path URL for DAV collection path - * @return argv DIR - */ -DIR * davOpendir(const char * path); - -/** - * stat(2) clone. - */ -int davStat(const char * path, struct stat * st); - -/** - * lstat(2) clone. - */ -int davLstat(const char * path, struct stat * st); - #ifdef __cplusplus } #endif |