libgrub_entry.c revision 753a6d457b330b1b29b2d3eefcd0831116ce950d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* in a GRUB menu entry.
*/
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <assert.h>
#include <ctype.h>
#include "libgrub_cmd.def"
#include "libgrub_impl.h"
static const barg_parsef_t barg_parse[] = {
#include "libgrub_cmd.def"
};
/*
* Remove extra '/', stops at first isspace character.
* Return new string length.
*/
clean_path(char *path)
{
int i, c;
size_t k, n;
/* bcopy should deal with overlapping buffers */
n -= k;
}
}
return (n - 1);
}
/*
* Construct boot command line from the ge_barg field
*/
static size_t
{
size_t n;
const grub_fsdesc_t *fsd;
if (!IS_BARG_VALID(barg) ||
return ((size_t)-1);
if (fsd->gfs_mountp[0] != 0) {
return (n);
return (clean_path(cmd));
} else
}
/*
* Construct ge_barg field based on the other fields of the entry.
* Return 0 on success, errno on failure.
*/
int
{
int ret = 0;
ret = EG_INVALIDCMD;
else
if (ret != 0)
break;
}
if (ret == 0) {
/* at least kernel and module should be defined */
}
return (ret);
}
const char *
{
if (IS_ENTRY_BARG_VALID(ent))
else
return (NULL);
}
const char *
{
if (IS_ENTRY_BARG_VALID(ent))
else
return (NULL);
}
const char *
{
if (IS_ENTRY_BARG_VALID(ent))
else
return (NULL);
}
const char *
{
return ("Not implemented");
}
const grub_fsdesc_t *
{
if (IS_ENTRY_BARG_VALID(ent))
else
return (NULL);
}
{
else
return ((size_t)-1);
}