url.h File Reference

Header file for the urls action and URL-related functions. More...

#include "actions.h"
#include "global.h"
Include dependency graph for url.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int url__load_list (char *dir, int reserve_space)
 Loads the URLs for the given dir.
int url__load_nonempty_list (char *dir, int reserve_space)
 Wrapper for url__load_list(); Cries for ENOENT .
int url__output_list (void)
 Writes the URL list back.
int url__find_by_name (const char *name, struct url_t **storage)
 Returns a struct url_t matching the given string.
int url__find_by_intnum (int intnum, struct url_t **storage)
 Returns a struct url_t matching the given internal number.
int url__find_by_url (char *url, struct url_t **storage)
 Returns a struct url_t matching the given url.
int url__full_url (struct estat *sts, char **url)
 Returns the full URL for this entry.
int url__other_full_url (struct estat *sts, struct url_t *url, char **output)
 Returns the full URL for this entry for some other than the highest priority URL.
int url__parse (char *input, struct url_t *storage, int *def_parms)
 Parses the given string into the URL storage.
int url__open_session (svn_ra_session_t **session, char **missing_dirs)
 Opens a session to the current_url .
int url__find (char *url, struct url_t **output)
 Looks for an URL matching url, and returns its address.
int url__current_has_precedence (struct url_t *to_compare)
 Returns whether current_url has a higher priority than the URL to compare.
int url__insert_or_replace (char *eurl, struct url_t **storage, int *existed)
 Insert or replace URL.
int url__allocate (int reserve_space)
 Allocate additional space for the given number of URLs.
int url__close_session (struct url_t *cur)
 Closes given RA session and frees associated memory.
int url__close_sessions (void)
 Closes all RA sessions.
int url__mark_todo (void)
 Marks URLs for handling.
int url__store_url_name (char *parm)
 Remember URL name parameter for later processing.
static int url__to_be_handled (const struct url_t *url)
 Returns whether url should be handled.
int url__iterator2 (svn_revnum_t *target_rev, int only_if_count, char **missing)
 Simple function setting current_url, and returning whether there's something to do.
static int url__iterator (svn_revnum_t *target_rev)
static int url__sorter (struct url_t *u1, struct url_t *u2)
 Comparing two URLs.
int url__indir_sorter (const void *a, const void *b)
 For use in qsort().
int url__canonical_rev (struct url_t *url, svn_revnum_t *rev)
 Changes the revision number, if SVN_INVALID_REVNUM, to the real value.

Variables

char ** url__parm_list
 A NULL terminated array of url parameters.
int url__parm_list_used
 How many URLs were given as parameters.
int url__must_write_defs
 Whether the URL list in FSVS_CONF must be written.
work_t url__work
 URLs action.

Detailed Description

Header file for the urls action and URL-related functions.

Definition in file url.h.


Function Documentation

int url__allocate ( int  reserve_space  ) 

Allocate additional space for the given number of URLs.

Definition at line 753 of file url.c.

References hlp__calloc(), hlp__realloc(), STOPIF, urllist, and urllist_count.

Referenced by co__work(), url__load_list(), and url__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__canonical_rev ( struct url_t url,
svn_revnum_t *  rev 
)

Changes the revision number, if SVN_INVALID_REVNUM, to the real value.

Changes the revision number, if SVN_INVALID_REVNUM, to the real value.

DAV (http:// and https://) don't like getting SVN_INVALID_REVNUM on some operations; they throw an 175007 "HTTP Path Not Found", and "REPORT request failed on '...'".

So we need the real HEAD.

We try to be fast, and only fetch the value if we really need it.

Definition at line 1658 of file url.c.

References BUG_ON, DEBUGP, url_t::head_rev, url_t::pool, url_t::session, STOPIF_SVNERR, and url_t::url.

Referenced by df__do_diff(), df__work(), exp__do(), log__work(), url__iterator2(), and url__open_session().

Here is the caller graph for this function:

int url__close_session ( struct url_t cur  ) 

Closes given RA session and frees associated memory.

Definition at line 1185 of file url.c.

References BUG_ON, DEBUGP, url_t::pool, url_t::session, and url_t::url.

Referenced by exp__work(), and url__close_sessions().

Here is the caller graph for this function:

int url__close_sessions ( void   ) 

Closes all RA sessions.

Definition at line 1205 of file url.c.

References IF_FREE, STOPIF, url__close_session(), url__parm_list, url__parm_list_len, url__parm_list_used, urllist, and urllist_count.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__current_has_precedence ( struct url_t to_compare  ) 

Returns whether current_url has a higher priority than the URL to compare.

Returns whether current_url has a higher priority than the URL to compare.

If an entry has no URL yet (is new), to_compare is NULL, and the current_url has higher priority; this is common, and so done here too.

Definition at line 1227 of file url.c.

References current_url, and url_t::priority.

Referenced by cb___apply_textdelta(), cb___store_prop(), cb__add_entry(), sync___recurse(), up__change_dir_prop(), and up__change_file_prop().

Here is the caller graph for this function:

int url__find ( char *  url,
struct url_t **  output 
)

Looks for an URL matching url, and returns its address.

Definition at line 1410 of file url.c.

References url_t::url, url_t::urllen, urllist, and urllist_count.

Referenced by df__do_diff(), and rev__install_file().

Here is the caller graph for this function:

int url__find_by_intnum ( int  intnum,
struct url_t **  storage 
)

Returns a struct url_t matching the given internal number.

Definition at line 314 of file url.c.

References DEBUGP, urllist, and urllist_count.

Referenced by ops__load_1entry(), and url__load_list().

Here is the caller graph for this function:

int url__find_by_name ( const char *  name,
struct url_t **  storage 
)

Returns a struct url_t matching the given string.

Returns a struct url_t matching the given string.

Because this may be called below input_tree, returning ENOENT could be interpreted as no dirlist found - which has to be allowed in some cases. So this returns EADDRNOTAVAIL.

Definition at line 245 of file url.c.

References DEBUGP, urllist, and urllist_count.

Referenced by au__prepare_for_added(), ci__work(), log__work(), url__insert_or_replace(), and url__mark_todo().

Here is the caller graph for this function:

int url__find_by_url ( char *  url,
struct url_t **  storage 
)

Returns a struct url_t matching the given url.

Definition at line 307 of file url.c.

References url__find_by_url_in_list(), urllist, and urllist_count.

Referenced by url__insert_or_replace().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__full_url ( struct estat sts,
char **  url 
)

Returns the full URL for this entry.

Definition at line 1397 of file url.c.

References STOPIF, estat::url, and url__other_full_url().

Referenced by cm___make_copy(), df__do_diff(), st__print_entry_info(), st__print_status(), and sync___recurse().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__indir_sorter ( const void *  a,
const void *  b 
)

For use in qsort().

Definition at line 779 of file url.c.

References url__sorter().

Referenced by url__load_list().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__insert_or_replace ( char *  eurl,
struct url_t **  storage,
int *  existed 
)

Insert or replace URL.

Insert or replace URL.

This functions returns 0 for success. Error codes (eg EADDRNOTAVAIL ) are possible.

If *existed is non- NULL, it is set to 0 for a new URL or EEXIST if an existing URL was overwritten.

The URL is parsed into an empty space at the end of urllist , which must already exist!

If the same URL was already used, the old entry gets overwritten.

Definition at line 580 of file url.c.

References HAVE_NAME, HAVE_PRIO, HAVE_READONLY, HAVE_TARGET, HAVE_URL, url_t::is_readonly, url_t::name, url_t::priority, STOPIF, STOPIF_CODE_ERR, url_t::target_rev, url_t::url, url__find_by_name(), url__find_by_url(), url__parse(), urllist, and urllist_count.

Referenced by co__work(), url__load_list(), and url__work().

Here is the call graph for this function:

Here is the caller graph for this function:

static int url__iterator ( svn_revnum_t *  target_rev  )  [inline, static]

Definition at line 86 of file url.h.

References url__iterator2().

Referenced by df__work(), rev__work(), sync__work(), and up__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__iterator2 ( svn_revnum_t *  target_rev,
int  only_if_count,
char **  missing 
)

Simple function setting current_url, and returning whether there's something to do.

Simple function setting current_url, and returning whether there's something to do.

Returns 0 as long as there's an URL to process; current_url is set, and opened. In target_rev the target revision (as per default of this URL, or as given by the user) is returned.
If current_url is not NULL upon entry the connection to this URL is closed, and its memory freed.

If called with target_rev NULL, the internal index is reset, and no URL initialization is done.

At the end of the list EOF is given.

Definition at line 1700 of file url.c.

References url_t::current_target_override, url_t::current_target_rev, current_url, DEBUGP, url_t::entry_list_count, hlp__rev_to_string(), opt_target_revision, opt_target_revisions_given, STOPIF, url_t::target_rev, url_t::url, url__canonical_rev(), url__open_session(), url__to_be_handled(), urllist, and urllist_count.

Referenced by url__iterator().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__load_list ( char *  dir,
int  reserve_space 
)

Loads the URLs for the given dir.

Loads the URLs for the given dir.

reserve_space says how much additional space should be allocated.

This function sets urllist_mem to the string buffer allocated, and the urllist pointers get set to the URLs. If no dir file is found, ENOENT is returned without an error message.

We read two sources; the one in FSVS_CONF normally holds the URL, the target revision, the priority, the name, the internal number, and the readonly flag.

The current revision is read from FSVS_WAA.

See also:
Files used by fsvs.

Definition at line 804 of file url.c.

References url_t::current_rev, DEBUGP, hlp__alloc(), hlp__string_from_filep(), url_t::internal_number, STOPIF, STOPIF_CODE_ERR, url__allocate(), url__find_by_intnum(), url__indir_sorter(), url__insert_or_replace(), url__must_write_defs, urllist, urllist_count, waa__open_byext(), WAA__READ, WAA__URL_REVS, and WAA__URLLIST_EXT.

Referenced by au__prepare_for_added(), bld__work(), cat__work(), cm__detect(), ign__work(), info__work(), st__work(), url__load_nonempty_list(), and url__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__load_nonempty_list ( char *  dir,
int  reserve_space 
)

Wrapper for url__load_list(); Cries for ENOENT .

Wrapper for url__load_list(); Cries for ENOENT .

This prints a message and stops if no URLs could be read.

Definition at line 950 of file url.c.

References STOPIF_CODE_ERR, url__load_list(), urllist_count, and wc_path.

Referenced by ci__work(), cm__uncopy(), cm__work(), df__work(), log__work(), res__work(), rev__work(), sync__work(), and up__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__mark_todo ( void   ) 

Marks URLs for handling.

Marks URLs for handling.

This function takes a list of URL names (and optionally target revisions), and marks the URLs by setting url_t::to_be_handled.

url__parm_list gets destroyed.

Definition at line 1575 of file url.c.

References url_t::current_target_override, url_t::current_target_rev, DEBUGP, hlp__parse_rev(), STOPIF, url_t::to_be_handled, url_t::url, url__find_by_name(), url__parm_list, and url__parm_list_used.

Referenced by au__prepare_for_added(), df__work(), and up__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__open_session ( svn_ra_session_t **  session,
char **  missing_dirs 
)

Opens a session to the current_url .

Opens a session to the current_url .

If missing_dirs is not NULL, this function returns in *missing_dirs a copied string with the missing path components from current_url->url (which should be freed later).

Note:
The session is then registered at the existing part, so all accesses must include this relative part!

If the URL is ok, a NULL is returned (not a pointer to a \0 ).

This is needed for the mkdir_base option; we cannot create the hierarchy here, because we need a commit editor for that, but in ci__directory() we cannot use a session based on an non-existing URL.

Definition at line 1072 of file url.c.

References BUG_ON, cb__cb_table, cb__does_path_exist(), current_url, DEBUGP, global_pool, hlp__get_svn_config(), hlp__strnalloc(), IF_FREE, url_t::pool, url_t::session, STOPIF, STOPIF_CODE_EPIPE, STOPIF_SVNERR, STOPIF_SVNERR_TEXT, url_t::url, url__canonical_rev(), and url_t::urllen.

Referenced by cat__work(), ci__work(), df__do_diff(), exp__do(), log__work(), rev__install_file(), and url__iterator2().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__other_full_url ( struct estat sts,
struct url_t url,
char **  output 
)

Returns the full URL for this entry for some other than the highest priority URL.

Returns the full URL for this entry for some other than the highest priority URL.

The space for the output is allocated, and must not be freed.

Definition at line 1355 of file url.c.

References cch__add(), ops__build_path(), estat::path_len, PATH_SEPARATOR, STOPIF, url_t::url, and url_t::urllen.

Referenced by url__full_url().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__output_list ( void   ) 

Writes the URL list back.

Writes the URL list back.

The data is written in two different locations.

The internal number was chosen as combining key, because the URL might include strange characters, and there might not be a name.

Todo:
is 1024 bytes always enough? Maybe there's an RFC. Make that dynamically - look how much we'll need.

Todo:
: writev

Definition at line 975 of file url.c.

References BUG_ON, url_t::current_rev, DEBUGP, url_t::internal_number, url_t::is_readonly, url_t::name, url_t::priority, STOPIF, STOPIF_CODE_ERR, url_t::target_rev, url_t::url, url___set_internal_nums(), url__must_write_defs, urllist, urllist_count, waa__close(), waa__open_byext(), WAA__URL_REVS, WAA__URLLIST_EXT, and WAA__WRITE.

Referenced by ci__work(), co__work(), sync__work(), up__work(), and url__work().

Here is the call graph for this function:

Here is the caller graph for this function:

int url__parse ( char *  input,
struct url_t storage,
int *  def_parms 
)

Parses the given string into the URL storage.

Parses the given string into the URL storage.

This function preserves it's input. If storage is non- NULL, it's ->name member get's a copy of the given (or a deduced) name.

In def_parms the parameters found are flagged - see url_flags; if def_parms is NULL, an URL must be present.

Definition at line 362 of file url.c.

References url_t::current_rev, url_t::current_target_override, DEBUGP, HAVE_NAME, HAVE_PRIO, HAVE_READONLY, HAVE_TARGET, HAVE_URL, url_t::head_rev, hlp__parse_rev(), hlp__rev_to_string(), hlp__strdup(), hlp__strnalloc(), url_t::internal_number, INVALID_INTERNAL_NUMBER, url_t::is_readonly, url_t::name, url_t::priority, STOPIF, STOPIF_CODE_ERR, url_t::target_rev, url_t::url, url__must_write_defs, and url_t::urllen.

Referenced by exp__work(), and url__insert_or_replace().

Here is the call graph for this function:

Here is the caller graph for this function:

static int url__sorter ( struct url_t u1,
struct url_t u2 
) [inline, static]

Comparing two URLs.

They get sorted by priority ascending (lower numbers, so higher priority, first), then by url ascending (sort URLs alphabetically).

This is necessary, as on update we walk the urllist in order, to have lower priority entries appearing when higher priority entries are removed.

If the first URL has a higher priority, a negative value is returned.

Definition at line 102 of file url.h.

References url_t::priority, and url_t::url.

Referenced by cb___remover(), and url__indir_sorter().

Here is the caller graph for this function:

int url__store_url_name ( char *  parm  ) 

Remember URL name parameter for later processing.

Remember URL name parameter for later processing.

We may have to reallocate. We don't want to allocate a pointer for each argument - we might be run with something like "find / -type f | xargs fsvs update".

Definition at line 1629 of file url.c.

References hlp__realloc(), STOPIF, url__parm_list, url__parm_list_len, and url__parm_list_used.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static int url__to_be_handled ( const struct url_t url  )  [inline, static]

Returns whether url should be handled.

Definition at line 76 of file url.h.

References url_t::to_be_handled, and url__parm_list_used.

Referenced by url__iterator2().

Here is the caller graph for this function:


Variable Documentation

Whether the URL list in FSVS_CONF must be written.

Definition at line 236 of file url.c.

Referenced by cb__remove_url(), url__load_list(), url__output_list(), url__parse(), and url__work().

A NULL terminated array of url parameters.

A NULL terminated array of url parameters.

Does get free()d by url__close_sessions().

See -u for the specification.

Definition at line 232 of file url.c.

Referenced by au__prepare_for_added(), log__work(), url__close_sessions(), url__mark_todo(), and url__store_url_name().

How many URLs were given as parameters.

Definition at line 234 of file url.c.

Referenced by au__prepare_for_added(), log__work(), url__close_sessions(), url__mark_todo(), url__store_url_name(), and url__to_be_handled().

work_t url__work

URLs action.

Definition at line 26 of file url.h.


Generated for fsvs by  doxygen 1.6.1