Digg this topic Add to my del.icio.us Submit to SlashDot 3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
> Need help creating custom virtual disk driver, Unused HDD space on multiple machines, presented as one drive
darkwhisperer
post Sep 10 2007, 06:30 AM
Post #11


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Excellent!

Now all I got to do is create a fake FAT file system to go between my backend and your frontend. No point in giving the users an unformatted drive...

By the way, I was playing with ImDisk over the weekend, and I managed to create a drive with your proxy-tester application. However, I couldnt format it with FAT, only NTFS. Any ideas why, or did I probably just do something wrong?

Thanks...
Go to the top of the page
 
+Quote Post
Olof Lagerkvist
post Sep 10 2007, 07:43 PM
Post #12


Advanced Member
***

Group: Developer
Posts: 120
Joined: 27-April 07
From: Borås, Sweden
Member No.: 6,234


Sweden


QUOTE (darkwhisperer @ Sep 10 2007, 08:30 AM) *
By the way, I was playing with ImDisk over the weekend, and I managed to create a drive with your proxy-tester application. However, I couldnt format it with FAT, only NTFS. Any ideas why, or did I probably just do something wrong?

You have to explain exactly what you did, otherwise I don't know...

Example:
CODE
fsutil file createnew imagefile 0
devio 9000 imagefile 400M
imdisk -a -t proxy -o ip -f localhost:9000 -m T:
Go to the top of the page
 
+Quote Post
darkwhisperer
post Sep 11 2007, 01:52 PM
Post #13


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Dont worry about the FAT/NTFS thing, I've forgotten what commands I was using...

My latest problem is with 'My Computer' hanging upon initialization of the drive.

I setup my proxy to listen. Then I execute:
imdisk -a -t proxy -o ip -f 127.0.0.1:4567 -m W:

At that point my listener receives the drive info request, and I send back 4194304, 512, 0. BTW, what are the flags that I can use for this last value?

The Prompt says:
Created device 0: W: -> 127.0.0.1:4567.

So that seems to be fine. But when I go to 'My Computer', the window just hangs. Then when I shut down my proxy, 'My Computer' returns to normal, with a W: there as expected. When I try to do something with that drive, it says "The Device is not ready".

Im looking out for read/write/other type requests, but none are coming through when 'My Computer' stalls. Im wondering if theres some flag Im supposed to send back. Or do you think its something else?

Thanks...
Go to the top of the page
 
+Quote Post
darkwhisperer
post Sep 13 2007, 08:13 AM
Post #14


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Hi,

I've managed to solve the "hang" problem, by changing the way my application handles the socket connection.

Now there seems to be be something wrong with my "write" function, according to windows at least.

I start up my proxy. This loads into my byte[] "drive" a previously created empty FAT image(.img file). And so my proxy is up & listening.

Then I execute: "imdisk -a -t proxy -o ip -f 127.0.0.1:4567 -m M:", and the response is "Created device 1: M: -> 127.0.0.1:4567". So all is well so far.

Some read requests come through, and they are handled. I can browse into the drive. Then I take a tiny file and paste it into the drive. Some write requests come through, and the file appears, and I can read it. But after about 5 seconds, a popup appears, as shown in the attachment. It is strange, because the write seemed to have worked fine. I can read the data perfectly. So Im guessing Im not sending something back to the driver to say, "write complete". Any ideas what could be causing this?

Thanks...
Attached thumbnail(s)
Attached Image
 
Go to the top of the page
 
+Quote Post
Olof Lagerkvist
post Sep 13 2007, 10:16 AM
Post #15


Advanced Member
***

Group: Developer
Posts: 120
Joined: 27-April 07
From: Borås, Sweden
Member No.: 6,234


Sweden


QUOTE (darkwhisperer @ Sep 13 2007, 10:13 AM) *
Some write requests come through, and the file appears, and I can read it. But after about 5 seconds, a popup appears, as shown in the attachment. It is strange, because the write seemed to have worked fine. I can read the data perfectly. So Im guessing Im not sending something back to the driver to say, "write complete". Any ideas what could be causing this?

I think you mistakenly make the assumption that the write operation has been sucessful just because you can read the file back again. But filesystems do not work that way, everything goes through a filesystem cache and that is probably where your file is and where it is been read back from, not from the actual disk image your proxy handles. You can check that by dismounting and remounting the image and see if the file is still there.

There must be something wrong with how you handle write requests though. You are supposed to send back an IMDPROXY_WRITE_RESP structure that contains first an error code which you should set to zero and then a field that indicates the length successfully written. You should set that field to the number of bytes you have written, that is, the number of byte you were asked to write.
Go to the top of the page
 
+Quote Post
darkwhisperer
post Sep 13 2007, 10:39 AM
Post #16


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Hi,

Well, Im pretty sure that Im sending back what you're asking me to.

An example of a write:
Val: 0003 | 8000 | 0e00 W R : Sent: 0000 | 0e00 | Write from 32768 to 36352 (3584 bytes).

The 3 Val values are what I get(in hex). "W R" implies write request. The two "Sent" values are what I send back. And then a general description.
So it seems right to me.

Question though, when Im sending data back, should I first send a 0 back, then send the bytes written? Or can I just join the 2 into a 16 byte [] and send it off(current method)? Does it make a difference which I use?

Also, does the driver send data in bursts if it cant send it in one go?
Go to the top of the page
 
+Quote Post
Olof Lagerkvist
post Sep 13 2007, 10:57 AM
Post #17


Advanced Member
***

Group: Developer
Posts: 120
Joined: 27-April 07
From: Borås, Sweden
Member No.: 6,234


Sweden


QUOTE (darkwhisperer @ Sep 13 2007, 12:39 PM) *
Hi,

Well, Im pretty sure that Im sending back what you're asking me to.

An example of a write:
Val: 0003 | 8000 | 0e00 W R : Sent: 0000 | 0e00 | Write from 32768 to 36352 (3584 bytes).

The 3 Val values are what I get(in hex). "W R" implies write request. The two "Sent" values are what I send back. And then a general description.
So it seems right to me.

Yes, indeed that looks correct...
QUOTE (darkwhisperer @ Sep 13 2007, 12:39 PM) *
Question though, when Im sending data back, should I first send a 0 back, then send the bytes written? Or can I just join the 2 into a 16 byte [] and send it off(current method)? Does it make a difference which I use?

That does not matter. If you send 16 bytes the first 8 bytes should be zero and the last 16 bytes should form an ulonglong with the number of bytes written. In your example:

{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

QUOTE (darkwhisperer @ Sep 13 2007, 12:39 PM) *
Also, does the driver send data in bursts if it cant send it in one go?

There is no such concept in TCP/IP. TCP connections are streams and there are no "message boundaries" or something like that. If a writer writes first 1000 bytes and then 1000 more bytes the receiver may get all 2000 bytes at once, or 500 bytes first and then 1500 bytes or anything like that.
Go to the top of the page
 
+Quote Post
darkwhisperer
post Sep 13 2007, 11:30 AM
Post #18


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Shew...

So if Im listening for data in an endless while loop once the connection is created, then the logic I should use is something like this:

Once data becomes available, read first 24 bytes. If it can be broken down into a message, then its a request. If it cant, then it must be data belonging to a previous request.

Im wondering because previously when I tried copying a 400Kb file to my proxy, it did a write request for 65kb, and then sent through about 8 nonsensical requests. So Im guessing that was still data belonging to the previous write request.

My understanding was that the data comes through when its all arrived. But if you say that it comes through in bits and pieces, that makes things more tricky.

Well, Im gonna keep trying to get this thing working.

Thanks for all your help (IMG:http://www.boot-land.net/forums/style_emoticons/default/smile.gif)
Go to the top of the page
 
+Quote Post
Olof Lagerkvist
post Sep 13 2007, 01:17 PM
Post #19


Advanced Member
***

Group: Developer
Posts: 120
Joined: 27-April 07
From: Borås, Sweden
Member No.: 6,234


Sweden


QUOTE (darkwhisperer @ Sep 13 2007, 01:30 PM) *
So if Im listening for data in an endless while loop once the connection is created, then the logic I should use is something like this:

Once data becomes available, read first 24 bytes. If it can be broken down into a message, then its a request. If it cant, then it must be data belonging to a previous request.

I would not recommend exactly that though, you should rather check what the initial message header tells you. It includes information about how many bytes you are supposed to write and then it sends that number of bytes to you. You have to treat all further data up to that number of bytes as the data you should write.
QUOTE (darkwhisperer @ Sep 13 2007, 01:30 PM) *

No problem! (IMG:http://www.boot-land.net/forums/style_emoticons/default/smile.gif)
Go to the top of the page
 
+Quote Post
darkwhisperer
post Sep 14 2007, 12:31 PM
Post #20


Member
**

Group: Members
Posts: 11
Joined: 6-September 07
Member No.: 10,476


South Africa


Hi,

I've finally got the drive working properly. (IMG:http://www.boot-land.net/forums/style_emoticons/default/crazy.gif) I recoded from scratch both the listening and data send/receive functions. I think something was going wrong when I was trying to combine my ulongs into a byte [] and sending that. Now I just send the data that I want to send through, straight from the variable, and it seems to have solved the problem (IMG:http://www.boot-land.net/forums/style_emoticons/default/smile.gif)

Now onto the tougher part of simulating the FAT, so that I can determine the DATA read&writes from the FileSystem read&writes. So its onto learning the FAT/FAT32 spec for me. (IMG:http://www.boot-land.net/forums/style_emoticons/default/geek.gif)

Once more, thanks for your help, and even more thanks for a great application! (IMG:http://www.boot-land.net/forums/style_emoticons/default/worship.gif) (IMG:http://www.boot-land.net/forums/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+Quote Post
« Next Oldest · ImDisk · Next Newest »
 

3 Pages V  < 1 2 3 >
Fast ReplyReply to this topicStart new topic

Members Who Viewed Topic Today ()

 

Display Mode: Standard · Switch to: Linear+ · Switch to: Outline

Track this topic · Email this topic · Print this topic · Subscribe to this forum

RSS Lo-Fi Version Time is now: 27th February 2008 - 05:21 PM

MKPortal ©2003-2006 mkportal.it