diff options
author | Sergiu Ivanov <unlimitedscolobb@gmail.com> | 2008-09-19 11:30:09 +0300 |
---|---|---|
committer | Sergiu Ivanov <unlimitedscolobb@gmail.com> | 2008-09-19 11:30:09 +0300 |
commit | 783e451ddefe81ef0c83412569b0a99c415f28d9 (patch) | |
tree | 23a256044ceedc93deb4576231473e8b26fc26a8 /node.c | |
parent | 06c2f31b8e3d8a5818f2bc28b554a8929a1f722f (diff) |
Added the mechanism of maintaining shadow nodes alive.
I refactored the node cache in such a way that it now only
maintains references to nodes (the reason is that only
directory nodes and shadow nodes are created, therefore the
existing node cache is very well suited for this purpose).
It must be remarked that the node cache, borrowed from
unionfs, has never actually been a *cache*, therefore this
small change does not alter things badly.
I also removed the command line option --ncache-size.
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 77 |
1 files changed, 0 insertions, 77 deletions
@@ -34,11 +34,6 @@ #include <stdio.h> #include <argz.h> #include <hurd/fsys.h> - - -/*!!!!!!!REMOVE THIS!!!!!!*/ -#include <sys/file.h> - /*----------------------------------------------------------------------------*/ #include "debug.h" #include "node.h" @@ -1051,75 +1046,3 @@ node_kill_translators } }/*node_kill_translators*/ /*----------------------------------------------------------------------------*/ -/*Constructs a list of translators that were set on the ancestors of `node`*/ -/*TODO: Remove node_list_translators.*/ -error_t -node_list_translators - ( - node_t * node, - char ** trans, /*the malloced list of 0-separated strings*/ - size_t * ntrans /*the number of elements in `trans`*/ - ) - { - /*The size of block of memory for the list of translators*/ - size_t sz = 0; - - /*Used for tracing the lineage of `node`*/ - lnode_t * ln = node->nn->lnode; - - /*Used in computing the lengths of lists of translators in every node - we will go through and for constructing the final list of translators*/ - char * p; - - /*The current position in *data (used in filling out the list of - translators)*/ - char * transp; - - /*The length of the current translator name*/ - size_t complen; - - size_t i; - - /*Trace the lineage of the `node` (including itself) and compute the - total length of the list of translators*/ - for(; ln; sz += node->nn->translen, ln = ln->dir); - - /*Try to allocate a block of memory sufficient for storing the list of - translators*/ - *trans = malloc(sz); - if(!*trans) - return ENOMEM; - - /*No translators at first*/ - *ntrans = 0; - - /*Again trace the lineage of the `node` (including itself)*/ - for(transp = *trans + sz, ln = node->nn->lnode; ln; ln = ln->dir) - { - /*Go through each translator name in the list of names*/ - for - ( - i = 0, p = node->nn->trans + node->nn->translen - 2; - i < node->nn->ntrans; ++i - ) - { - /*position p at the beginning of the current component and - compute its length at the same time*/ - for(complen = 0; *p; --p, ++complen); - --p; - - /*move the current position backwards*/ - transp -= complen + 1; - - /*copy the current translator name into the list*/ - strcpy(transp, p + 2); - - /*we've got another translator*/ - ++*ntrans; - } - } - - /*Everything OK*/ - return 0; - }/*lnode_list_translators*/ -/*----------------------------------------------------------------------------*/ |