generic/60[78]: ensure the initial DAX file flag state before test
[xfstests-dev.git] / dmapi / src / simple / dm_destroy_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 sid = 0;
21         char *versionstr;
22
23         while( (c = getopt(argc, argv, "hs:")) != -1 ) {
24                 switch(c){
25                 case 's':
26                         sid = atoi( optarg );
27                         break;
28                 case 'h':
29                         fprintf(stderr, "Usage: %s <-s sid>\n", argv[0] );
30                         exit(2);
31                 }
32         }
33
34         if( sid == 0 ){
35                 fprintf(stderr, "%s: must specify -s\n", argv[0] );
36                 exit(1);
37         }
38
39         if( dm_init_service( &versionstr ) < 0 )
40                 exit(1);
41
42         ret = dm_destroy_session( sid );
43         printf( "ret=%d\n", ret );
44         exit(0);
45 }