[prev in list] [next in list] [prev in thread] [next in thread]
List: hurd-bug
Subject: Re: [PATCH 4/4] Serve mounts node with a passive translator record
From: Pino Toscano <toscano.pino () tiscali ! it>
Date: 2013-07-22 14:27:01
Message-ID: 201307221627.06217.toscano.pino () tiscali ! it
[Download RAW message or body]
Hi,
just take care of the GNU indentation (yes, I'm being overly pedantic
here), mostly missing spaces missing between function and parenthesis.
Alle marted́ 16 luglio 2013, Justus Winter ha scritto:
> Make mounts a node with a passive translator record so that the mtab
> translator is started on access if it is available.
>
> * rootdir.c (MTAB_TRANSLATOR): New macro.
> (rootdir_mounts_get_translator): New function.
> (mtab_translator_state): New enum.
> (rootdir_mounts_exists): New function.
> (rootdir_translator_make_node): Likewise.
> (rootdir_entries): Add "mounts" node.
> ---
> rootdir.c | 53
> +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file
> changed, 53 insertions(+)
>
> diff --git a/rootdir.c b/rootdir.c
> index 31e2d8c..c8ff01d 100644
> --- a/rootdir.c
> +++ b/rootdir.c
> @@ -404,6 +404,37 @@ rootdir_gc_fakeself (void *hook, char
> **contents, ssize_t *contents_len) return 0;
> }
>
> +/* The mtab translator to use by default for the "mounts" node. */
> +#define MTAB_TRANSLATOR "/hurd/mtab"
IIRC here a tab (instead of a space) goes between the define and its
value.
> +static error_t
> +rootdir_mounts_get_translator (void *hook, char **argz, size_t
> *argz_len)
> +{
> + static char mtab_argz[] = MTAB_TRANSLATOR "\0/";
mtab_argz can be const.
> +enum mtab_translator_state {
> + MTAB_FALSE = FALSE,
> + MTAB_TRUE = TRUE,
> + MTAB_UNINITIALIZED,
> +};
> +
> +static int
> +rootdir_mounts_exists ()
parameter-less, so add void
> +{
> + static enum mtab_translator_state state = MTAB_UNINITIALIZED;
> + if (state == MTAB_UNINITIALIZED)
> + state = access(MTAB_TRANSLATOR, F_OK|X_OK) == 0;
> + return state;
instead of an enum, wouldn't be simplier just use -1 in the code above
instead of MTAB_UNINITIALIZED?
--
Pino Toscano
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic