mirror of
https://github.com/sheumann/NetDisk.git
synced 2024-11-27 19:49:38 +00:00
Add support for ejecting NetDisk volumes.
This commit is contained in:
parent
2670da4f59
commit
ccc9594412
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ HTTPTEST_PROG = httptest
|
|||||||
MOUNTURL_OBJS = mounturl.a
|
MOUNTURL_OBJS = mounturl.a
|
||||||
MOUNTURL_PROG = mounturl
|
MOUNTURL_PROG = mounturl
|
||||||
|
|
||||||
NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a driver.a installdriver.a asmglue.a driverwrapper.a
|
NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a driver.a installdriver.a asmglue.a driverwrapper.a session.a
|
||||||
# NETDISKINIT_RSRC =
|
# NETDISKINIT_RSRC =
|
||||||
NETDISKINIT_PROG = NetDiskInit
|
NETDISKINIT_PROG = NetDiskInit
|
||||||
|
|
||||||
|
16
driver.c
16
driver.c
@ -7,6 +7,7 @@
|
|||||||
#include "seturl.h"
|
#include "seturl.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
#include "readtcp.h"
|
#include "readtcp.h"
|
||||||
|
#include "tcpconnection.h"
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@ -215,11 +216,11 @@ static Word DoMountURL(struct GSOSDP *dp) {
|
|||||||
dp->transferCount = 0;
|
dp->transferCount = 0;
|
||||||
return drvrNoResrc;
|
return drvrNoResrc;
|
||||||
}
|
}
|
||||||
dp->dibPointer->extendedDIBPtr = sess;
|
|
||||||
|
|
||||||
enum SetURLResult setResult = SetURL(sess, (char*)dp->controlListPtr, TRUE, FALSE);
|
enum SetURLResult setResult = SetURL(sess, (char*)dp->controlListPtr, TRUE, FALSE);
|
||||||
if (setResult != SETURL_SUCCESSFUL) {
|
if (setResult != SETURL_SUCCESSFUL) {
|
||||||
// TODO arrange for more detailed error reporting
|
// TODO arrange for more detailed error reporting
|
||||||
|
EndNetDiskSession(sess);
|
||||||
dp->transferCount = 0;
|
dp->transferCount = 0;
|
||||||
return drvrIOError;
|
return drvrIOError;
|
||||||
}
|
}
|
||||||
@ -227,6 +228,7 @@ static Word DoMountURL(struct GSOSDP *dp) {
|
|||||||
enum RequestResult requestResult = DoHTTPRequest(sess, 0, sizeof(sess->fileHeader) - 1);
|
enum RequestResult requestResult = DoHTTPRequest(sess, 0, sizeof(sess->fileHeader) - 1);
|
||||||
if (requestResult != REQUEST_SUCCESSFUL) {
|
if (requestResult != REQUEST_SUCCESSFUL) {
|
||||||
// TODO arrange for more detailed error reporting
|
// TODO arrange for more detailed error reporting
|
||||||
|
EndNetDiskSession(sess);
|
||||||
dp->transferCount = 0;
|
dp->transferCount = 0;
|
||||||
return drvrIOError;
|
return drvrIOError;
|
||||||
}
|
}
|
||||||
@ -239,9 +241,12 @@ static Word DoMountURL(struct GSOSDP *dp) {
|
|||||||
|
|
||||||
Word checkResult = CheckTwoImg(sess);
|
Word checkResult = CheckTwoImg(sess);
|
||||||
if (checkResult != 0) {
|
if (checkResult != 0) {
|
||||||
|
EndNetDiskSession(sess);
|
||||||
// TODO error
|
// TODO error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dp->dibPointer->extendedDIBPtr = sess;
|
||||||
|
|
||||||
//TODO report disk switch
|
//TODO report disk switch
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -299,11 +304,16 @@ static Word DoStatus(struct GSOSDP *dp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Word DoEject(struct GSOSDP *dp) {
|
static Word DoEject(struct GSOSDP *dp) {
|
||||||
//TODO
|
EndNetDiskSession(dp->dibPointer->extendedDIBPtr);
|
||||||
|
dp->dibPointer->extendedDIBPtr = NULL;
|
||||||
|
|
||||||
|
dp->transferCount = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Word DoShutdown(struct GSOSDP *dp) {
|
static Word DoShutdown(struct GSOSDP *dp) {
|
||||||
//TODO
|
EndNetDiskSession(dp->dibPointer->extendedDIBPtr);
|
||||||
|
dp->dibPointer->extendedDIBPtr = NULL;
|
||||||
|
//TODO should return error unless all of our other DIBs are already shut down?
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
12
session.c
Normal file
12
session.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "session.h"
|
||||||
|
#include "tcpconnection.h"
|
||||||
|
|
||||||
|
/* End a session and free associated data. */
|
||||||
|
void EndNetDiskSession(Session *sess) {
|
||||||
|
if (sess != NULL) {
|
||||||
|
EndTCPConnection(sess);
|
||||||
|
free(sess->httpRequest);
|
||||||
|
free(sess);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user