All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] fs-backend: fix FD allocation for file creation
Date: Fri, 25 Jul 2008 09:43:07 +0100	[thread overview]
Message-ID: <20080725084307.GG4482@implementation.uk.xensource.com> (raw)

fs-backend: fix FD allocation for file creation

The creation operation also opens a file, we need to allocate a virtual
fd for that too.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -r 70a43a82aaf1 tools/fs-back/fs-ops.c
--- a/tools/fs-back/fs-ops.c	Tue Jul 22 16:31:03 2008 +0100
+++ b/tools/fs-back/fs-ops.c	Fri Jul 25 09:43:05 2008 +0100
@@ -461,7 +461,17 @@
     else
     {
         printf("Issuing create for file: %s\n", full_path);
-        ret = creat(full_path, mode); 
+        ret = get_fd(mount);
+        if (ret >= 0) {
+            int real_fd = creat(full_path, mode); 
+            if (real_fd < 0)
+                ret = -1;
+            else
+            {
+                mount->fds[ret] = real_fd;
+                printf("Got FD: %d for real %d\n", ret, real_fd);
+            }
+        }
     }
     printf("Got ret %d (errno=%d)\n", ret, errno);

                 reply	other threads:[~2008-07-25  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080725084307.GG4482@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.