[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [NBD]Some confusions when i read the nbd codes



On Tue, Aug 9, 2011 at 11:56 AM, harryxiyou <harryxiyou@...17...> wrote:
> Hi all,
>
> NOTE: my nbd source code's version is nbd-2.9.15.tar.bz2.
>
> 1, Why do we handle the
>
Sorry for sending the mail unfinished just now, okay, see following
for the rest.

1, Why do we handle the 'serve->port == 0' in nbd-server.c
particularly? I don't know
the differences for 'port == 0'.
1889         if(serve) {
1890                 serve->socket_family = AF_UNSPEC;
1891
1892                 append_serve(serve, servers);
1893
1894                 if (!(serve->port)) {
1895                         CLIENT *client;
1896 #ifndef ISSERVER
1897                         /* You really should define ISSERVER if
you're going to use
1898                          * inetd mode, but if you don't, closing
stdout and stderr
1899                          * (which inetd had connected to the
client socket) will let it
1900                          * work. */
1901                         close(1);

2, Can you just describe the relationships among nbd.c in kernel as a module
 and nbd-client.c && nbd-server.c in our nbd package ?

3, Okay, now i have a nbd client and a nbd server. I just know nbd client can
get disk space from nbd server but how server can get the exact datas which
entered by user from nbd client?

4, We have three functions in nbd-server.c like following.
rawexpwrite(...)
rawexpwrite_fully(...)
expwrite(...)
I am not sure if these functions write datas to client device or server?
I just see datas in client but server.

5, i have a nbd client and server. Now they have establish the
nbd connections. Client just use /dev/nbd0. And format /dev/nbd0
to ext3 FS. Then i mount it to /mnt/nbd0. I copy /root to /mnt/nbd0.
Now how can i get the /root directory from the nbd server?


Thanks for anyone's feedback
Harry Wei



Reply to: