From patchwork Wed Jul 18 15:07:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 1211601 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C447F3FCFC for ; Wed, 18 Jul 2012 15:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754825Ab2GRPIw (ORCPT ); Wed, 18 Jul 2012 11:08:52 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:38558 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754784Ab2GRPIm (ORCPT ); Wed, 18 Jul 2012 11:08:42 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jul 2012 16:08:41 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Jul 2012 16:08:39 +0100 Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6IF8cCB2412650 for ; Wed, 18 Jul 2012 16:08:38 +0100 Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6IF8brl012072 for ; Wed, 18 Jul 2012 09:08:37 -0600 Received: from localhost (sig-9-145-185-169.de.ibm.com [9.145.185.169]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6IF8abc012052; Wed, 18 Jul 2012 09:08:36 -0600 From: Stefan Hajnoczi To: Cc: , Anthony Liguori , Kevin Wolf , Paolo Bonzini , "Michael S. Tsirkin" , Asias He , Khoa Huynh , Stefan Hajnoczi Subject: [RFC v9 15/27] notifier: Add a function to set the notifier Date: Wed, 18 Jul 2012 16:07:42 +0100 Message-Id: <1342624074-24650-16-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12071815-4966-0000-0000-000002FADDE2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Although past users only needed to test and clear event notifiers, it is useful to be able to set them too. Signed-off-by: Stefan Hajnoczi --- event_notifier.c | 7 +++++++ event_notifier.h | 1 + 2 files changed, 8 insertions(+) diff --git a/event_notifier.c b/event_notifier.c index 0b82981..006adc5 100644 --- a/event_notifier.c +++ b/event_notifier.c @@ -59,3 +59,10 @@ int event_notifier_test(EventNotifier *e) } return r == sizeof(value); } + +int event_notifier_set(EventNotifier *e) +{ + uint64_t value = 1; + int r = write(e->fd, &value, sizeof(value)); + return r == sizeof(value); +} diff --git a/event_notifier.h b/event_notifier.h index 886222c..46a22f8 100644 --- a/event_notifier.h +++ b/event_notifier.h @@ -24,5 +24,6 @@ void event_notifier_cleanup(EventNotifier *); int event_notifier_get_fd(EventNotifier *); int event_notifier_test_and_clear(EventNotifier *); int event_notifier_test(EventNotifier *); +int event_notifier_set(EventNotifier *); #endif