10 #include <minix/syslib.h>
12 #include <minix/paths.h>
16 #define MFSPATH "/sbin/"
18 PRIVATE
int rs_down(char *label
)
22 if(strlen(_PATH_SERVICE
)+strlen(label
)+50 >= sizeof(cmd
))
24 sprintf(cmd
, _PATH_SERVICE
" down %s", label
);
28 PRIVATE
char *makelabel(_CONST
char *special
)
30 static char label
[40];
33 /* Make label name. */
34 dev
= strrchr(special
, '/');
37 if(strlen(dev
)+strlen(MFSNAME
)+3 >= sizeof(label
))
39 sprintf(label
, MFSNAME
"_%s", dev
);
43 PUBLIC
int mount(special
, name
, rwflag
)
49 struct rs_start rs_start
;
55 /* Make MFS process label for RS from special name. */
56 if(!(label
=makelabel(special
))) {
61 if(strlen(_PATH_SERVICE
)+strlen(MFSPATH
)+strlen(MFSNAME
)+
62 strlen(label
)+50 >= sizeof(cmd
)) {
67 sprintf(cmd
, _PATH_SERVICE
" up " MFSPATH MFSNAME
68 " -label \"%s\" -config " _PATH_DRIVERS_CONF
" -printep yes",
71 if(!(pipe
= popen(cmd
, "r"))) {
72 fprintf(stderr
, "mount: couldn't run %s\n", cmd
);
75 if(fscanf(pipe
, "%d", &ep
) != 1 || ep
<= 0) {
76 fprintf(stderr
, "mount: couldn't parse endpoint from %s\n", cmd
);
83 /* Now perform mount(). */
84 m
.m1_i1
= strlen(special
) + 1;
85 m
.m1_i2
= strlen(name
) + 1;
90 r
= _syscall(FS
, MOUNT
, &m
);
93 /* If mount() failed, tell RS to shutdown MFS process.
94 * No error check - won't do anything with this error anyway.
102 PUBLIC
int umount(name
)
109 /* Make MFS process label for RS from special name. */
110 if(!(label
=makelabel(name
))) {
116 r
= _syscall(FS
, UMOUNT
, &m
);