kvm: Conditionally apply workaround for KVM slot handling bug
[qemu] / qemu-nbd.c
index 916150e..0af97ca 100644 (file)
@@ -14,7 +14,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
  */
 
 #include <qemu-common.h>
@@ -36,7 +36,7 @@
 
 #define NBD_BUFFER_SIZE (1024*1024)
 
-int verbose;
+static int verbose;
 
 static void usage(const char *name)
 {
@@ -190,7 +190,7 @@ int main(int argc, char **argv)
     char *device = NULL;
     char *socket = NULL;
     char sockpath[128];
-    const char *sopt = "hVbo:p:rsnP:c:dvk:e:t";
+    const char *sopt = "hVb:o:p:rsnP:c:dvk:e:t";
     struct option lopt[] = {
         { "help", 0, 0, 'h' },
         { "version", 0, 0, 'V' },
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
             flags |= BDRV_O_SNAPSHOT;
             break;
         case 'n':
-            flags |= BDRV_O_DIRECT;
+            flags |= BDRV_O_NOCACHE;
             break;
         case 'b':
             bindto = optarg;
@@ -409,8 +409,6 @@ int main(int argc, char **argv)
     }
 
     sharing_fds = qemu_malloc((shared + 1) * sizeof(int));
-    if (sharing_fds == NULL)
-        errx(ENOMEM, "Cannot allocate sharing fds");
 
     if (socket) {
         sharing_fds[0] = unix_socket_incoming(socket);
@@ -458,7 +456,7 @@ int main(int argc, char **argv)
                                              (struct sockaddr *)&addr,
                                              &addr_len);
                 if (sharing_fds[nb_fds] != -1 &&
-                    nbd_negotiate(bs, sharing_fds[nb_fds], fd_size) != -1) {
+                    nbd_negotiate(sharing_fds[nb_fds], fd_size) != -1) {
                         if (sharing_fds[nb_fds] > max_fd)
                             max_fd = sharing_fds[nb_fds];
                         nb_fds++;