2
/* This is part of um-ViewOS
3
* The user-mode implementation of OSVIEW -- A Process with a View
5
* v2fuseutils utility functions for fuse
7
* Copyright 2007 Renzo Davoli University of Bologna - Italy
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License along
19
* with this program; if not, write to the Free Software Foundation, Inc.,
20
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30
#include "v2fuseutils.h"
32
void v2f_usage(char *progname,struct fuse_operations *ops)
35
static char *argv[] = {"...", "-h"};
37
"Usage: %s imagefile mountpoint [options]\n"
38
"or at your choice:\n"
39
" %s [options] imagefile mountpoint\n", progname,progname);
40
fprintf(stderr,"valid fuse options follow:\n");
41
#if FUSE_USE_VERSION < 26
42
fuse_main( argc, argv, ops);
44
fuse_main( argc, argv, ops, NULL);
49
void v2f_rearrangeargv(int argc, char *argv[])
51
int i,sourcearg,dasho;
52
for (i=1,dasho=sourcearg=0;i<argc && sourcearg==0;i++) {
53
if (*argv[i] != '-' && !dasho)
55
dasho=(strcmp(argv[i],"-o")==0);
57
if (sourcearg > 1 && sourcearg < argc-1) {
58
char *sourcepath=argv[sourcearg];
59
char *mountpoint=argv[sourcearg+1];
60
for (i=sourcearg; i>1; i--)
67
int v2f_checkrorwplus(int argc, char *argv[])
71
if (strcmp(argv[i],"-o")==0) {
76
//printf("%c %d\n",*s,status);
78
case 0: /* beginning of token */
85
case 1: /* leading r */
96
case 2: /* no match */
133
case 3: result |= FLRO; break;
134
case 4: result |= FLRW; break;
135
case 5: result |= FLRWPLUS; t--;break;
142
int v2f_printwarning(int rorwplus) {
143
if (!rorwplus || (rorwplus & FLRW)) {
144
fprintf(stderr,"This is experimental code, opening rw a real file system could be\n"
145
"dangerous for your data. Please add \"-o ro\" if you want to open the file\n"
146
"system image in read-only mode, or \"-o rw+\" if you accept the risk to test\n"