This patch fixes a libubi bug and does some random minor cleanups.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
/*
* This file contains various common stuff used by UBI utilities.
+ *
+ * Author: Artem Bityutskiy
*/
#include <stdio.h>
if (minor == 0) {
errmsg("\"%s\" is not a volume character device", node);
- errno = -EINVAL;
+ errno = EINVAL;
return -1;
}
if (minor != 0) {
errmsg("\"%s\" is not an UBI character device", node);
- errno = -EINVAL;
+ errno = EINVAL;
return -1;
}
/*
* An utility to create UBI volumes.
*
- * Authors: Artem B. Bityutskiy <dedekind@infradead.org>
+ * Authors: Artem Bityutskiy <dedekind@infradead.org>
* Frank Haverkamp <haver@vnet.ibm.com>
*/
long long bytes;
int lebs;
int alignment;
- char *name;
+ const char *name;
int nlen;
char node[MAX_NODE_LEN + 2];
int maxavs;
static int parse_opt(int argc, char * const argv[], struct args *args)
{
- char *endp;
-
while (1) {
int key;
+ char *endp;
key = getopt_long(argc, argv, "a:n:N:s:S:t:hVm", long_options, NULL);
if (key == -1)
err = ubi_get_dev_info(libubi, myargs.node, &dev_info);
if (err) {
- errmsg("cannot get information about UBI device number %s",
+ errmsg("cannot get information about UBI device \"%s\"",
myargs.node);
perror("ubi_get_dev_info");
goto out_libubi;
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author: Artem Bityutskiy
*/
/*
* An utility to get UBI information.
+ *
+ * Author: Artem Bityutskiy
*/
+
#include <stdio.h>
#include <stdint.h>
#include <getopt.h>
};
static const char *doc = "Version " PROGRAM_VERSION "\n"
- PROGRAM_NAME " - a tool to UBI information.";
+ PROGRAM_NAME " - a tool to print UBI information.";
static const char *optionsstr =
"-d, --devn=<UBI device number> UBI device number to get information about\n"
static int parse_opt(int argc, char * const argv[], struct args *args)
{
- char *endp;
-
while (1) {
int key;
+ char *endp;
key = getopt_long(argc, argv, "an:d:hV", long_options, NULL);
if (key == -1)
/*
* An utility to remove UBI volumes.
*
- * Authors: Artem B. Bityutskiy <dedekind@infradead.org>
+ * Authors: Artem Bityutskiy <dedekind@infradead.org>
* Frank Haverkamp <haver@vnet.ibm.com>
*/
static int parse_opt(int argc, char * const argv[], struct args *args)
{
- char *endp;
-
while (1) {
int key;
+ char *endp;
key = getopt_long(argc, argv, "n:hV", long_options, NULL);
if (key == -1)