[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] Serve mounts node with a passive translator record
From: |
Pino Toscano |
Subject: |
Re: [PATCH 4/4] Serve mounts node with a passive translator record |
Date: |
Mon, 22 Jul 2013 16:27:01 +0200 |
User-agent: |
KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; ) |
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
Description: This is a digitally signed message part.