Commit Graph

12616 Commits

Author SHA1 Message Date
Stefan Hajnoczi
78aeb23ede e1000: Pad short frames to minimum size (60 bytes)
The OpenIndiana (Solaris) e1000g driver drops frames that are too long
or too short.  It expects to receive frames of at least the Ethernet
minimum size.  ARP requests in particular are small and will be dropped
if they are not padded appropriately, preventing a Solaris VM from
becoming visible on the network.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-20 20:03:39 +02:00
Michael S. Tsirkin
6b37c87c96 vhost: fix infinite loop on error path
file.index is unsigned, hence 'while (--file.index >= 0)'
will loop > forever. Change to while (file.index-- > 0).

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-14 16:02:23 +02:00
Michal Novotny
b6601141cd serial: Wrap debug prints around a DPRINTF macro
Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-13 14:32:32 +02:00
Blue Swirl
73d7434279 ESP: fix ESP DMA access when DMA is not enabled
Sending ESP a command caused it to trigger DMA immediately
even if DMA was not enabled at the DMA controller.

Add a signal from DMA controller to ESP to tell ESP about changes in
DMA enable bit. Also use the correct function for setting up GPIO outputs.

This fixes NetBSD 1.6.1 through 3.0 boot.

Thanks to Artyom Tarasenko for extensive debugging of the problem.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-11 16:38:33 +00:00
Edgar E. Iglesias
24e0e38b83 powerpc: Avoid TLB related log spamming
Invalid TLB entries are normal and should not spam the log.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-11 14:29:07 +02:00
Blue Swirl
2184d75b4a trace: fix a regex portability problem
The /bin/sh in Milax has problems with the regex:
Error: invalid trace backend
Please choose a supported trace backend.

Fix it by escaping ')' like the regexes with '('.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-11 10:43:39 +00:00
Blue Swirl
dda8521197 trace: fix a typo
There is no qemu_valloc() but qemu_vmalloc().

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 23:54:56 +03:00
Blue Swirl
876f256bde HACKING: add rules for printf-like functions
Add rules for printf-like functions, based on libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:53:11 +00:00
Blue Swirl
d241f143c9 HACKING: add string management rules
Add string management rules, somewhat like libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:53:05 +00:00
Blue Swirl
54b2cc5030 HACKING: add memory management rules
Add memory management rules, somewhat like libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:52:52 +00:00
Blue Swirl
84174436a6 HACKING: add C type rules
Add C type rules, adapted from libvirt HACKING. Also include
a description of special QEMU scalar types.

Move typedef rule from CODING_STYLE rule 3 to HACKING rule 6
where it belongs.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:47:31 +00:00
Blue Swirl
45fad878d7 HACKING: add preprocessor rules
Add a new file, HACKING, in order to collect recurring
issues with submitted patches.

Start with preprocessor rules, adapted from libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:46:00 +00:00
Andrzej Zaborowski
9f810beb5c vmware_vga: Replace the few tab-indents with spaces (clean-up).
Use 4 spaces instead of 2, too.
2010-09-10 02:30:04 +02:00
Andrzej Zaborowski
4dedc07ffb vmware_vga: Add checks to deal with non-atomic fifo writes.
Janne Huttunen noticed that the FIFO end pointer is updated by the
guest after writing each word to the FIFO, at least the X.org driver
which is open does this.  This means that there's no way for the
host to know if the guest is in the middle a write operation.  Qemu
thus needs to read the beginning of the command up to when it's able
to tell how many words are expected for the given command.  It will
abort reading and rewind the FIFO if there aren't enough words yet,
this should be relatively rare but it is suspected to have been the
cause of the occasional FIFO overrun that killed the display.
2010-09-10 02:23:31 +02:00
Stefan Weil
6a8aabd3c1 hw/omap: Fix default setup for OMAP UART devices
Character devices created by qemu_chr_open don't
allow duplicate device names, so naming all
UART devices "null" no longer works.

Running "qemu-system-arm -M n800" (and some other machines)
results in this error message:

	qemu-system-arm: Duplicate ID 'null' for chardev
	Can't create serial device, empty char device

This is fixed by setting a default label "uart1",
"uart2" or "uart3".

Cc: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2010-09-10 01:55:53 +02:00
Prerna Saxena
62dd89dea2 trace: Trace entry point of balloon request handler
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:45 -05:00
Prerna Saxena
bd3c9aa531 trace: Trace port IO
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:45 -05:00
Stefan Hajnoczi
64979a4d61 trace: Trace virtqueue operations
This patch adds trace events for virtqueue operations including
adding/removing buffers, notifying the guest, and receiving a notify
from the guest.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:45 -05:00
Stefan Hajnoczi
6d519a5f95 trace: Trace virtio-blk, multiwrite, and paio_submit
This patch adds trace events that make it possible to observe
virtio-blk.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:45 -05:00
Stefan Hajnoczi
cd245a1932 trace: Trace qemu_malloc() and qemu_vmalloc()
It is often useful to instrument memory management functions in order to
find leaks or performance problems.  This patch adds trace events for
the memory allocation primitives.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:45 -05:00
Stefan Hajnoczi
81a97d9d97 trace: Add user documentation
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Stefan Hajnoczi
7e24e92a06 trace: Add LTTng Userspace Tracer backend
This patch adds LTTng Userspace Tracer (UST) backend support.  The UST
system requires no kernel support but libust and liburcu must be
installed.

$ ./configure --trace-backend ust
$ make

Start the UST daemon:
$ ustd &

List available tracepoints and enable some:
$ ustctl --list-markers $(pgrep qemu)
[...]
{PID: 5458, channel/marker: ust/paio_submit, state: 0, fmt: "acb %p
opaque %p sector_num %lu nb_sectors %lu type %lu" 0x4b32ba}
$ ustctl --enable-marker "ust/paio_submit" $(pgrep qemu)

Run the trace:
$ ustctl --create-trace $(pgrep qemu)
$ ustctl --start-trace $(pgrep qemu)
[...]
$ ustctl --stop-trace $(pgrep qemu)
$ ustctl --destroy-trace $(pgrep qemu)

Trace results can be viewed using lttv-gui.

More information about UST:
http://lttng.org/ust

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

trace: Check for LTTng Userspace Tracer headers

When using the 'ust' backend, check if the relevant headers are
available at host.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Prerna Saxena
ab6540d55e trace: Add trace file name command-line option
This patch adds an optional command line switch '-trace' to specify the
filename to write traces to, when qemu starts.
Eg, If compiled with the 'simple' trace backend,
[temp@system]$ qemu -trace FILENAME IMAGE
Allows the binary traces to be written to FILENAME instead of the option
set at config-time.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Stefan Hajnoczi
c5ceb523fa trace: Add trace-file command to open/close/flush trace file
This patch adds the trace-file command:

  trace-file [on|off|flush]

  Open, close, or flush the trace file.  If no argument is given,
  the status of the trace file is displayed.

The trace file is turned on by default but is only written out when the
trace buffer becomes full.  The flush operation can be used to force
write out at any time.

Turning off the trace file does not change the state of trace events;
tracing will continue to the trace buffer.  When the trace file is off,
use "info trace" to display the contents of the trace buffer in memory.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

This commit also contains the trace-file sub-command from the following
commit:

commit 5ce8d1a957afae2c52ad748944ce72848ccf57bd
Author: Prerna Saxena <prerna@linux.vnet.ibm.com>
Date:   Wed Aug 4 16:23:54 2010 +0530

    trace: Add options to specify trace file name at startup and runtime

    This patch adds an optional command line switch '-trace' to specify the
    filename to write traces to, when qemu starts.
    Eg, If compiled with the 'simple' trace backend,
    [temp@system]$ qemu -trace FILENAME IMAGE
    Allows the binary traces to be written to FILENAME instead of the option
    set at config-time.

    Also, this adds monitor sub-command 'set' to trace-file commands to
    dynamically change trace log file at runtime.
    Eg,
    (qemu)trace-file set FILENAME
    This allows one to set trace outputs to FILENAME from the default
    specified at startup.

    Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Prerna Saxena
9410b56c82 trace: Specify trace file name
Allow users to specify a file for trace-outputs at configuration.
Also, allow trace files to be annotated by <pid> so each qemu instance has
unique traces.

The trace file name can be passed as a config option:
--trace-file=/path/to/file
(Default: trace )
At runtime, the pid of the qemu process is appended to the filename so
that mutiple qemu instances do not have overlapping logs.

Eg : trace-1234 for qemu launched with pid 1234.

I have yet to test this on windows. getpid() is used at many places
in code(including vnc.c), so I'm hoping this would be okay too.

Edited-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Stefan Hajnoczi
1e2cf2bc45 trace: Support disabled events in trace-events
Sometimes it is useful to disable a trace event.  Removing the event
from trace-events is not enough since source code will call the
trace_*() function for the event.

This patch makes it easy to build without specific trace events by
marking them disabled in trace-events:

disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"

This builds without the multiwrite_cb trace event.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

trace: Allow bulk enabling/disabling of trace events at compile time

For 'simple' trace backend, allow bulk enabling/disabling of trace
events at compile time.  Trace events that are preceded by 'disable'
keyword are compiled in, but turned off by default. These can
individually be turned on using the monitor.  All other trace events are
enabled by default.

TODO :
This could be enhanced when the trace-event namespace is partitioned into a
group and an ID within that group. In such a case, marking a group as enabled
would automatically enable all trace-events listed under it.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Prerna Saxena
22890ab5e8 trace: Support for dynamically enabling/disabling trace events
This patch adds support for dynamically enabling/disabling of trace events.
This is done by internally maintaining each trace event's state, and
permitting logging of data from a trace event only if it is in an
'active' state.

Monitor commands added :
1) info trace-events 		: to view all available trace events and
				  their state.
2) trace-event NAME on|off 	: to enable/disable data logging from a
				  given trace event.
				  Eg, trace-event paio_submit off
				  	disables logging of data when
					paio_submit is hit.

By default, all trace-events are disabled. One can enable desired trace-events
via the monitor.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

trace: Monitor command 'info trace'

Monitor command 'info trace' to display contents of trace buffer

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

trace: Remove monitor.h dependency from simpletrace

User-mode targets don't have a monitor so the simple trace backend
currently does not build on those targets.  This patch abstracts the
monitor printing interface so there is no direct coupling between
simpletrace and the monitor.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Stefan Hajnoczi
26f7227bfe trace: Add simple built-in tracing backend
This patch adds a simple tracer which produces binary trace files.  To
try out the simple backend:

$ ./configure --trace-backend=simple
$ make

After running QEMU you can pretty-print the trace:

$ ./simpletrace.py trace-events trace.log

The output of simpletrace.py looks like this:

  qemu_realloc 0.699 ptr=0x24363f0 size=0x3 newptr=0x24363f0
  qemu_free 0.768 ptr=0x24363f0
  ^           ^---- timestamp delta (us)
  |____ trace event name

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

trace: Make trace record fields 64-bit

Explicitly use 64-bit fields in trace records so that timestamps and
magic numbers work for 32-bit host builds.

Includes fixes from Prerna Saxena <prerna@linux.vnet.ibm.com>.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Stefan Hajnoczi
94a420b170 trace: Add trace-events file for declaring trace events
This patch introduces the trace-events file where trace events can be
declared like so:

qemu_malloc(size_t size) "size %zu"
qemu_free(void *ptr) "ptr %p"

These trace event declarations are processed by a new tool called
tracetool to generate code for the trace events.  Trace event
declarations are independent of the backend tracing system (LTTng User
Space Tracing, ftrace markers, DTrace).

The default "nop" backend generates empty trace event functions.
Therefore trace events are disabled by default.

The trace-events file serves two purposes:

1. Adding trace events is easy.  It is not necessary to understand the
   details of a backend tracing system.  The trace-events file is a
   single location where trace events can be declared without code
   duplication.

2. QEMU is not tightly coupled to one particular backend tracing system.
   In order to support tracing across QEMU host platforms and to
   anticipate new backend tracing systems that are currently maturing,
   it is important to be flexible and not tied to one system.

This commit includes fixes from Prerna Saxena
<prerna@linux.vnet.ibm.com> and Blue Swirl <blauwirbel@gmail.com>.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00
Edgar E. Iglesias
ef9d48da59 microblaze: Add support for fcmp.un
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-09-09 22:05:48 +02:00
Stefan Weil
e403e433c1 elf: Calculate symbol size if needed
Symbols with a size of 0 are unusable for the disassembler.

Example:

While running an arm linux kernel, no symbolic names are
used in qemu.log when the cpu is executing an assembler function.

Assume that the size of such symbols is the difference to the
next symbol value.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-09 19:37:16 +00:00
Blue Swirl
d7d9b528b1 Fix OpenBSD build warning
Fix this warning:
  CC    savevm.o
/src/qemu/savevm.c: In function `do_savevm':
/src/qemu/savevm.c:1900: warning: passing arg 1 of `localtime_r' from incompatible pointer type

It looks like on OpenBSD the type of tv_sec in struct timeval is still
'long' instead of time_t as in most other OS. Fix by adding a cast.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-09 19:13:04 +00:00
Edgar E. Iglesias
b76da7e376 microblaze: User-mode emulation of hw-excp signals
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-09-09 10:24:01 +02:00
Edgar E. Iglesias
97694c57d7 microblaze: Add basic FPU emulation
Missing:
* fcmp.un insn
* Denormalized exceptions
* Exception model is not accurate

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-09-09 10:20:17 +02:00
Edgar E. Iglesias
bdc0bf29c6 microblaze: Add definitions for FSR reg fields
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-09-09 09:58:35 +02:00
Anthony Liguori
8b33d9eeba Revert "Make default invocation of block drivers safer (v3)"
This reverts commit 79368c81bf.

Conflicts:

	block.c

I haven't been able to come up with a solution yet for the corruption caused by
unaligned requests from the IDE disk so revert until a solution can be written.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-09-08 17:09:15 -05:00
Anthony Liguori
b19159e8b9 Revert "PPC: Qdev'ify e500 pci"
This reverts commit 13b7fdeffa.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-09-08 14:55:19 -05:00
Anthony Liguori
031c0c55bb Revert "PPC: Make e500 pci byte swap config data"
This reverts commit cfb207e643.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-09-08 14:54:58 -05:00
Anthony Liguori
53462f4aeb Merge remote branch 'agraf/ppc-next' into staging 2010-09-08 14:29:13 -05:00
Anthony Liguori
aab2e8f79a Merge remote branch 'kwolf/for-anthony' into staging 2010-09-08 14:26:57 -05:00
Anthony Liguori
dccbe6fbab Merge remote branch 'mst/for_anthony' into staging 2010-09-08 14:26:14 -05:00
Sripathi Kodi
630c26893d virtio-9p: Change handling of flags in open() path for 9P2000.L
This patch applies on top of 9P2000.L patches that we have on the list.
I took a look at how 9P server is handling open() flags in 9P2000.L path.
I think we can do away with the valid_flags() function and simplify the
code. The reasoning is as follows:

O_NOCTTY: (If the file is a terminal, don't make it the controlling
terminal of the process even though the process does not have a controlling
terminal) By the time the control reaches 9P client it is clear that what
we have is not a terminal device. Hence it does not matter what we do with
this flag. In any case 9P server can filter this flag out before making the
syscall.

O_NONBLOCK: (Don't block if i) Can't read/write to the file ii) Can't get
locks) This has an impact on FIFOs, but also on file locks. Hence we can
pass it down to the system call.

O_ASYNC: From the manpage:

   O_ASYNC
          Enable signal-driven I/O: generate a signal (SIGIO by default,  but
          this  can be changed via fcntl(2)) when input or output becomes pos-
          sible on this file descriptor.  This feature is only available  for
          terminals,  pseudo-terminals,  sockets,  and (since Linux 2.6) pipes
          and FIFOs.  See fcntl(2) for further details.

Again, this does not make any impact on regular files handled by 9P. Also,
we don't want 9P server to receive SIGIO. Hence I think 9P server can
filter this flag out before making the syscall.

O_CLOEXEC: This flag makes sense only on the client. If guest user space
sets this flag the guest VFS will take care of calling close() on the fd if
an exec() happens. Hence 9P client need not be bothered with this flag.
Also I think QEMU will not do an exec, but if it does, it makes sense to
close these fds. Hence we can pass this flag down to the syscall.

O_CREAT: Since we are in open() path it means we have confirmed that the file
exists. Hence there is no need to pass O_CREAT flag down to the system. In fact
on some versions of glibc this causes problems, because we pass O_CREAT flag,
but don't have permission bits. Hence we can just mask this flag out.

So in summary:

Mask out:
O_NOCTTY
O_ASYNC
O_CREAT

Pass-through:
O_NONBLOCK
O_CLOEXEC

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-09-08 22:58:40 +05:30
Arun R Bharadwaj
8f4d1ca58f [virtio-9p] This patch implements TLERROR/RLERROR on the qemu 9P server.
Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-09-08 22:58:40 +05:30
Arun R Bharadwaj
cf03eb2c18 [virtio-9p] Remove all instances of unnecessary dotu variable.
Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-09-08 22:58:40 +05:30
Aneesh Kumar K.V
9ed3ef26e6 virtio-9p: Add support for removing xattr
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:42 +05:30
Aneesh Kumar K.V
783f04e1d4 virtio-9p: Fix the memset usage
The arguments are wrong. Use qemu_mallocz directly

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:42 +05:30
Aneesh Kumar K.V
5c0f255dd4 virtio-9p: Use lchown which won't follow symlink
We should always use functions which don't follow
symlink on the server

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:42 +05:30
Aneesh Kumar K.V
12848bfc5d virtio-9p: Add SM_NONE security model
This is equivalent to SM_PASSTHROUGH security model.
The only exception is, failure of privilige operation like chown
are ignored. This makes a passthrough like security model usable
for people who runs kvm as non root

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:42 +05:30
Aneesh Kumar K.V
61b6c4994a virtio-9p: Hide user.virtfs xattr in case of mapped security.
With mapped security mode we use "user.virtfs" namespace is used
to store the virtFs related attributes. So hide it from user.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:42 +05:30
Aneesh Kumar K.V
10b468bdc5 virtio-9p: Implement TXATTRCREATE
TXATTRCREATE:  Prepare a fid for setting xattr value on a file system object.

 size[4] TXATTRCREATE tag[2] fid[4] name[s] attr_size[8] flags[4]
 size[4] RXATTRWALK tag[2]

txattrcreate gets a fid pointing to xattr. This fid can later be
used to get set the xattr value.

flag value is derived from set Linux setxattr. The manpage says
"The flags parameter can be used to refine the semantics of the operation.
XATTR_CREATE specifies a pure create, which fails if the named attribute
exists already. XATTR_REPLACE specifies a pure replace operation, which
fails if the named attribute does not already exist. By default (no flags),
the extended attribute will be created if need be, or will simply replace
the value if the attribute exists."

The actual setxattr operation happens when the fid is clunked. At that point
the written byte count and the attr_size specified in TXATTRCREATE should be
same otherwise an error will be returned.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2010-09-08 22:56:41 +05:30