My favorites
▼
|
Sign in
fscops
OHSM - Online Hierarchical Storage Manager
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
37
attachment: getopt.c
(5.7 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#define _GNU_SOURCE
#include <getopt.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "ohsm_user.h"
#define SET 1
#define UNSET 0
struct ohsm_allocation_policy *xml_alloc_file=NULL;
struct ohsm_tier_device_count *xml_dev_file =NULL;
struct ohsm_relocation_policy *xml_reloc_file=NULL;
int main(int argc,char *argv[])
{
int opt;
int i,retval,count;
char argn[60];
// unsigned char FLAG_CR = UNSET;
unsigned char FLAG_LVU = UNSET; /*SHOW THE EXISTING LOGICAL VOLUME AND UNDERLYING DEVICES*/
unsigned char FLAG_LVC = UNSET; /*CREATE LOGICAL VOLUME WITH DEVICES NAMES AS PARAMETER*/
unsigned char FLAG_TI = UNSET; /*GIVES TIER INFORMATION*/
unsigned char FLAG_TD = UNSET; /*SETS TIER DEVICE INFORMATION*/
unsigned char FLAG_AP = UNSET; /*SETS ALLOCATION POLICY*/
unsigned char FLAG_RP = UNSET; /*SETS RELOCATION POLICY*/
unsigned char FLAG_E = UNSET; /*OHSM ENABLED*/
unsigned char FLAG_D = UNSET; /*OHSM DISABLED*/
unsigned char FLAG_CP = UNSET; /*SHOW CURRENT POLICY BOTH ALLOC & RELLOC*/
unsigned char FLAG_RT = UNSET; /*REASSIGN ALLOC POLICY*/
unsigned char FLAG_RR = UNSET; /*REASSIGN RELOC POLICY*/
unsigned char FLAG_RD = UNSET; /*REASSIGN TIER DEVICE INFORMATION*/
struct option longopts[] = {
// {"create",1,NULL,'b'},
{"existnglvm",1,NULL, 'u'},
{"createlvm",1,NULL, 'l'},
{"tierinfo", 10,NULL , 't'},
{"tierdeviceinfo", 1, NULL, 'i'},
{"currpoly", 1, NULL, 'c'},
{"allocpoly", 1, NULL, 'a'},
{"relocpoly", 1, NULL, 'r'},
{"enabled", 1, NULL, 'e'},
{"disabled", 1, NULL, 'd'},
{"reassgnpoly", 1, NULL, 'x'},
{"reassgnreloc", 1, NULL, 'y'},
{"retierdevinfo",1,NULL,'z'},
{0,0,0,0}
};
while((opt=getopt_long(argc, argv, ":u:l:t:i:c:a:r:e:d:x:y:z", longopts, NULL)) != -1)
{
switch(opt) {
case 'u':
printf("option %c\n",opt);
printf("\nThis ioctl gives the information about the logical volume and devices beneath");
printf("\nArguments are %s \n",optarg);
FLAG_LVU = SET;
break;
case 'l':
printf("option %c\n",opt);
printf("\nThis ioctl gives the information about the logical volume and devices beneath");
printf("\nArguments are %s \n",optarg);
FLAG_LVC = SET;
break;
case 't':
printf("option %c\n", opt);
FLAG_TI = SET;
printf ("This gives tier information");
printf ("\nArguments are %s \n", optarg);
break;
case 'i':
printf ("option %c\n", opt);
FLAG_TD = SET;
printf ("This sets tier device information");
printf ("\nArgument are %s\n", optarg);
break;
case ':':
printf ("Argumnet Missing");
break;
case 'c':
printf ("option %c\n", opt);
FLAG_CP = SET;
printf ("Argument are %s\n", optarg);
printf ("\nThis gives the current policy enforced");
break;
case 'a':
printf ("option %c\n", opt);
FLAG_AP = SET;
printf ("Argument are %s\n", optarg);
printf ("\nThis sets the allocation policy");
break;
case 'r':
printf ("option %c\n", opt);
FLAG_RP = SET;
printf ("Argument is %s\n", optarg);
printf ("\nThis sets the relocation policy");
break;
case 'e':
printf ("option %c\n", opt);
FLAG_E = SET;
printf ("This will enable the OHSM");
printf ("\nArgument is %s\n", optarg);
break;
case 'd':
printf ("option %c\n", opt);
FLAG_D = SET;
printf ("This gives disable the OHSM");
printf ("\nArgument is %s\n", optarg);
break;
case '?':
printf ("No such options declared %c", optopt);
break;
case 'x':
printf ("option %c\n", opt);
FLAG_RT = SET;
printf ("This will reassign the allocation policy");
printf ("\nArgument is %s\n", optarg);
break;
case 'y':
printf ("option %c\n", opt);
FLAG_RR = SET;
printf ("Argument is %s\n", optarg);
printf ("\nThis will reassign the realloc policy");
break;
case 'z':
printf ("option %c\n", opt);
FLAG_RD = SET;
printf ("Argument is %s\n", optarg);
printf ("\nThis will reassign tier device information");
break;
}
}
if(FLAG_E == SET){
//Call the ioctl
}
if(FLAG_LVU == SET){
//call the ioctl
}
if(FLAG_LVC == SET){
count=argc - 2;
if(count == 1){
system("./fs_lvm argv[2]");
}
else{
for(i=3;i<=argc;i++){
strcat(argn,argv[i]);
}
printf("%s",argn);
system("./fs_lvm argn");
}
}
if(FLAG_D == SET){
//call the ioctl
}
/* if(FLAG_TD == SET){
//Call the ioctl
xml_dev_file= (struct ohsm_tier_device_count*) ohsm_get_tier_device_info(argv[2]);
if(xml_dev_file==NULL)
{
printf("\nError in parsing the device file");
return -1;
}
retval=ioctl(); //fill your ioctl over here??
if(retval < 0){
printf("\n ioctl failed %d",retval);
return retval;
}
//remember to unset
}
if(FLAG_AP == SET){
//Call the ioctl
xml_alloc_file= (struct ohsm_allocation_policy*) ohsm_get_allocation_policy(argv[2]);
if(xml_alloc_file==NULL)
{
printf("\nError in parsing the allocation file");
return -1;
}
retval=ioctl(); //fill your ioctl over here??
if(retval < 0){
printf("\n ioctl failed %d",retval);
return -1;
}
//remember to unset
} */
/* if(FLAG_RP == SET){
//Call the ioctl
xml_reloc_file= (struct ohsm_relocation_policy *) ohsm_get_relocation_policy(argv[2]);
if(xml_reloc_file==NULL)
{
printf("\nError in parsing the xml alloc file");
return -1;
}
retval=ioctl(); //fill your ioctl over here??
if (retval < 0){
printf("\nioctl failed %d",retval);
return -1;
}
//remember to unset
}*/
if(FLAG_CP == SET){
//call the ioctl
}
if(FLAG_RT == SET){
//call the ioctl
//remember to unset
}
if(FLAG_RR == SET){
//call the ioctl
//remember to unset
}
if(FLAG_RD == SET){
}
exit (0);
}
Powered by
Google Project Hosting