nfs.c (4359255ad39fdf116f0cf70a77ef5330c217e4da) nfs.c (061ca8a368165fae300748c17971824a089f521f)
1/*
2 * QEMU Block driver for native access to files on NFS shares
3 *
4 * Copyright (c) 2014-2017 Peter Lieven <pl@kamp.de>
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

--- 729 unchanged lines hidden (view full) ---

738 }
739
740 nfs_set_events(client);
741 BDRV_POLL_WHILE(bs, !task.complete);
742
743 return (task.ret < 0 ? task.ret : st.st_blocks * 512);
744}
745
1/*
2 * QEMU Block driver for native access to files on NFS shares
3 *
4 * Copyright (c) 2014-2017 Peter Lieven <pl@kamp.de>
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

--- 729 unchanged lines hidden (view full) ---

738 }
739
740 nfs_set_events(client);
741 BDRV_POLL_WHILE(bs, !task.complete);
742
743 return (task.ret < 0 ? task.ret : st.st_blocks * 512);
744}
745
746static int nfs_file_truncate(BlockDriverState *bs, int64_t offset,
747 PreallocMode prealloc, Error **errp)
746static int coroutine_fn
747nfs_file_co_truncate(BlockDriverState *bs, int64_t offset,
748 PreallocMode prealloc, Error **errp)
748{
749 NFSClient *client = bs->opaque;
750 int ret;
751
752 if (prealloc != PREALLOC_MODE_OFF) {
753 error_setg(errp, "Unsupported preallocation mode '%s'",
754 PreallocMode_str(prealloc));
755 return -ENOTSUP;

--- 112 unchanged lines hidden (view full) ---

868 .protocol_name = "nfs",
869
870 .instance_size = sizeof(NFSClient),
871 .bdrv_parse_filename = nfs_parse_filename,
872 .create_opts = &nfs_create_opts,
873
874 .bdrv_has_zero_init = nfs_has_zero_init,
875 .bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
749{
750 NFSClient *client = bs->opaque;
751 int ret;
752
753 if (prealloc != PREALLOC_MODE_OFF) {
754 error_setg(errp, "Unsupported preallocation mode '%s'",
755 PreallocMode_str(prealloc));
756 return -ENOTSUP;

--- 112 unchanged lines hidden (view full) ---

869 .protocol_name = "nfs",
870
871 .instance_size = sizeof(NFSClient),
872 .bdrv_parse_filename = nfs_parse_filename,
873 .create_opts = &nfs_create_opts,
874
875 .bdrv_has_zero_init = nfs_has_zero_init,
876 .bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
876 .bdrv_truncate = nfs_file_truncate,
877 .bdrv_co_truncate = nfs_file_co_truncate,
877
878 .bdrv_file_open = nfs_file_open,
879 .bdrv_close = nfs_file_close,
880 .bdrv_co_create = nfs_file_co_create,
881 .bdrv_co_create_opts = nfs_file_co_create_opts,
882 .bdrv_reopen_prepare = nfs_reopen_prepare,
883
884 .bdrv_co_preadv = nfs_co_preadv,

--- 18 unchanged lines hidden ---
878
879 .bdrv_file_open = nfs_file_open,
880 .bdrv_close = nfs_file_close,
881 .bdrv_co_create = nfs_file_co_create,
882 .bdrv_co_create_opts = nfs_file_co_create_opts,
883 .bdrv_reopen_prepare = nfs_reopen_prepare,
884
885 .bdrv_co_preadv = nfs_co_preadv,

--- 18 unchanged lines hidden ---