urlwrapper: add support for nfs: URI scheme
Now that NFSv4 almost works, add support for handling nfs: urls to urlwrapper. Should later be replaced by a better solution but it works for the time being.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <fs_volume.h>
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
@@ -466,6 +467,41 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proto == "nfs") {
|
||||||
|
BString parameter(host);
|
||||||
|
_DecodeUrlString(path);
|
||||||
|
if (url.HasPort())
|
||||||
|
parameter << ":" << port;
|
||||||
|
//XXX: should not always be absolute! FIXME
|
||||||
|
parameter << ":/" << path;
|
||||||
|
BString prettyPath(path);
|
||||||
|
prettyPath.Remove(0, prettyPath.FindLast("/") + 1);
|
||||||
|
if (path == "" || path == "/")
|
||||||
|
prettyPath = "root";
|
||||||
|
prettyPath << " on " << host;
|
||||||
|
prettyPath.Prepend("/");
|
||||||
|
if (mkdir(prettyPath.String(), 0755) < 0) {
|
||||||
|
perror("mkdir");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dev_t volume;
|
||||||
|
uint32 flags = 0;
|
||||||
|
fprintf(stderr, "parms:'%s'\n", parameter.String());
|
||||||
|
volume = fs_mount_volume(prettyPath.String(), NULL, "nfs4", flags,
|
||||||
|
parameter.String());
|
||||||
|
if (volume < B_OK) {
|
||||||
|
fprintf(stderr, "fs_mount_volume: %s\n", strerror(volume));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BMessage m(B_REFS_RECEIVED);
|
||||||
|
entry_ref ref;
|
||||||
|
if (get_ref_for_path(prettyPath.String(), &ref) < B_OK)
|
||||||
|
return;
|
||||||
|
m.AddRef("refs", &ref);
|
||||||
|
be_roster->Launch(kTrackerSig, &m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ resource(1, "BEOS:FILE_TYPES") message
|
|||||||
"types" = "application/x-vnd.Be.URL.icq",
|
"types" = "application/x-vnd.Be.URL.icq",
|
||||||
"types" = "application/x-vnd.Be.URL.msn",
|
"types" = "application/x-vnd.Be.URL.msn",
|
||||||
"types" = "application/x-vnd.Be.URL.mms",
|
"types" = "application/x-vnd.Be.URL.mms",
|
||||||
|
"types" = "application/x-vnd.Be.URL.nfs",
|
||||||
"types" = "application/x-vnd.Be.URL.rtp",
|
"types" = "application/x-vnd.Be.URL.rtp",
|
||||||
"types" = "application/x-vnd.Be.URL.rtsp",
|
"types" = "application/x-vnd.Be.URL.rtsp",
|
||||||
// "types" = "application/x-vnd.Be.URL.audio",
|
// "types" = "application/x-vnd.Be.URL.audio",
|
||||||
|
|||||||
Reference in New Issue
Block a user