misc: use MAX_VM_NAME_LEN
replace MAX_VMNAME_LEN with MAX_VM_NAME_LEN to keep sync with HV and devicemodel Tracked-On: #6685 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
parent
da0d24326e
commit
4233409c06
|
@ -51,7 +51,7 @@ struct mngr_msg {
|
|||
|
||||
/* req of ACRND_TIMER */
|
||||
struct req_acrnd_timer {
|
||||
char name[MAX_VMNAME_LEN];
|
||||
char name[MAX_VM_NAME_LEN];
|
||||
time_t t;
|
||||
} acrnd_timer;
|
||||
|
||||
|
@ -75,7 +75,7 @@ struct mngr_msg {
|
|||
|
||||
/* req of RTC_TIMER */
|
||||
struct req_rtc_timer {
|
||||
char vmname[MAX_VMNAME_LEN];
|
||||
char vmname[MAX_VM_NAME_LEN];
|
||||
time_t t;
|
||||
} rtc_timer;
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ int list_vm()
|
|||
|
||||
int start_vm(const char *vmname)
|
||||
{
|
||||
char cmd[PATH_LEN + sizeof(ACRN_CONF_PATH_ADD) * 2 + MAX_VMNAME_LEN * 2];
|
||||
char cmd[PATH_LEN + sizeof(ACRN_CONF_PATH_ADD) * 2 + MAX_VM_NAME_LEN * 2];
|
||||
|
||||
if (snprintf(cmd, sizeof(cmd), "bash %s/%s.sh $(cat %s/%s.args)",
|
||||
ACRN_CONF_PATH_ADD, vmname, ACRN_CONF_PATH_ADD, vmname) >= sizeof(cmd)) {
|
||||
|
|
|
@ -87,8 +87,8 @@ static int check_name(const char *name)
|
|||
if (!strcmp(name, "nothing"))
|
||||
return -1;
|
||||
|
||||
if (strnlen(name, MAX_VMNAME_LEN) >= MAX_VMNAME_LEN) {
|
||||
printf("(%s) size exceed MAX_VMNAME_LEN:%u\n", name, MAX_VMNAME_LEN);
|
||||
if (strnlen(name, MAX_VM_NAME_LEN) >= MAX_VM_NAME_LEN) {
|
||||
printf("(%s) size exceed MAX_VM_NAME_LEN:%u\n", name, MAX_VM_NAME_LEN);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ struct vmmngr_struct *vmmngr_find(const char *vmname);
|
|||
|
||||
/* Per-vm vm managerment struct */
|
||||
struct vmmngr_struct {
|
||||
char name[MAX_VMNAME_LEN];
|
||||
char name[MAX_VM_NAME_LEN];
|
||||
unsigned long state;
|
||||
unsigned long state_tmp;
|
||||
unsigned long update; /* update count, remove a vm if no update for it */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/* acrnd worker timer */
|
||||
|
||||
struct work_arg {
|
||||
char name[MAX_VMNAME_LEN];
|
||||
char name[MAX_VM_NAME_LEN];
|
||||
};
|
||||
|
||||
struct acrnd_work {
|
||||
|
@ -360,7 +360,7 @@ static void handle_timer_req(struct mngr_msg *msg, int client_fd, void *param)
|
|||
}
|
||||
|
||||
strncpy(arg.name, msg->data.acrnd_timer.name, sizeof(arg.name) - 1);
|
||||
if (sizeof(arg.name) - 1 < strnlen(msg->data.acrnd_timer.name, MAX_VMNAME_LEN)) {
|
||||
if (sizeof(arg.name) - 1 < strnlen(msg->data.acrnd_timer.name, MAX_VM_NAME_LEN)) {
|
||||
perror("timer name was truncated\n");
|
||||
goto reply_ack;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue