ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-NBD/README
Revision: 1.2
Committed: Tue Mar 8 20:23:56 2005 UTC (19 years, 2 months ago) by root
Branch: MAIN
CVS Tags: rel-0_9
Changes since 1.1: +79 -0 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 NAME
2 Linux::NBD::Client - client (device) side of a network blokc device
3
4 SYNOPSIS
5 use Linux::NBD::Client;
6
7 DESCRIPTION
8 WARNING: I talked to the author of the nbd driver because nbd is so
9 extremely racy (right now, stopping it often causes oopses, a server
10 crashing also often oopses etc..).
11
12 It turned out that he doesn't care at all and nbd is basically
13 unmaintained, so YMMV when using this module, especially when writing
14 servers.
15
16 He really should have said that on his nbd pages ;[.
17
18 OTOH, it works relatively reliable when you don't stop the servers, so
19 watch out and keep your fingers crossed.
20
21 METHODS
22 $client = new Linux::NBD::Client [socket => $fh][, device =>
23 "/dev/ndx"], ...
24 Create a new client.
25
26 Unless "device" is given, an unused device node is looked up using
27 the "device" method (this might result in an exception!).
28
29 The other arguments correspond to calls to methods of the same name.
30
31 $client->socket([$tcp_socket])
32 Returns the current socket after setting a new one (if an argument
33 is supplied). The socket *MUST* be a tcp socket. Believe, bad things
34 will happen.
35
36 The special argument "undef" will try to clear the socket, if any
37 was set.
38
39 $client->device([$new_device])
40 Returns the current device node (e.g. "/dev/nd2") after setting a
41 new one if an argument is supplied.
42
43 If the argument is "undef" it will search for an unallocated
44 nbd-device and use it.
45
46 $client->disconnect
47 Tries to exit the server by ending a special disconnect message.
48
49 $client->clear_queue
50 Clears the request queue, if possible. Should be used before setting
51 a new socket.
52
53 $client->set_blocksize($blksize)
54 Set the device blocksize in bytes (must be >512, <PAGESIZE and a
55 power of two).
56
57 $client->set_size($bytes)
58 Set the device size in bytes.
59
60 $client->set_blocks($nblocks)
61 Set the size in blocks.
62
63 $client->run
64 Enters the service loop (waits for read/write requests on the device
65 and forwards them over the given socket). Only returns when somebody
66 calls "disconnect" or the server is killed.
67
68 $pid = $client->run_async
69 Runs the service loop asynchronously and returns the pid of the
70 newly created service process.
71
72 $client->kill_async
73 Kills any running async service. Please note that this also kills
74 the socket, so you need to re-set the socket after this call.
75
76 AUTHOR
77 Marc Lehmann <schmorp@schmorp.de>
78 http://home.schmorp.de/
79