char * zone;
char * rsetd;
uint32_t rsetf;
+ uint32_t priority;
resource_def_array_t *resources;
string_array_t *class_names;
string_array_t *zone_names;
const char *class,
const char *zone,
const char *def,
- uint32_t flags)
+ uint32_t flags,
+ uint32_t priority)
{
#define PUSH(msg, tag, typ, val) \
mrp_msg_append(msg, MRP_MSG_TAG_##typ(RESPROTO_##tag, val))
char *buf;
- uint32_t priority = 0;
mrp_msg_t *req;
char *p;
char c;
static void usage(client_t *client, int exit_code)
{
- printf("Usage: %s [-h] [-v] [-r] [-a] [class zone resources]\n\nwhere\n"
+ printf("Usage: %s [-h] [-v] [-r] [-a] [-p pri] [class zone resources]\n"
+ "\nwhere\n"
"\t-h\t\tprints this help\n"
"\t-v\t\tverbose mode (dumps the transport messages)\n"
"\t-a\t\tautoacquire mode\n"
"\t-r\t\tautorelease mode\n"
+ "\t-p priority\t\tresource set priority (priority is 0-7)\n"
"\tclass\t\tapplication class of the resource set\n"
"\tzone\t\tzone wher the resource set lives\n"
"\tresources\tcomma separated list of resources. Each resource is\n"
static void parse_arguments(client_t *client, int argc, char **argv)
{
+ unsigned long pri;
+ char *e;
int opt;
- while ((opt = getopt(argc, argv, "hvra")) != -1) {
+ while ((opt = getopt(argc, argv, "hvrap:")) != -1) {
switch (opt) {
case 'h':
usage(client, 0);
case 'r':
client->rsetf |= RESPROTO_RSETFLAG_AUTORELEASE;
break;
+ case 'p':
+ pri = strtoul(optarg, &e, 10);
+ if (e == optarg || *e || pri > 7)
+ usage(client, EINVAL);
+ else
+ client->priority = pri;
+ break;
default:
usage(client, EINVAL);
}
print_prompt(client, false);
else {
create_resource_set(client, client->class, client->zone,
- client->rsetd, client->rsetf);
+ client->rsetd, client->rsetf, client->priority);
}
mrp_add_io_watch(client->ml, 0, MRP_IO_EVENT_IN, console_input, client);