summaryrefslogtreecommitdiffstats
path: root/daemon/daemon.h
Commit message (Collapse)AuthorAgeFilesLines
* daemon: count_strings function returns size_tRichard Jones2010-06-021-1/+1
| | | | (cherry picked from commit aee7d55fcf754d97d945c318ec06d6387ade067b)
* Code cleanups related to RHBZ#580246.Richard Jones2010-04-081-1/+1
| | | | | | | | | | | | | | | This includes various code cleanups: (a) A regression test for RHBZ#580246. (b) Use write instead of fwrite to write out the tar file. This is just because the error handling of write seems to be better specified and easier to use. (c) Use size_t instead of int for length. (d) Clearer debug messages when in verbose mode. (cherry picked from commit de7ef2a0fdcbcddfd35ecb8ee2804e1ca0968454)
* appliance: Set $PATH instead of hard-coding paths to binaries everywhere.Richard Jones2010-03-261-0/+2
| | | | | | Change the appliance so PATH includes common directories. Thus we don't need to hard-code paths to binaries (eg. "/sbin/fdisk") everywhere.
* daemon: Add a trim utility function.Richard Jones2010-03-181-0/+2
| | | | | This function trims the whitespace from around a string. It does this in-place, so it can be called for malloc'd strings.
* daemon: Don't need to prefix error messages with the command name.Richard Jones2010-02-121-1/+4
| | | | | | | | | | | | | | | | | | | | The RPC stubs already prefix the command name to error messages. The daemon doesn't have to do this. As a (small) benefit this also makes the daemon slightly smaller. Code in the daemon such as: if (argv[0] == NULL) { reply_with_error ("passed an empty list"); return NULL; } now results in error messages like this: ><fs> command "" libguestfs: error: command: passed an empty list (whereas previously you would have seen ..command: command:..)
* daemon error handling: Define a new function reply_with_perror_errno.Richard Jones2009-12-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows you to save the errno from a previous call and pass it to reply_with_perror. For example, original code: r = some_system_call (); err = errno; do_cleanup (); errno = err; if (r == -1) { reply_with_perror ("failed"); return -1; } can in future be changed to: r = some_system_call (); err = errno; do_cleanup (); if (r == -1) { reply_with_perror_errno (err, "failed"); return -1; }
* Whitespace change.Richard Jones2009-11-271-1/+1
|
* daemon: Move prototypes around to keep functions grouped logically.Richard Jones2009-11-261-3/+3
|
* sync: Windows implementation of sync() call.Richard Jones2009-11-251-0/+4
| | | | | Replace calls to sync() with calls to sync_disks() which supports Win32 via FlushFileBuffers.
* availability: Add optional groups and implement guestfs_available call.Richard Jones2009-11-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current groups are defined very conservatively using the following criteria: (a) Would be impossible to implement on Windows because of sheer architectural differences (eg: mknod). (b) Already optional (augeas, inotify). (c) Not currently optional but not implemented on older RHEL and Debian releases (ntfs-3g.probe, scrub, zerofree). The optional groups I've defined according to these criteria are: . augeas . inotify . linuxfsuuid . linuxmodules . linuxxattrs . lvm2 . mknod . ntfs3g . scrub . selinux . zerofree (Note that these choices don't prevent us from adding more optional groups in future. On the other hand to avoid breaking ABIs we would not wish to change the above groups). The rest of this large commit is really just implementation: Each optional function is classified using Optional "group" flag in the generator. The daemon has to implement a function int optgroup_<name>_available (void); for each optional group. Some of these functions are fixed at compile time, and some do simple run-time tests. The do_available implementation in the daemon looks up the correct function in a table and runs it. We document the optional groups in the guestfs(3) man page. Also: I added a NOT_AVAILABLE macro in order to unify all the existing places where we had a message equivalent to "function __func__ is not available".
* daemon/Win32: Use gnulib modules for first porting to Win32.Richard Jones2009-11-201-0/+1
|
* change strncmp() == 0 to STREQLEN()Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *== *0\b/STREQLEN$1/g'
* change strncmp(...) != 0 to STRNEQLEN(...)Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *!= *0/STRNEQLEN$1/g'
* define STREQ, STRNEQ, STREQLEN, STRCASEQ, etc.Jim Meyering2009-11-091-0/+10
| | | | | | * src/guestfs.h: Define STREQ and company. * daemon/daemon.h: Likewise. * hivex/hivex.h: Likewise.
* indent with spaces, not TABsJim Meyering2009-11-091-3/+3
| | | | | | | | | | | * HACKING: Expand indentation TABs. * configure.ac: Likewise. * daemon/daemon.h: Likewise. * daemon/guestfsd.c: Likewise. * fuse/guestmount.c: Likewise. * hivex/LICENSE: Likewise. * src/generator.ml: Likewise. * tools/virt-win-reg: Likewise.
* Fix prototype of commandv to match prototype of commandrv.Richard Jones2009-11-091-1/+1
|
* daemon: Add flags argument to command*() functions.Richard W.M. Jones2009-11-091-6/+15
| | | | | | | | | | | | | | | | This adds new variations of the command*() functions which take a 'flags' argument. Currently the only flag available is defined as follows: COMMAND_FLAG_FOLD_STDOUT_ON_STDERR: For broken external commands that send error messages to stdout (hello, parted) but that don't have any useful stdout information, use this flag to capture the error messages in the *stderror buffer. If using this flag, you should pass stdoutput as NULL because nothing could ever be captured in that buffer. This patch also adds some documentation for command*() function.
* Daemon: fix handling of errors from xread and xwrite.Richard Jones2009-09-171-2/+4
| | | | | | If xread or xwrite returns -1, that indicates an error and we should exit. Note that xread/xwrite has already printed the error message.
* daemon: diagnose socket write failureJim Meyering2009-08-201-1/+1
| | | | | | | | | * daemon/proto.c (send_chunk): Don't ignore socket-write error. * daemon/proto.c (send_file_end): Return "int", not void, so we can propagate send_chunk failure to caller. * daemon/daemon.h (send_file_end): Update prototype. * daemon/tar.c (do_tar_out, do_tgz_out): Update uses of send_file_end. * daemon/upload.c (do_download): Likewise.
* daemon.h: avoid warning about possible noreturn functionJim Meyering2009-08-171-1/+1
| | | | * daemon/daemon.h (main_loop): Use "noreturn" attribute.
* adjust const "**" pointers to avoid warningsJim Meyering2009-08-171-3/+3
| | | | | | Also, ... * src/generator.ml: Add DeviceList type, and propagate that change out to all calling/interface code.
* fix daemon.h's use of NEED_ROOT-in-#defineJim Meyering2009-08-131-1/+1
|
* update all NEED_ROOT usesJim Meyering2009-08-131-1/+1
| | | | | | run this command: git grep -l -w NEED_ROOT|xargs perl -pi -e \ 's/(NEED_ROOT) \((.*?)\)/$1 (return $2)/'
* s/NEED_ROOT_OR_IS_DEVICE/REQUIRE_ROOT_OR_RESOLVE_DEVICE/Jim Meyering2009-08-131-1/+1
|
* propagate semantic changes to NEED_ROOT, NEED_ROOT_OR_IS_DEVICEJim Meyering2009-08-131-8/+8
| | | | | | changing IS_DEVICE semantics leads to changing semantics of NEED_ROOT_OR_IS_DEVICE and NEED_ROOT, too. * daemon/daemon.h: Update definitions.
* convert the last few, manuallyJim Meyering2009-08-131-1/+1
|
* * daemon/daemon.h (RESOLVE_DEVICE): Rename from IS_DEVICE.Jim Meyering2009-08-131-3/+3
| | | | | Change parameter from "errcode" (which would be returned) to "fail_stmt" so that a caller can specify e.g., "goto done" upon failure.
* define ATTRIBUTE_UNUSEDJim Meyering2009-08-101-0/+10
| | | | * daemon/daemon.h (__attribute__, ATTRIBUTE_UNUSED): Define.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-2/+2
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Need to declare asprintf_nowarn as inline to avoid gcc complaining.Richard Jones2009-07-281-1/+1
|
* Replace shell_quote function with %Q and %R printf specifiers.Richard Jones2009-07-281-2/+16
| | | | | | | %Q => simple shell quoted string %R => path will be prefixed by /sysroot eg. snprintf (cmd, sizeof cmd, "cat %R", path); system (cmd);
* Make /sysroot path configurable.Richard Jones2009-07-181-3/+8
| | | | | | | | | Currently /sysroot is hard-coded throughout the daemon code. This patch turns the path into a variable so that we can change it in future, for example to allow standalone mode to be implemented. This patch was tested by running all the C API tests successfully.
* Generate structs and struct lists generically.Richard Jones2009-07-071-3/+3
| | | | | | | | | | | This modifies the way that struct and struct lists are generated (for return values) so that there is no need to add an explicit new type when adding a new structure. All tests pass, and the C API should be compatible. I have also inspected the changes that are made to the generated code by hand.
* Add list of function_names to the daemon.Richard W.M. Jones2009-07-021-0/+3
| | | | | Messages which include the proc_nr can now also include the name of the actual function being called.
* Call 'udevadm settle' after operations which add/remove device nodes.Richard W.M. Jones2009-07-011-0/+2
| | | | | | | | | | | | | Because udev operates asynchronously, we found errors which were caused by a previous command (eg. sfdisk or pvremove) creating or removing a device, and that change not having happened by the time the next command was run. This patch adds calls to '/sbin/udevadm settle' after any commands which can add or remove device nodes. If udev is not being used or not available, this should have no effect. The command fails and this is silently ignored.
* Make CHROOT_IN/OUT macros should loudly if the syscall fails.Richard Jones2009-06-221-4/+15
|
* Add strong note about deprecation of functions which take either device ↵Richard W.M. Jones2009-06-201-0/+6
| | | | names or filenames.
* Implement device name translation. Remove device name hacks in tests.Richard Jones2009-06-101-7/+8
|
* Refactor line splitting code in the daemon, and fix it so it works.Richard Jones2009-05-121-0/+2
|
* Add generated code for 'fsck' command.Richard Jones2009-04-301-0/+3
|
* catsprintf leaks, use open_memstream instead.Richard W.M. Jones2009-04-231-8/+0
|
* Implement extensible strings with catprintf.Richard W.M. Jones2009-04-231-0/+8
|
* Various fixes to the daemon:Richard Jones2009-04-201-4/+15
| | | | | | - make sure SIGPIPE doesn't kill us - warn not to use macros in FileIn functions - add shell_quote function
* Implement upload and download commands.Richard Jones2009-04-201-10/+19
|
* Implement NEED_ROOT_OR_IS_DEVICE macro.Richard Jones2009-04-191-0/+13
|
* Implement _send_sync, _send_file_sync and _receive_file_sync.Richard Jones2009-04-191-0/+7
|
* Rewrite of main loop impl, start of FileIn/FileOut support.Richard Jones2009-04-181-5/+20
|
* Added test suite.Richard Jones2009-04-111-3/+28
|
* CHROOT_OUT must preserve errno.Richard Jones2009-04-101-3/+7
|
* pvs/vgs/lvs commands working now.Richard Jones2009-04-071-0/+5
|