Files
libguestfs/generator
Nikolay Ivanets 94843f155a lib: add support for disks with 4096 bytes sector size
Nowadays there are hard drives and operating systems which support
"4K native" sector size.  In this mode physical and logical block size
exposed to the operating system is equal to 4096 bytes.

GPT partition table (as a known example) being created in this mode will
place GPT header at LBA1 which is 4096 bytes.  libguetfs is unable to
recognize partition table on such physical block devices or disk images.
The reason is that libguestfs appliance will look for a GPT header at
LBA1 which is seen at 512 byte offset.

In order to fix the issue we need a way to provide correct logical block
size for attached disks.  Fortunately QEMU and libvirt already provides
a way to specify physical/logical block size per disk basis.

After discussion in a mailing list we agreed that physical block size is
rarely used and is not so important.  Thus both physical and logical
block size will be set to the same value.

In this patch one more optional parameter 'blocksize' is added
to add_drive_opts API method.  Valid values are 512 and 4096.

add_drive_scratch has the same optional parameter for a consistency and
testing purpose.

add-domain and add_libvirt_dom will pass logical_block_size value from
libvirt XML to add_drive_opts method.
2020-02-11 15:20:09 +00:00
..
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-09-10 17:52:16 +02:00
2019-09-10 17:52:16 +02:00
2019-07-29 10:28:31 +01:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-04-23 18:08:19 +02:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-11-29 12:04:55 +01:00
2019-01-08 11:58:30 +00:00
2020-01-14 16:21:22 +01:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-07-29 10:28:31 +01:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2017-01-29 17:32:22 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00
2019-01-08 11:58:30 +00:00

This program generates a large amount of code and documentation for
all the daemon actions.

To add a new action there are only two files you need to change,
'actions_*.ml' to describe the interface, and daemon/<somefile>.c to
write the implementation.

After editing these files, build it (make -C generator) to regenerate
all the output files.  'make' will rerun this automatically when
necessary.

IMPORTANT: This program should NOT print any warnings at compile time
or run time.  If it prints warnings, you should treat them as errors.

OCaml tips:

(1) In emacs, install tuareg-mode to display and format OCaml code
correctly.  'vim' comes with a good OCaml editing mode by default.

(2) Read the resources at http://ocaml.org/learn/

(3) A module called 'Foo' is defined in one or two files called
'foo.mli' and 'foo.ml' (NB: lowercase first letter).  The *.mli file,
if present, defines the public interface for the module.  The *.ml
file is the implementation.  If the *.mli file is missing then
everything is exported.

Some notable files in this directory:

  actions_*.ml        The libguestfs API.
  proc_nr.ml          Procedure numbers associated with each API.
  structs.ml          Structures returned by the API.
  c.ml                Generate C API.
  <lang>.ml           Generate bindings for <lang>.
  main.ml             The main generator program.

Note about long descriptions:

When referring to another action, use the format C<guestfs_other>
(ie. the full name of the C function).  This will be replaced as
appropriate in other language bindings.  Apart from that, long
descriptions are just perldoc paragraphs.

Note about extending functions:

In general you cannot change the name, number of required arguments or
type of required arguments of a function, since this would break
backwards compatibility.

You may add another optional argument, *if* the function has >= 1
optional arguments already.  Add it at the end of the list.

You may add optional arguments to a function that doesn't have any.
However you *must* set the once_had_no_optargs flag to true, so that
the relevant backwards compatibility bindings can be added.