Drive by comment, since I spotted this in my inbox.
When I tried to make this change (two years ago though),
I additionally needed the following. Unfortunately, I don't quite remember
exactly what the issue was, but I think qemu would crash trying to create more
than one nic.
---
there is a solution: Darwin as an (unexposed in the
C library) system call that sets the cwd for the current thread only.
This should suffice to use mknod safely.
Signed-off-by: Keno Fischer
---
Changes since v2:
- Silence clang warning for deprecated uses of `syscall`. It is
unforunate that we have to use
. I had originally done this when
I thought it made sense to have only one `setugid` function, but I retained
this because it seems clearer this way.
Signed-off-by: Keno Fischer
---
fsdev/virtfs-proxy-helper.c | 200 +++-
1 file changed, 125 insertions
Signed-off-by: Keno Fischer
---
Makefile.objs | 1 +
configure | 22 +++---
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index 7a9828d..c968a9a 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -104,6 +104,7 @@ common-obj
On darwin d_seekoff exists, but is optional and does not seem to
be commonly used by file systems. Use `telldir` instead to obtain
the seek offset.
Signed-off-by: Keno Fischer
---
hw/9pfs/9p-synth.c | 2 ++
hw/9pfs/9p.c | 36
2 files changed, 34
other
than Apple clang that may not support this builtin.
Signed-off-by: Keno Fischer
---
fsdev/virtfs-proxy-helper.c | 3 +-
hw/9pfs/9p-local.c | 2 +-
hw/9pfs/9p-util-darwin.c| 96 +
hw/9pfs/9p-util-linux.c | 6 +++
hw/9pfs/9p
This implements the darwin equivalent of the functions that were
moved to 9p-util(-linux) earlier in this series in the new
9p-util-darwin file.
Signed-off-by: Keno Fischer
---
hw/9pfs/9p-util-darwin.c | 64
hw/9pfs/Makefile.objs| 1 +
2
On darwin `fgetxattr` takes two extra optional arguments,
and the l* variants are not defined (in favor of an extra
flag to the regular variants.
Signed-off-by: Keno Fischer
---
Makefile| 6 ++
fsdev/virtfs-proxy-helper.c | 9 +
hw/9pfs/9p-local.c | 12
The current file only has the Linux versions of these functions.
Rename the file accordingly and update the Makefile to only build
it on Linux. A Darwin version of these will follow later in the
series.
Signed-off-by: Keno Fischer
---
hw/9pfs/9p-util-linux.c | 59
Comparisons of mode_t with -1 require an explicit cast, since mode_t
is unsigned on Darwin.
Signed-off-by: Keno Fischer
---
hw/9pfs/9p-local.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index d713983..98d4073 100644
--- a/hw
From: Keno Fischer
- Guard Linux only headers.
- Add qemu/statfs.h header to abstract over the which
headers are needed for struct statfs
- Define `ENOATTR` only if not only defined
(it's defined in system headers on Darwin).
Signed-off-by: Keno Fischer
---
fsdev/file-op-9p.h
.
Keno
Keno Fischer (13):
9p: linux: Fix a couple Linux assumptions
9p: Rename 9p-util -> 9p-util-linux
9p: darwin: Handle struct stat(fs) differences
9p: darwin: Handle struct dirent differences
9p: darwin: Explicitly cast comparisons of mode_t with -1
9p: darwin: Ignore O_{NOATIME, DIR
Signed-off-by: Keno Fischer
---
hw/9pfs/9p.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index e650459..abfb8dc 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -3374,6 +3374,13 @@ out_nofid:
v9fs_string_free();
}
+#if defined(CONFIG_DARWIN
Signed-off-by: Keno Fischer
---
fsdev/virtfs-proxy-helper.c | 14 +++---
hw/9pfs/9p-proxy.c | 17 ++---
hw/9pfs/9p-synth.c | 2 ++
hw/9pfs/9p.c| 16 ++--
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/fsdev
Darwin doesn't have either of these flags. Darwin does have
F_NOCACHE, which is similar to O_DIRECT, but has different
enough semantics that other projects don't generally map
them automatically. In any case, we don't support O_DIRECT
on Linux at the moment either.
Signed-off-by: Keno Fischer
In appears the input keymap for osx was forgotten in the commit that
converted the gtk frontend to keycodemapdb. Add it.
Fixes: 2ec78706 ("ui: convert GTK and SDL1 frontends to keycodemapdb")
CC: Daniel P. Berrange
Signed-off-by: Keno Fischer
---
Makefile | 1 +
include/
the replacement pattern in a place where strchrnul could be used.
Signed-off-by: Keno Fischer
Acked-by: Greg Kurz
---
Changes since v4:
- `CONFIG_STRCHRNUL` -> `HAVE_STRCHRNUL` name change
- In the strchrnul configure check
- Return the value of strchrnul to avoid it being optimized away
-
> Suggest return strchrnul("Hello World", 'W') != 6, to avoid worries
> about a sufficiently smart compilers optimizing out a call that would
> otherwise fail to link, say because headers don't match libraries.
I'm happy to do that, but then again, a sufficiently smart compiler might
constant
the replacement pattern in a place where strchrnul could be used.
Signed-off-by: Keno Fischer
Acked-by: Greg Kurz
---
Changes since v3:
- Fix bug in configure check
configure | 15 +++
hmp.c | 8
hw/9pfs/9p-local.c| 2 +-
include/qemu/cutils.h | 8
the replacement pattern in a place where strchrnul could be used.
Signed-off-by: Keno Fischer
Acked-by: Greg Kurz
---
Changes since v2:
* Add configure check as suggested by Greg Kurz ,
and requested by Eric Blake
* Use qemu_strchrnul in hmp_sendkey as suggested by
Dr. David Alan Gilbert
As with unlinkat, these flags come from the client and need to
be translated to their host values. The protocol values happen
to match linux, but that need not be true in general.
Signed-off-by: Keno Fischer
---
Changes since v2: New patch
hw/9pfs/9p.c | 17 +++--
hw/9pfs/9p.h
the translation code to the generic 9p server code and add an error
if unrecognized flags are passed.
Signed-off-by: Keno Fischer
---
Changes since v2:
* Remove 9p-handle code that did the same translation and is now incorrect.
hw/9pfs/9p-handle.c | 8 +---
hw/9pfs/9p.c| 13 +++--
2
Both `stbuf` and `local_ioc_getversion` where unused when
FS_IOC_GETVERSION was not defined, causing a compiler warning.
Reorganize the code to avoid this warning.
Signed-off-by: Keno Fischer
---
hw/9pfs/9p-local.c | 40 +++-
1 file changed, 23 insertions
, which is safe to pass to g_free.
Signed-off-by: Keno Fischer
---
Changes since v2:
* Fix another instance of the problematic pattern later in the same function.
hw/9pfs/9p.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index d74302d
Hi Greg,
this is a respin of just the first couple of patches of my 9p Darwin
series. These patches should be applicable independent of the darwin
work.
Keno Fischer (5):
cutils: Provide strchrnul
9p: xattr: Fix crashes due to free of uninitialized value
9p: local: Avoid warning
> I guess this calls for some defines in 9p.h:
>
> /* 9p2000.L says that the 'flags' argument of operation 'xattrcreate'
> * are derived from Linux setxattr.
> */
> #define P9_XATTR_CREATE 1
> #define P9_XATTR_REPLACE 2
>
> Please do that in a preparatory patch.
>
> I would also appreciate you
On darwin `fgetxattr` takes two extra optional arguments,
and the l* variants are not defined (in favor of an extra
flag to the regular variants.
Signed-off-by: Keno Fischer
---
Changes from v1: New patch, qemu_fgetxattr had previously been
moved to 9p-util as fgetxattr_follow. The remaining
Signed-off-by: Keno Fischer
---
Changes from v1: Now builds the proxy-helper on Darwin.
Makefile.objs | 1 +
configure | 22 +++---
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index c6c3554..a2245c9 100644
there is a solution: Darwin as an (unexposed in the
C library) system call that sets the cwd for the current thread only.
This should suffice to use mknod safely.
Signed-off-by: Keno Fischer
---
Changes from v1: New patch. The previous series marked mknodat unsupported.
hw/9pfs/9p-local.c | 5
. I had originally done this when
I thought it made sense to have only one `setugid` function, but I retained
this because it seems clearer this way.
Signed-off-by: Keno Fischer
---
Changes from v1: New patch.
fsdev/virtfs-proxy-helper.c | 200 +++-
1
Comparisons of mode_t with -1 require an explicit cast, since mode_t
is unsigned on Darwin.
Signed-off-by: Keno Fischer
---
Changes from v1: Split from strchrnul change
hw/9pfs/9p-local.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p
This implements the darwin equivalent of the functions that were
moved to 9p-util(-linux) earlier in this series in the new
9p-util-darwin file.
Signed-off-by: Keno Fischer
---
Changes from v1:
* New 9p-util-darwin.c rather than ifdefs in 9p-util.c
* Drop incorrect AT_NOFOLLOW from the actual
other
than Apple clang that may not support this builtin.
Signed-off-by: Keno Fischer
---
Changes from v1:
* Correct calculation of tv_usec
* Support UTIME_NOW/UTIME/OMIT
* Now covers fsdev/virtfs-proxy-helper.c
fsdev/virtfs-proxy-helper.c | 3 +-
hw/9pfs/9p-local.c | 2 +-
hw
Signed-off-by: Keno Fischer
---
Changes since v1:
* Now also covers fsdev/virtfs-proxy-helper.c
fsdev/virtfs-proxy-helper.c | 14 +++---
hw/9pfs/9p-proxy.c | 17 ++---
hw/9pfs/9p-synth.c | 2 ++
hw/9pfs/9p.c| 16 ++--
4 files
to the 9p unlinkat server code.
Signed-off-by: Keno Fischer
---
Changes since v1:
* Code was moved from 9p-local.c to server entry point in 9p.c
hw/9pfs/9p.c | 13 +++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index b80db65..a757374 100644
Signed-off-by: Keno Fischer
---
No change from v1.
hw/9pfs/9p.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 70cfab9..24802b9 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -3374,6 +3374,13 @@ out_nofid:
v9fs_string_free
The current file only has the Linux versions of these functions.
Rename the file accordingly and update the Makefile to only build
it on Linux. A Darwin version of these will follow later in the
series.
Signed-off-by: Keno Fischer
---
Changes since v1: New patch
hw/9pfs/9p-util-linux.c | 59
Darwin doesn't have either of these flags. Darwin does have
F_NOCACHE, which is similar to O_DIRECT, but has different
enough semantics that other projects don't generally map
them automatically. In any case, we don't support O_DIRECT
on Linux at the moment either.
Signed-off-by: Keno Fischer
These functions will need custom implementations on Darwin. Since the
implementation is very similar among all of them, and 9p-util already
has the _nofollow version of fgetxattrat, let's move them all there.
Signed-off-by: Keno Fischer
---
Changes since v1:
* fgetxattr_follow is dropped
In the review of
9p: Avoid warning if FS_IOC_GETVERSION is not defined
Grep Kurz noted this error path was failing to set errp.
Fix that.
Signed-off-by: Keno Fischer
---
Changes since v1: New patch
hw/9pfs/9p-local.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/9pfs/9p
Both `stbuf` and `local_ioc_getversion` where unused when
FS_IOC_GETVERSION was not defined, causing a compiler warning.
Reorgnaize the code to avoid this warning.
Signed-off-by: Keno Fischer
---
Changes since v1:
* As request in review, logic is factored into a
local_ioc_getversion_init
On darwin d_seekoff exists, but is optional and does not seem to
be commonly used by file systems. Use `telldir` instead to obtain
the seek offset.
Signed-off-by: Keno Fischer
---
Changes since v1:
* Drop setting d_seekoff in synth_direntry
* Factor telldir vs d_off logic
The size to pass to the `connect` call is the size of the entire
`struct sockaddr_un`. Passing anything shorter than this causes errors
on darwin.
Signed-off-by: Keno Fischer
---
Changes since v1: New patch
hw/9pfs/9p-proxy.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff
- Guard Linux only headers.
- Add qemu/statfs.h header to abstract over the which
headers are needed for struct statfs
- Define `ENOATTR` only if not only defined
(it's defined in system headers on Darwin).
Signed-off-by: Keno Fischer
---
Changes since v1:
* New qemu/statfs.h header
that is safe to pass to g_free,
likely NULL.
Signed-off-by: Keno Fischer
---
Changes since v1: New patch
hw/9pfs/9p.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index d74302d..b80db65 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -3256,8
the replacement pattern in a place where strchrnul could be used.
Signed-off-by: Keno Fischer
---
Changes since v1: New patch
hw/9pfs/9p-local.c| 2 +-
include/qemu/cutils.h | 1 +
monitor.c | 8 ++--
util/cutils.c | 13 +
util/qemu-option.c| 6 +-
util
This is v2 of my patch series to provide 9p server
support for Darwin.
The patches in this series address review from v1,
now support building the virtfs proxy, as well
as fix bugs found since v1.
Keno Fischer (20):
cutils: Provide strchrnul
9p: proxy: Fix size passed to `connect`
9p
On Thu, May 31, 2018 at 7:06 PM, Keno Fischer wrote:
> On Thu, May 31, 2018 at 6:56 PM, Keno Fischer wrote:
>>>> My concern was that allowing this would cause unexpected
>>>> behavior, since the device numbers will differ between OS X
>>>> and Linux. Tho
On Thu, May 31, 2018 at 6:56 PM, Keno Fischer wrote:
>>> My concern was that allowing this would cause unexpected
>>> behavior, since the device numbers will differ between OS X
>>> and Linux. Though maybe this isn't the place to worry about
>>> that.
>&g
>> My concern was that allowing this would cause unexpected
>> behavior, since the device numbers will differ between OS X
>> and Linux. Though maybe this isn't the place to worry about
>> that.
>
> The numbers may differ indeed but we don't really care since the
> server never opens device files.
Well, I do have the patch already to switch this and the other patterns,
so let me know if you want it or not ;).
On Thu, May 31, 2018 at 3:22 PM, Greg Kurz wrote:
> On Thu, 31 May 2018 12:27:35 -0400
> Keno Fischer wrote:
>
>> >> --- a/hw/9pfs/9p-local.c
>>
>> +elif test "$darwin" = yes; then
>>virtfs=yes
>> - tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
>
> So, no proxy helper on Darwin ? Why ? The limitation should be mentioned in
> the changelog at least.
I just had no use for it. I'll try to build it and see what happens.
> Oops you're right... so we indeed need to handle this conflicting APIs,
> but fgetxattr_follow() is inapropriate, because fgetxattr() has nothing
> to follow since it already has an fd... The same goes with Darwin's
> version actually. The "nofollow" thingy only makes sense for those calls
>
>> +#ifdef CONFIG_DARWIN
>> +/* Darwin doesn't have mknodat and it's unlikely to work anyway,
>
> What's unlikely to work ?
>
My concern was that allowing this would cause unexpected
behavior, since the device numbers will differ between OS X
and Linux. Though maybe this isn't the place to
>
> Please don't kill the spaces.
>
Sorry, will undo. My editor has strong opinions about styling.
>> +#ifndef CONFIG_DARWIN
>> +{P9_DOTL_NOATIME, O_NOATIME},
>> +/* On Darwin, we could map to F_NOCACHE, which is
>> + similar, but doesn't quite have the same
>> +
>> --- a/hw/9pfs/9p-local.c
>> +++ b/hw/9pfs/9p-local.c
>> @@ -67,7 +67,10 @@ int local_open_nofollow(FsContext *fs_ctx, const char
>> *path, int flags,
>> assert(*path != '/');
>>
>> head = g_strdup(path);
>> -c = strchrnul(path, '/');
>> +/* equivalent to
>> +errno = EINVAL;
>> +return -1;
>
> ... I'm more concerned about this new error path. How can this happen ?
>
As far as I can tell, the flags come from the client without any
intermediate error
checking. Since the Darwin constants do not match the Linux constants (which
have
>> diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
>> index eb68b42..3c0a6d8 100644
>> --- a/hw/9pfs/9p-synth.c
>> +++ b/hw/9pfs/9p-synth.c
>> @@ -221,7 +221,11 @@ static void synth_direntry(V9fsSynthNode *node,
>> {
>> strcpy(entry->d_name, node->name);
>> entry->d_ino =
> I'm ok with this move, but if the functions need to have distinct
> implementations, and they really do according to patch 10, then
> I'd rather have distinct files and rely on conditional building in
> the makefile. Maybe rename the current file to 9p-util-linux.c
> and introduce a
>>> diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h
>>> index 3fa062b..a13e729 100644
>>> --- a/fsdev/file-op-9p.h
>>> +++ b/fsdev/file-op-9p.h
>>> @@ -16,7 +16,9 @@
>>>
>>> #include
>>> #include
>>> +#ifdef CONFIG_LINUX
>>
>> What about a less restrictive:
>>
>> #ifndef __APPLE__
>
> In
> > +#if defined(CONFIG_DARWIN) && !defined(XATTR_SIZE_MAX)
> > +/* Darwin doesn't seem to define a maximum xattr size in its user
> > + user space header, but looking at the kernel source, HFS supports
> > + up to INT32_MAX, so use that as the maximum.
> > +*/
> > +#define XATTR_SIZE_MAX
mit/9523feac272ccad2ad8186ba4fcc89103754de52
Signed-off-by: Keno Fischer <k...@juliacomputing.com>
---
Changes from v1:
- In reponse to review by Greg Kurz, add a new transport
layer operation to discard the buffer. I also attempted
an implementation for xen, but I have done no verification
on that beyond ma
NTR. I believe
this is true of the current code.
[1] https://9fans.github.io/plan9port/man/man9/flush.html
[2]
https://github.com/torvalds/linux/commit/9523feac272ccad2ad8186ba4fcc89103754de52
Signed-off-by: Keno Fischer <k...@juliacomputing.com>
---
hw/9pfs/9p.c | 17
63 matches
Mail list logo