From patchwork Thu Oct 27 10:45:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 687563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t4PmK64Ywz9t1B for ; Thu, 27 Oct 2016 22:29:05 +1100 (AEDT) Received: from localhost ([::1]:40463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzirn-0002dg-5g for incoming@patchwork.ozlabs.org; Thu, 27 Oct 2016 07:29:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzins-0007wc-UV for qemu-devel@nongnu.org; Thu, 27 Oct 2016 07:25:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzinm-0003ZZ-QK for qemu-devel@nongnu.org; Thu, 27 Oct 2016 07:25:00 -0400 Received: from [209.132.183.28] (port=42236 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzinZ-0003P4-Om; Thu, 27 Oct 2016 07:24:41 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F18BC0567A3; Thu, 27 Oct 2016 10:45:20 +0000 (UTC) Received: from lemon.redhat.com (vpn1-4-160.pek2.redhat.com [10.72.4.160]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9RAjHtW022808; Thu, 27 Oct 2016 06:45:18 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Thu, 27 Oct 2016 18:45:17 +0800 Message-Id: <1477565117-17230-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 27 Oct 2016 10:45:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] raw-posix: Rename 'raw_s' to 'rs' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It is too confusing because it sounds like a BDRVRawState variable. Suggested-by: Max Reitz Signed-off-by: Fam Zheng Reviewed-by: Eric Blake --- block/raw-posix.c | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index f481e57..7c62fc3 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -542,7 +542,7 @@ static int raw_reopen_prepare(BDRVReopenState *state, BlockReopenQueue *queue, Error **errp) { BDRVRawState *s; - BDRVRawReopenState *raw_s; + BDRVRawReopenState *rs; int ret = 0; Error *local_err = NULL; @@ -552,15 +552,15 @@ static int raw_reopen_prepare(BDRVReopenState *state, s = state->bs->opaque; state->opaque = g_new0(BDRVRawReopenState, 1); - raw_s = state->opaque; + rs = state->opaque; if (s->type == FTYPE_CD) { - raw_s->open_flags |= O_NONBLOCK; + rs->open_flags |= O_NONBLOCK; } - raw_parse_flags(state->flags, &raw_s->open_flags); + raw_parse_flags(state->flags, &rs->open_flags); - raw_s->fd = -1; + rs->fd = -1; int fcntl_flags = O_APPEND | O_NONBLOCK; #ifdef O_NOATIME @@ -569,35 +569,35 @@ static int raw_reopen_prepare(BDRVReopenState *state, #ifdef O_ASYNC /* Not all operating systems have O_ASYNC, and those that don't - * will not let us track the state into raw_s->open_flags (typically + * will not let us track the state into rs->open_flags (typically * you achieve the same effect with an ioctl, for example I_SETSIG * on Solaris). But we do not use O_ASYNC, so that's fine. */ assert((s->open_flags & O_ASYNC) == 0); #endif - if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) { + if ((rs->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) { /* dup the original fd */ - raw_s->fd = qemu_dup(s->fd); - if (raw_s->fd >= 0) { - ret = fcntl_setfl(raw_s->fd, raw_s->open_flags); + rs->fd = qemu_dup(s->fd); + if (rs->fd >= 0) { + ret = fcntl_setfl(rs->fd, rs->open_flags); if (ret) { - qemu_close(raw_s->fd); - raw_s->fd = -1; + qemu_close(rs->fd); + rs->fd = -1; } } } /* If we cannot use fcntl, or fcntl failed, fall back to qemu_open() */ - if (raw_s->fd == -1) { + if (rs->fd == -1) { const char *normalized_filename = state->bs->filename; ret = raw_normalize_devicepath(&normalized_filename); if (ret < 0) { error_setg_errno(errp, -ret, "Could not normalize device path"); } else { - assert(!(raw_s->open_flags & O_CREAT)); - raw_s->fd = qemu_open(normalized_filename, raw_s->open_flags); - if (raw_s->fd == -1) { + assert(!(rs->open_flags & O_CREAT)); + rs->fd = qemu_open(normalized_filename, rs->open_flags); + if (rs->fd == -1) { error_setg_errno(errp, errno, "Could not reopen file"); ret = -1; } @@ -606,11 +606,11 @@ static int raw_reopen_prepare(BDRVReopenState *state, /* Fail already reopen_prepare() if we can't get a working O_DIRECT * alignment with the new fd. */ - if (raw_s->fd != -1) { - raw_probe_alignment(state->bs, raw_s->fd, &local_err); + if (rs->fd != -1) { + raw_probe_alignment(state->bs, rs->fd, &local_err); if (local_err) { - qemu_close(raw_s->fd); - raw_s->fd = -1; + qemu_close(rs->fd); + rs->fd = -1; error_propagate(errp, local_err); ret = -EINVAL; } @@ -621,13 +621,13 @@ static int raw_reopen_prepare(BDRVReopenState *state, static void raw_reopen_commit(BDRVReopenState *state) { - BDRVRawReopenState *raw_s = state->opaque; + BDRVRawReopenState *rs = state->opaque; BDRVRawState *s = state->bs->opaque; - s->open_flags = raw_s->open_flags; + s->open_flags = rs->open_flags; qemu_close(s->fd); - s->fd = raw_s->fd; + s->fd = rs->fd; g_free(state->opaque); state->opaque = NULL; @@ -636,16 +636,16 @@ static void raw_reopen_commit(BDRVReopenState *state) static void raw_reopen_abort(BDRVReopenState *state) { - BDRVRawReopenState *raw_s = state->opaque; + BDRVRawReopenState *rs = state->opaque; /* nothing to do if NULL, we didn't get far enough */ - if (raw_s == NULL) { + if (rs == NULL) { return; } - if (raw_s->fd >= 0) { - qemu_close(raw_s->fd); - raw_s->fd = -1; + if (rs->fd >= 0) { + qemu_close(rs->fd); + rs->fd = -1; } g_free(state->opaque); state->opaque = NULL;