ssh.c (4359255ad39fdf116f0cf70a77ef5330c217e4da) | ssh.c (061ca8a368165fae300748c17971824a089f521f) |
---|---|
1/* 2 * Secure Shell (ssh) backend for QEMU. 3 * 4 * Copyright (C) 2013 Red Hat Inc., Richard W.M. Jones <rjones@redhat.com> 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1229 unchanged lines hidden (view full) --- 1238 1239 /* Note we cannot make a libssh2 call here. */ 1240 length = (int64_t) s->attrs.filesize; 1241 DPRINTF("length=%" PRIi64, length); 1242 1243 return length; 1244} 1245 | 1/* 2 * Secure Shell (ssh) backend for QEMU. 3 * 4 * Copyright (C) 2013 Red Hat Inc., Richard W.M. Jones <rjones@redhat.com> 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1229 unchanged lines hidden (view full) --- 1238 1239 /* Note we cannot make a libssh2 call here. */ 1240 length = (int64_t) s->attrs.filesize; 1241 DPRINTF("length=%" PRIi64, length); 1242 1243 return length; 1244} 1245 |
1246static int ssh_truncate(BlockDriverState *bs, int64_t offset, 1247 PreallocMode prealloc, Error **errp) | 1246static int coroutine_fn ssh_co_truncate(BlockDriverState *bs, int64_t offset, 1247 PreallocMode prealloc, Error **errp) |
1248{ 1249 BDRVSSHState *s = bs->opaque; 1250 1251 if (prealloc != PREALLOC_MODE_OFF) { 1252 error_setg(errp, "Unsupported preallocation mode '%s'", 1253 PreallocMode_str(prealloc)); 1254 return -ENOTSUP; 1255 } --- 18 unchanged lines hidden (view full) --- 1274 .bdrv_file_open = ssh_file_open, 1275 .bdrv_co_create = ssh_co_create, 1276 .bdrv_co_create_opts = ssh_co_create_opts, 1277 .bdrv_close = ssh_close, 1278 .bdrv_has_zero_init = ssh_has_zero_init, 1279 .bdrv_co_readv = ssh_co_readv, 1280 .bdrv_co_writev = ssh_co_writev, 1281 .bdrv_getlength = ssh_getlength, | 1248{ 1249 BDRVSSHState *s = bs->opaque; 1250 1251 if (prealloc != PREALLOC_MODE_OFF) { 1252 error_setg(errp, "Unsupported preallocation mode '%s'", 1253 PreallocMode_str(prealloc)); 1254 return -ENOTSUP; 1255 } --- 18 unchanged lines hidden (view full) --- 1274 .bdrv_file_open = ssh_file_open, 1275 .bdrv_co_create = ssh_co_create, 1276 .bdrv_co_create_opts = ssh_co_create_opts, 1277 .bdrv_close = ssh_close, 1278 .bdrv_has_zero_init = ssh_has_zero_init, 1279 .bdrv_co_readv = ssh_co_readv, 1280 .bdrv_co_writev = ssh_co_writev, 1281 .bdrv_getlength = ssh_getlength, |
1282 .bdrv_truncate = ssh_truncate, | 1282 .bdrv_co_truncate = ssh_co_truncate, |
1283 .bdrv_co_flush_to_disk = ssh_co_flush, 1284 .create_opts = &ssh_create_opts, 1285}; 1286 1287static void bdrv_ssh_init(void) 1288{ 1289 int r; 1290 1291 r = libssh2_init(0); 1292 if (r != 0) { 1293 fprintf(stderr, "libssh2 initialization failed, %d\n", r); 1294 exit(EXIT_FAILURE); 1295 } 1296 1297 bdrv_register(&bdrv_ssh); 1298} 1299 1300block_init(bdrv_ssh_init); | 1283 .bdrv_co_flush_to_disk = ssh_co_flush, 1284 .create_opts = &ssh_create_opts, 1285}; 1286 1287static void bdrv_ssh_init(void) 1288{ 1289 int r; 1290 1291 r = libssh2_init(0); 1292 if (r != 0) { 1293 fprintf(stderr, "libssh2 initialization failed, %d\n", r); 1294 exit(EXIT_FAILURE); 1295 } 1296 1297 bdrv_register(&bdrv_ssh); 1298} 1299 1300block_init(bdrv_ssh_init); |