vvfat.c (7fa124b273acd22a808e742ead78c065ccd9b4c4) vvfat.c (a65064816d64db463f4c24bd81dcaad62fee89eb)
1/* vim:set shiftwidth=4 ts=4: */
2/*
3 * QEMU Block driver for virtual VFAT (shadows a local directory)
4 *
5 * Copyright (c) 2004,2005 Johannes E. Schindelin
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

1172 if (qemu_opt_get_bool(opts, "rw", false)) {
1173 ret = enable_write_target(s, errp);
1174 if (ret < 0) {
1175 goto fail;
1176 }
1177 bs->read_only = 0;
1178 }
1179
1/* vim:set shiftwidth=4 ts=4: */
2/*
3 * QEMU Block driver for virtual VFAT (shadows a local directory)
4 *
5 * Copyright (c) 2004,2005 Johannes E. Schindelin
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

1172 if (qemu_opt_get_bool(opts, "rw", false)) {
1173 ret = enable_write_target(s, errp);
1174 if (ret < 0) {
1175 goto fail;
1176 }
1177 bs->read_only = 0;
1178 }
1179
1180 bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
1181 bs->total_sectors = cyls * heads * secs;
1182
1183 if (init_directories(s, dirname, heads, secs, errp)) {
1184 ret = -EIO;
1185 goto fail;
1186 }
1187
1188 s->sector_count = s->faked_sectors + s->sectors_per_cluster*s->cluster_count;

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

1204 }
1205
1206 ret = 0;
1207fail:
1208 qemu_opts_del(opts);
1209 return ret;
1210}
1211
1180 bs->total_sectors = cyls * heads * secs;
1181
1182 if (init_directories(s, dirname, heads, secs, errp)) {
1183 ret = -EIO;
1184 goto fail;
1185 }
1186
1187 s->sector_count = s->faked_sectors + s->sectors_per_cluster*s->cluster_count;

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

1203 }
1204
1205 ret = 0;
1206fail:
1207 qemu_opts_del(opts);
1208 return ret;
1209}
1210
1211static void vvfat_refresh_limits(BlockDriverState *bs, Error **errp)
1212{
1213 bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
1214}
1215
1212static inline void vvfat_close_current_file(BDRVVVFATState *s)
1213{
1214 if(s->current_mapping) {
1215 s->current_mapping = NULL;
1216 if (s->current_fd) {
1217 qemu_close(s->current_fd);
1218 s->current_fd = 0;
1219 }

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

3041
3042static BlockDriver bdrv_vvfat = {
3043 .format_name = "vvfat",
3044 .protocol_name = "fat",
3045 .instance_size = sizeof(BDRVVVFATState),
3046
3047 .bdrv_parse_filename = vvfat_parse_filename,
3048 .bdrv_file_open = vvfat_open,
1216static inline void vvfat_close_current_file(BDRVVVFATState *s)
1217{
1218 if(s->current_mapping) {
1219 s->current_mapping = NULL;
1220 if (s->current_fd) {
1221 qemu_close(s->current_fd);
1222 s->current_fd = 0;
1223 }

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

3045
3046static BlockDriver bdrv_vvfat = {
3047 .format_name = "vvfat",
3048 .protocol_name = "fat",
3049 .instance_size = sizeof(BDRVVVFATState),
3050
3051 .bdrv_parse_filename = vvfat_parse_filename,
3052 .bdrv_file_open = vvfat_open,
3053 .bdrv_refresh_limits = vvfat_refresh_limits,
3049 .bdrv_close = vvfat_close,
3050
3051 .bdrv_co_preadv = vvfat_co_preadv,
3052 .bdrv_co_pwritev = vvfat_co_pwritev,
3053 .bdrv_co_get_block_status = vvfat_co_get_block_status,
3054};
3055
3056static void bdrv_vvfat_init(void)

--- 28 unchanged lines hidden ---
3054 .bdrv_close = vvfat_close,
3055
3056 .bdrv_co_preadv = vvfat_co_preadv,
3057 .bdrv_co_pwritev = vvfat_co_pwritev,
3058 .bdrv_co_get_block_status = vvfat_co_get_block_status,
3059};
3060
3061static void bdrv_vvfat_init(void)

--- 28 unchanged lines hidden ---