generic/60[78]: ensure the initial DAX file flag state before test
[xfstests-dev.git] / dmapi / src / simple / dm_create_session.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2000-2001 Silicon Graphics, Inc.
4  * All Rights Reserved.
5  */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <sys/errno.h>
9 #include <getopt.h>
10 #ifdef linux
11 #include <dmapi.h>
12 #endif
13
14 int
15 main( int argc, char **argv )
16 {
17         extern char *optarg;
18         int c;
19         int ret;
20         dm_sessid_t oldsid = DM_NO_SESSION;
21         dm_sessid_t newsid = 0;
22         char *sessinfo = "test1";
23         char *versionstr;
24
25         while( (c = getopt(argc, argv, "hs:i:")) != -1 ) {
26                 switch(c){
27                 case 's':
28                         oldsid = atoi( optarg );
29                         break;
30                 case 'i':
31                         sessinfo = optarg;
32                         break;
33                 case 'h':
34                         fprintf(stderr, "Usage: %s [-s oldsid] [-i sessinfo_txt]\n", argv[0]);
35                         exit(2);
36                 }
37         }
38
39         if( dm_init_service( &versionstr ) < 0 )
40                 exit(1);
41
42         ret = dm_create_session( oldsid, sessinfo, &newsid);
43         printf( "ret=%d\n", ret );
44         printf( "newsid=%d\n", newsid );
45         exit(0);
46 }
47