qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 05/42] ivshmem-server: Don't overload POSIX s


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v2 05/42] ivshmem-server: Don't overload POSIX shmem and file name
Date: Thu, 10 Mar 2016 01:44:27 +0100

Hi

On Wed, Mar 9, 2016 at 9:14 PM, Markus Armbruster <address@hidden> wrote:
>> @@ -77,7 +77,7 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int 
>> argc, char *argv[])
>>                         "F"  /* foreground */
>>                         "p:" /* pid_file */
>>                         "S:" /* unix_socket_path */
>> -                       "m:" /* shm_path */
>> +                       "m:" /* dirname */
>
> The existing comments all name the member of args set by the option.
> There is no member dirname.

I read from help: "-m <dirname>: where to create shared memory"

>
>>                         "M:" /* shm_path */
>>                         "l:" /* shm_size */
>>                         "n:" /* n_vectors */
>> @@ -106,13 +106,15 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int 
>> argc, char *argv[])
>>              break;
>>
>>          case 'M': /* shm_path */
>> -            args->shm_path = optarg;
>> -            args->use_shm_open = true;
>> -            break;
>> +        case 'm': /* dirname */
>> +            if (args->shm_path) {
>> +                fprintf(stderr, "Please specify either -m or -M.\n");
>> +                ivshmem_server_help(argv[0]);
>> +                exit(1);
>> +            }
>>
>> -        case 'm': /* shm_path */
>>              args->shm_path = optarg;
>> -            args->use_shm_open = false;
>> +            args->use_shm_open = c == 'M';
>
> I think I'll steal this idea :)

feel free

>
>>              break;
>>
>>          case 'l': /* shm_size */
>> @@ -207,7 +209,7 @@ main(int argc, char *argv[])
>>          .foreground = IVSHMEM_SERVER_DEFAULT_FOREGROUND,
>>          .pid_file = IVSHMEM_SERVER_DEFAULT_PID_FILE,
>>          .unix_socket_path = IVSHMEM_SERVER_DEFAULT_UNIX_SOCK_PATH,
>> -        .shm_path = IVSHMEM_SERVER_DEFAULT_SHM_PATH,
>> +        .shm_path = NULL,
>>          .use_shm_open = true,
>>          .shm_size = IVSHMEM_SERVER_DEFAULT_SHM_SIZE,
>>          .n_vectors = IVSHMEM_SERVER_DEFAULT_N_VECTORS,
>> @@ -237,8 +239,9 @@ main(int argc, char *argv[])
>>
>>      /* init the ivshms structure */
>>      if (ivshmem_server_init(&server, args.unix_socket_path,
>> -                            args.shm_path, args.use_shm_open,
>> -                            args.shm_size, args.n_vectors, args.verbose) < 
>> 0) {
>> +                            args.shm_path ?: 
>> IVSHMEM_SERVER_DEFAULT_SHM_PATH,
>> +                            args.use_shm_open, args.shm_size, 
>> args.n_vectors,
>> +                            args.verbose) < 0) {
>>          fprintf(stderr, "cannot init server\n");
>>          goto err;
>>      }

thanks

-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]