From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: "Eric Bénard" <eric@eukrea.com>
Cc: barebox@lists.infradead.org, Juergen Beisert <jbe@pengutronix.de>
Subject: Re: [PATCH v4 1/3] env: add register_persistent_environment
Date: Tue, 19 Feb 2013 12:58:43 +0100 [thread overview]
Message-ID: <20130219115843.GL19322@game.jcrosoft.org> (raw)
In-Reply-To: <1361265445-11731-1-git-send-email-eric@eukrea.com>
On 10:17 Tue 19 Feb , Eric Bénard wrote:
> - heavily copied from register_persistant_environment which was
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
>
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
> v4: rename function and move to envfs.h
> v3: also fix the typo in the printf
> v2: fix typo in persistent
> common/environment.c | 40 ++++++++++++++++++++++++++++++++++++++++
> include/envfs.h | 2 ++
> 2 files changed, 42 insertions(+)
>
> diff --git a/common/environment.c b/common/environment.c
> index e8d623f..78cd45c 100644
> --- a/common/environment.c
> +++ b/common/environment.c
> @@ -363,3 +363,43 @@ out:
> free(buf_free);
> return ret;
> }
> +
> +#ifdef __BAREBOX__
> +/**
> + * Try to register an environment storage on a device's partition
> + * @return 0 on success
> + *
> + * We rely on the existence of a usable storage device, already attached to
> + * our system, to get something like a persistent memory for our environment.
> + * We need to specify the partition number to use on this device.
> + * @param[in] devname Name of the device
> + * @param[in] partnr Partition number
> + * @return 0 on success, anything else in case of failure
> + */
> +
> +int envfs_register_partition(const char *devname, unsigned int partnr)
a part can be a number or a name
Best Regards,
J.
> +{
> + struct cdev *cdev;
> + char *partname;
> +
> + if (!devname)
> + return -EINVAL;
> +
> + cdev = cdev_by_name(devname);
> + if (cdev == NULL) {
> + pr_err("No %s present\n", devname);
> + return -ENODEV;
> + }
> + partname = asprintf("%s.%d", devname, partnr);
> + cdev = cdev_by_name(partname);
> + if (cdev == NULL) {
> + pr_err("No %s partition available\n", partname);
> + pr_info("Please create the partition %s to store the env\n", partname);
> + return -ENODEV;
> + }
> +
> + return devfs_add_partition(partname, 0, cdev->size,
> + DEVFS_PARTITION_FIXED, "env0");
> +}
> +EXPORT_SYMBOL(envfs_register_partition);
> +#endif
> diff --git a/include/envfs.h b/include/envfs.h
> index 2db55ed..e9372b3 100644
> --- a/include/envfs.h
> +++ b/include/envfs.h
> @@ -96,4 +96,6 @@ int envfs_save(char *filename, char *dirname);
> /* defaults to /dev/env0 */
> extern char *default_environment_path;
>
> +int envfs_register_partition(const char *devname, unsigned int partnr);
> +
> #endif /* _ENVFS_H */
> --
> 1.7.11.7
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-02-19 11:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 16:45 [PATCH 0/2] ARM: cfa10036: Store the barebox environment on the MMC Maxime Ripard
2013-02-13 16:45 ` [PATCH 1/2] cfa-10036: Use the second MMC partition to store the environment Maxime Ripard
2013-02-13 17:10 ` Eric Bénard
2013-02-13 17:12 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 9:52 ` Maxime Ripard
2013-02-14 8:16 ` Juergen Beisert
2013-02-14 10:10 ` Maxime Ripard
2013-02-14 11:17 ` Eric Bénard
2013-02-14 11:56 ` [PATCH 1/3] env: add register_persistent_environment Eric Bénard
2013-02-14 11:56 ` [PATCH 2/3] imx23-olinuxino: swith to generic peristent env Eric Bénard
2013-02-14 11:56 ` [PATCH 3/3] falconwing: switch " Eric Bénard
2013-02-14 12:09 ` Juergen Beisert
2013-02-14 13:20 ` [PATCH v2] " Eric Bénard
2013-02-14 13:50 ` [PATCH v3] " Eric Bénard
2013-02-14 19:31 ` [PATCH 1/3] env: add register_persistent_environment Sascha Hauer
2013-02-19 9:17 ` [PATCH v4 " Eric Bénard
2013-02-19 9:17 ` [PATCH v4 2/3] imx23-olinuxino: swith to generic peristent env Eric Bénard
2013-02-19 9:17 ` [PATCH v4 3/3] falconwing: switch " Eric Bénard
2013-02-19 11:58 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-02-19 13:41 ` [PATCH v4 1/3] env: add register_persistent_environment Eric Bénard
2013-02-19 15:35 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-19 15:49 ` Eric Bénard
2013-02-19 15:57 ` Eric Bénard
2013-02-19 19:21 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-21 6:55 ` Eric Bénard
2013-02-21 11:20 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-21 13:52 ` Sascha Hauer
2013-02-13 16:45 ` [PATCH 2/2] cfa10036: Update the environment Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130219115843.GL19322@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
--cc=eric@eukrea.com \
--cc=jbe@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox