Compare commits
6 Commits
debian/0.1
...
0.1.3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
218c55fb63 | ||
![]() |
956a602475 | ||
![]() |
26a0a82f9d | ||
![]() |
76e0476113 | ||
![]() |
e3360a3a1b | ||
![]() |
1fefe1a669 |
2743
debian/changelog
vendored
2743
debian/changelog
vendored
File diff suppressed because it is too large
Load Diff
1
debian/compat
vendored
1
debian/compat
vendored
@@ -1 +0,0 @@
|
|||||||
7
|
|
26
debian/control
vendored
26
debian/control
vendored
@@ -1,26 +0,0 @@
|
|||||||
Source: flexnbd
|
|
||||||
Section: web
|
|
||||||
Priority: extra
|
|
||||||
Maintainer: Patrick J Cherry <patrick@bytemark.co.uk>
|
|
||||||
Build-Depends: debhelper (>= 7.0.50), ruby, rake, gcc, libev-dev,
|
|
||||||
asciidoc, libxml2-utils, xsltproc, xmlto, check
|
|
||||||
Standards-Version: 3.8.1
|
|
||||||
Homepage: https://github.com/BytemarkHosting/flexnbd-c
|
|
||||||
|
|
||||||
Package: flexnbd
|
|
||||||
Architecture: any
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libev4 | libev3
|
|
||||||
Description: FlexNBD server
|
|
||||||
An NBD server offering push-mirroring and intelligent sparse file handling
|
|
||||||
|
|
||||||
Package: flexnbd-dbg
|
|
||||||
Architecture: any
|
|
||||||
Section: debug
|
|
||||||
Priority: extra
|
|
||||||
Depends:
|
|
||||||
flexnbd (= ${binary:Version}),
|
|
||||||
${misc:Depends}
|
|
||||||
Description: debugging symbols for flexnbd
|
|
||||||
An NBD server offering push-mirroring and intelligent sparse file handling
|
|
||||||
.
|
|
||||||
This package contains the debugging symbols for flexnbd.
|
|
53
debian/copyright
vendored
53
debian/copyright
vendored
@@ -1,53 +0,0 @@
|
|||||||
This work was packaged for Debian by:
|
|
||||||
|
|
||||||
Alex Young <alex@bytemark.co.uk> on Wed, 30 May 2012 16:46:58 +0100
|
|
||||||
|
|
||||||
It was downloaded from:
|
|
||||||
|
|
||||||
<url://example.com>
|
|
||||||
|
|
||||||
Upstream Author(s):
|
|
||||||
|
|
||||||
<put author's name and email here>
|
|
||||||
<likewise for another author>
|
|
||||||
|
|
||||||
Copyright:
|
|
||||||
|
|
||||||
<Copyright (C) YYYY Firstname Lastname>
|
|
||||||
<likewise for another author>
|
|
||||||
|
|
||||||
License:
|
|
||||||
|
|
||||||
### SELECT: ###
|
|
||||||
This package is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
### OR ###
|
|
||||||
This package is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License version 2 as
|
|
||||||
published by the Free Software Foundation.
|
|
||||||
##########
|
|
||||||
|
|
||||||
This package is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
|
|
||||||
On Debian systems, the complete text of the GNU General
|
|
||||||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
|
||||||
|
|
||||||
The Debian packaging is:
|
|
||||||
|
|
||||||
Copyright (C) 2012 Alex Young <alex@bytemark.co.uk>
|
|
||||||
|
|
||||||
you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
# Please also look if there are files or directories which have a
|
|
||||||
# different copyright/license attached and list them here.
|
|
5
debian/flexnbd.install
vendored
5
debian/flexnbd.install
vendored
@@ -1,5 +0,0 @@
|
|||||||
build/flexnbd usr/bin
|
|
||||||
build/flexnbd-proxy usr/bin
|
|
||||||
build/flexnbd.1.gz usr/share/man/man1
|
|
||||||
build/flexnbd-proxy.1.gz usr/share/man/man1
|
|
||||||
|
|
19
debian/rules
vendored
19
debian/rules
vendored
@@ -1,19 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
# -*- makefile -*-
|
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
|
||||||
#export DH_VERBOSE=1
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@
|
|
||||||
|
|
||||||
override_dh_strip:
|
|
||||||
dh_strip --dbg-package=flexnbd-dbg
|
|
||||||
|
|
||||||
#
|
|
||||||
# TODO: The ruby test suites don't work during buiding in a chroot, so leave
|
|
||||||
# them out for now.
|
|
||||||
#
|
|
||||||
#override_dh_auto_test:
|
|
||||||
# rake test:run
|
|
||||||
|
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
@@ -27,7 +27,7 @@ void nbd_r2h_request( struct nbd_request_raw *from, struct nbd_request * to )
|
|||||||
{
|
{
|
||||||
to->magic = htobe32( from->magic );
|
to->magic = htobe32( from->magic );
|
||||||
to->type = htobe32( from->type );
|
to->type = htobe32( from->type );
|
||||||
memcpy( to->handle, from->handle, 8 );
|
to->handle.w = from->handle.w;
|
||||||
to->from = htobe64( from->from );
|
to->from = htobe64( from->from );
|
||||||
to->len = htobe32( from->len );
|
to->len = htobe32( from->len );
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ void nbd_h2r_request( struct nbd_request * from, struct nbd_request_raw * to )
|
|||||||
{
|
{
|
||||||
to->magic = be32toh( from->magic );
|
to->magic = be32toh( from->magic );
|
||||||
to->type = be32toh( from->type );
|
to->type = be32toh( from->type );
|
||||||
memcpy( to->handle, from->handle, 8 );
|
to->handle.w = from->handle.w;
|
||||||
to->from = be64toh( from->from );
|
to->from = be64toh( from->from );
|
||||||
to->len = be32toh( from->len );
|
to->len = be32toh( from->len );
|
||||||
}
|
}
|
||||||
@@ -46,13 +46,13 @@ void nbd_r2h_reply( struct nbd_reply_raw * from, struct nbd_reply * to )
|
|||||||
{
|
{
|
||||||
to->magic = htobe32( from->magic );
|
to->magic = htobe32( from->magic );
|
||||||
to->error = htobe32( from->error );
|
to->error = htobe32( from->error );
|
||||||
memcpy( to->handle, from->handle, 8 );
|
to->handle.w = from->handle.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nbd_h2r_reply( struct nbd_reply * from, struct nbd_reply_raw * to )
|
void nbd_h2r_reply( struct nbd_reply * from, struct nbd_reply_raw * to )
|
||||||
{
|
{
|
||||||
to->magic = be32toh( from->magic );
|
to->magic = be32toh( from->magic );
|
||||||
to->error = be32toh( from->error );
|
to->error = be32toh( from->error );
|
||||||
memcpy( to->handle, from->handle, 8 );
|
to->handle.w = from->handle.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,11 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
typedef union nbd_handle_t {
|
||||||
|
uint8_t b[8];
|
||||||
|
uint64_t w;
|
||||||
|
} nbd_handle_t;
|
||||||
|
|
||||||
/* The _raw types are the types as they appear on the wire. Non-_raw
|
/* The _raw types are the types as they appear on the wire. Non-_raw
|
||||||
* types are in host-format.
|
* types are in host-format.
|
||||||
* Conversion functions are _r2h_ for converting raw to host, and _h2r_
|
* Conversion functions are _r2h_ for converting raw to host, and _h2r_
|
||||||
@@ -39,7 +44,7 @@ struct nbd_init_raw {
|
|||||||
struct nbd_request_raw {
|
struct nbd_request_raw {
|
||||||
__be32 magic;
|
__be32 magic;
|
||||||
__be32 type; /* == READ || == WRITE */
|
__be32 type; /* == READ || == WRITE */
|
||||||
char handle[8];
|
nbd_handle_t handle;
|
||||||
__be64 from;
|
__be64 from;
|
||||||
__be32 len;
|
__be32 len;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
@@ -47,7 +52,7 @@ struct nbd_request_raw {
|
|||||||
struct nbd_reply_raw {
|
struct nbd_reply_raw {
|
||||||
__be32 magic;
|
__be32 magic;
|
||||||
__be32 error; /* 0 = ok, else error */
|
__be32 error; /* 0 = ok, else error */
|
||||||
char handle[8]; /* handle you got from request */
|
nbd_handle_t handle; /* handle you got from request */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +67,7 @@ struct nbd_init {
|
|||||||
struct nbd_request {
|
struct nbd_request {
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
uint32_t type; /* == READ || == WRITE || == DISCONNECT */
|
uint32_t type; /* == READ || == WRITE || == DISCONNECT */
|
||||||
char handle[8];
|
nbd_handle_t handle;
|
||||||
uint64_t from;
|
uint64_t from;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
@@ -70,7 +75,7 @@ struct nbd_request {
|
|||||||
struct nbd_reply {
|
struct nbd_reply {
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
uint32_t error; /* 0 = ok, else error */
|
uint32_t error; /* 0 = ok, else error */
|
||||||
char handle[8]; /* handle you got from request */
|
nbd_handle_t handle; /* handle you got from request */
|
||||||
};
|
};
|
||||||
|
|
||||||
void nbd_r2h_init( struct nbd_init_raw * from, struct nbd_init * to );
|
void nbd_r2h_init( struct nbd_init_raw * from, struct nbd_init * to );
|
||||||
|
@@ -105,9 +105,7 @@ void fill_request(struct nbd_request *request, int type, uint64_t from, uint32_t
|
|||||||
{
|
{
|
||||||
request->magic = htobe32(REQUEST_MAGIC);
|
request->magic = htobe32(REQUEST_MAGIC);
|
||||||
request->type = htobe32(type);
|
request->type = htobe32(type);
|
||||||
uint32_t * randa = (uint32_t*)request->handle;
|
request->handle.w = (((uint64_t)rand()) << 32) | ((uint64_t)rand());
|
||||||
randa[0] = rand();
|
|
||||||
randa[1] = rand();
|
|
||||||
request->from = htobe64(from);
|
request->from = htobe64(from);
|
||||||
request->len = htobe32(len);
|
request->len = htobe32(len);
|
||||||
}
|
}
|
||||||
@@ -127,7 +125,7 @@ void read_reply(int fd, struct nbd_request *request, struct nbd_reply *reply)
|
|||||||
if (reply->error != 0) {
|
if (reply->error != 0) {
|
||||||
error("Server replied with error %d", reply->error);
|
error("Server replied with error %d", reply->error);
|
||||||
}
|
}
|
||||||
if (strncmp(request->handle, reply->handle, 8) != 0) {
|
if (request->handle.w != reply->handle.w) {
|
||||||
error("Did not reply with correct handle");
|
error("Did not reply with correct handle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ int sock_try_bind( int fd, const struct sockaddr* sa )
|
|||||||
{
|
{
|
||||||
int bind_result;
|
int bind_result;
|
||||||
char s_address[256];
|
char s_address[256];
|
||||||
int retry = 1;
|
int retry = 10;
|
||||||
|
|
||||||
sockaddr_address_string( sa, &s_address[0], 256 );
|
sockaddr_address_string( sa, &s_address[0], 256 );
|
||||||
|
|
||||||
@@ -126,8 +126,11 @@ int sock_try_bind( int fd, const struct sockaddr* sa )
|
|||||||
* will cope with it.
|
* will cope with it.
|
||||||
*/
|
*/
|
||||||
case EADDRNOTAVAIL:
|
case EADDRNOTAVAIL:
|
||||||
|
retry--;
|
||||||
|
if (retry) {
|
||||||
debug( "retrying" );
|
debug( "retrying" );
|
||||||
sleep( 1 );
|
sleep( 1 );
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
case EADDRINUSE:
|
case EADDRINUSE:
|
||||||
warn( "%s in use, giving up.", s_address );
|
warn( "%s in use, giving up.", s_address );
|
||||||
|
@@ -709,7 +709,7 @@ void proxy_session( struct proxier* proxy )
|
|||||||
state_started = monotonic_time_ms();
|
state_started = monotonic_time_ms();
|
||||||
|
|
||||||
debug(
|
debug(
|
||||||
"State transitition from %s to %s",
|
"State transition from %s to %s",
|
||||||
proxy_session_state_names[old_state],
|
proxy_session_state_names[old_state],
|
||||||
proxy_session_state_names[state]
|
proxy_session_state_names[state]
|
||||||
);
|
);
|
||||||
|
@@ -252,14 +252,14 @@ int client_read_request( struct client * client , struct nbd_request *out_reques
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd_write_reply( int fd, char *handle, int error )
|
int fd_write_reply( int fd, uint64_t handle, int error )
|
||||||
{
|
{
|
||||||
struct nbd_reply reply;
|
struct nbd_reply reply;
|
||||||
struct nbd_reply_raw reply_raw;
|
struct nbd_reply_raw reply_raw;
|
||||||
|
|
||||||
reply.magic = REPLY_MAGIC;
|
reply.magic = REPLY_MAGIC;
|
||||||
reply.error = error;
|
reply.error = error;
|
||||||
memcpy( reply.handle, handle, 8 );
|
reply.handle.w = handle;
|
||||||
|
|
||||||
nbd_h2r_reply( &reply, &reply_raw );
|
nbd_h2r_reply( &reply, &reply_raw );
|
||||||
debug( "Replying with handle=0x%08X, error=%"PRIu32, handle, error );
|
debug( "Replying with handle=0x%08X, error=%"PRIu32, handle, error );
|
||||||
@@ -291,7 +291,7 @@ int fd_write_reply( int fd, char *handle, int error )
|
|||||||
*/
|
*/
|
||||||
int client_write_reply( struct client * client, struct nbd_request *request, int error )
|
int client_write_reply( struct client * client, struct nbd_request *request, int error )
|
||||||
{
|
{
|
||||||
return fd_write_reply( client->socket, request->handle, error);
|
return fd_write_reply( client->socket, request->handle.w, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -412,7 +412,7 @@ int mirror_setup_next_xfer( struct mirror_ctrl *ctrl )
|
|||||||
struct nbd_request req = {
|
struct nbd_request req = {
|
||||||
.magic = REQUEST_MAGIC,
|
.magic = REQUEST_MAGIC,
|
||||||
.type = REQUEST_WRITE,
|
.type = REQUEST_WRITE,
|
||||||
.handle = ".MIRROR.",
|
.handle.b = ".MIRROR.",
|
||||||
.from = current,
|
.from = current,
|
||||||
.len = run
|
.len = run
|
||||||
};
|
};
|
||||||
@@ -568,7 +568,7 @@ static void mirror_read_cb( struct ev_loop *loop, ev_io *w, int revents )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( memcmp( ".MIRROR.", &rsp.handle[0], 8 ) != 0 ) {
|
if ( memcmp( ".MIRROR.", rsp.handle.b, 8 ) != 0 ) {
|
||||||
warn( "Bad handle returned from listener" );
|
warn( "Bad handle returned from listener" );
|
||||||
ev_break( loop, EVBREAK_ONE );
|
ev_break( loop, EVBREAK_ONE );
|
||||||
return;
|
return;
|
||||||
@@ -922,7 +922,7 @@ void* mirror_runner(void* serve_params_uncast)
|
|||||||
* for us ). But if we've failed and are going to retry on the next run, we
|
* for us ). But if we've failed and are going to retry on the next run, we
|
||||||
* must close this socket here to have any chance of it succeeding.
|
* must close this socket here to have any chance of it succeeding.
|
||||||
*/
|
*/
|
||||||
if ( !mirror->client < 0 ) {
|
if ( !(mirror->client < 0) ) {
|
||||||
sock_try_close( mirror->client );
|
sock_try_close( mirror->client );
|
||||||
mirror->client = -1;
|
mirror->client = -1;
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ void * responder( void *respond_uncast )
|
|||||||
fd_write_reply( sock_fd, wrong_handle, 0 );
|
fd_write_reply( sock_fd, wrong_handle, 0 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fd_write_reply( sock_fd, resp->received.handle, 0 );
|
fd_write_reply( sock_fd, (char*)resp->received.handle.b, 0 );
|
||||||
}
|
}
|
||||||
write( sock_fd, "12345678", 8 );
|
write( sock_fd, "12345678", 8 );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user