summaryrefslogtreecommitdiffstats
path: root/daemon/ext2.c
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Always pass -F option to mke2fs.Richard W.M. Jones2012-06-121-6/+6
| | | | | | | | | | Apparently e2fsprogs only knows that "/dev/sda" is a whole device, but doesn't think that "/dev/vda" is. On switching the default device over to virtio-scsi, that causes mke2fs without -F option to complain and ask for an interactive prompt. Adding -F forces it to go ahead anyway. This caused several less-used APIs to break with virtio-scsi.
* New APIs for reading and writing ext2 file attributes and file generation.Richard W.M. Jones2012-04-131-1/+193
| | | | | | | | | | | | The new APIs are: get-e2attrs: List ext2 file attributes of a file. set-e2attrs: Set or clear ext2 file attributes of a file. get-e2generation: Get ext2 file generation of a file. set-e2generation: Set ext2 file generation of a file. These are implemented using the lsattr and chattr programs from e2fsprogs.
* Replace 'int' with 'size_t' passim.Richard W.M. Jones2012-03-131-3/+3
| | | | | Analyze all uses of 'int' in the code, and replace with 'size_t' where appropriate.
* daemon: Implement a growable strings buffer type.Richard W.M. Jones2012-03-131-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | Previously a lot of daemon code used three variables (a string list, 'int size' and 'int alloc') to track growable strings buffers. This commit implements a simple struct containing the same variables, but using size_t instead of int: struct stringsbuf { char **argv; size_t size; size_t alloc; }; Use it like this: DECLARE_STRINGSBUF (ret); //... if (add_string (&ret, str) == -1) return NULL; //... if (end_stringsbuf (&ret) == -1) return NULL; return ret.argv;
* resize2fs: Run 'e2fsck -f' automatically if filesystem is not mounted.Richard W.M. Jones2012-03-091-0/+37
|
* e2fsck: Comment, whitespace, error message cleanups.Richard W.M. Jones2012-03-091-2/+2
|
* Revert "ext2: tweak the error returned message of resize2fs-M(BZ755729)"Richard W.M. Jones2012-03-091-4/+1
| | | | This reverts commit 0eaf06e673833bc25673d5c3d2487fffae310285.
* New API: set-label, for setting a label on any filesystem.Richard W.M. Jones2012-02-271-25/+1
| | | | | | Currently only ext2/3/4 and (newly) NTFS are supported. This change also deprecates set-e2label.
* resize2fs-M: fix double-free along error path (thanks Matthew Booth).Richard W.M. Jones2012-01-161-4/+2
|
* e2fsck-f: change the internal to use e2fsckWanlong Gao2012-01-131-21/+7
| | | | | | | | Since we implement the new api e2fsck, just change the internal of e2fsck_f to use e2fsck now. v1->v2: use optargs_bitmask Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* NEW API: add a new api e2fsckWanlong Gao2012-01-131-0/+49
| | | | | | | | | | | | | | m: Wanlong Gao <gaowanlong@cn.fujitsu.com> Add a new api e2fsck with two options: correct: same as '-p' option of e2fsck forceall: same as '-y' option of e2fsck Thanks for Rich's idea. v1->v2: use optargs_bitmask v2->v3: change the optargs_bitmask check Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* ext2: tweak the error returned message of resize2fs-M(BZ755729)Wanlong Gao2012-01-131-2/+7
| | | | | | | Tweak the error message "e2fsck -f" and "e2fsck -fy". Indicate the user to use the correct and/or forceall options. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* New API: Bind the tune2fs command.Richard W.M. Jones2011-11-111-0/+149
| | | | | | | | | | | | | Previously we bound the 'tune2fs -l' command so that we could list out the tunables of an ext2/3/4 filesystem. Also commands like set_e2label and set_e2uuid used tune2fs. This commit binds many of the tunables that can be set using tune2fs. The coverage is not complete, but we can add more later because this uses optional parameters so the call is extensible without breaking ABI. The current change gives us enough for using libguestfs within OpenStack.
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.Richard W.M. Jones2011-03-251-1/+1
| | | | | Notes: Labels: cleanup, forcestable Depends: 227bea6c7ef89b707fe2c01c4d0d0fb9081e8c04
* New API: resize2fs-M to resize ext2/3/4 to minimum size.Nikita A Menkovich2011-01-141-0/+21
|
* daemon: Don't use ../src path to include generator_protocol.hRichard W.M. Jones2010-11-031-1/+1
| | | | | This file is already hard-linked into the current directory, so the relative path is not required.
* daemon: Limit label lengths (RHBZ#597118).Richard Jones2010-06-021-0/+21
|
* Fix and deprecate get_e2label and get_e2uuid (RHBZ#597112).Richard Jones2010-06-011-82/+2
| | | | | | | | | Fix these calls (see description in RHBZ#597112), but also deprecate them since the new calls vfs_label and vfs_uuid can work on any filesystem type. This also adds a regression test for the original bug reported in RHBZ#597112.
* New API: resize2fs-size to allow shrinking ext2 filesystems (RHBZ#585221).Richard Jones2010-05-211-0/+36
|
* appliance: Set $PATH instead of hard-coding paths to binaries everywhere.Richard Jones2010-03-261-15/+15
| | | | | | Change the appliance so PATH includes common directories. Thus we don't need to hard-code paths to binaries (eg. "/sbin/fdisk") everywhere.
* Fix lvresize test on RHEL 5, by fixing guestfs_e2fsck_l.Richard Jones2010-03-241-2/+9
| | | | | | | | | The problem is that mkfs was making an ext2 filesystem, which later we were checking with e4fsck. e4fsck corrects an "error" on the filesystem: /dev/VG/LV: Adding dirhash hint to filesystem. e4fsck returns 1 (errors corrected) which we were interpreting as an error return.
* Use ext4 dev tools on RHEL 5 (RHBZ#576688).Richard Jones2010-03-241-51/+85
|
* daemon: Don't need to prefix error messages with the command name.Richard Jones2010-02-121-15/+15
| | | | | | | | | | | | | | | | | | | | 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: Missing #includes revealed by cross-compiling.Richard Jones2009-11-201-0/+1
|
* use STREQ, not strcmp: part 1Jim Meyering2009-11-091-3/+3
| | | | | git grep -l 'strcmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
* 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'
* avoid use of all ctype macrosJim Meyering2009-09-241-4/+4
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
* mke2fs: Use e4fsprogs programs if available.Richard W.M. Jones2009-08-191-3/+46
| | | | | | | On RHEL 5, mke2fs is ancient, and there is a non-standard "mke4fs" binary which acts like the more recent mke2fs on Fedora. Since there are several annoyances and actual bugs in the ancient RHEL 5 mke2fs, use mke4fs instead if it's available.
* indent with spaces, not TABsJim Meyering2009-08-171-17/+17
|
* New commands: mkfs-b, mke2journal*, mke2fs-J*Richard W.M. Jones2009-08-151-0/+149
| | | | | | | | | | mkfs-b: Pass the -b (blocksize) parameter to mkfs. mke2journal and friends: Lets you create external ext2 journals on devices. mke2fs-J and friends: Lets you create ext2/3/4 filesystems with external journals.
* generator.ml: use new "Pathname" designationJim Meyering2009-08-131-7/+7
| | | | | | | | | | Nearly every file-related function in daemons/*.c is affected: Remove this pair of statements from each affected do_* function: - NEED_ROOT (return -1); - ABS_PATH (dir, return -1); and change the type of the corresponding parameter to "const char *". * src/generator.ml: Emit NEED_ROOT just once, even when there are two or more Pathname args.
* * src/generator.ml: Change all `String "device"' to `Device "device"'.Jim Meyering2009-08-131-14/+0
| | | | | | | | | | | | | | | | | | | | | Then update each affected function, removing each uses of RESOLVE_DEVICE, now that it's generated in caller from stub.c. * daemon/blockdev.c (call_blockdev): Remove use of RESOLVE_DEVICE. * daemon/devsparts.c (do_mkfs): Likewise. * daemon/ext2.c (do_e2fsck_f, do_get_e2label, do_get_e2uuid): Likewise. (do_resize2fs, do_set_e2label, do_set_e2uuid, do_tune2fs_l): Likewise. * daemon/fsck.c (do_fsck): Likewise. * daemon/grub.c (do_grub_install): Likewise. * daemon/lvm.c (do_lvremove, do_pvcreate, do_pvremove): Likewise. (do_pvresize): Likewise. * daemon/mount.c (do_mount_vfs): Likewise. * daemon/ntfs.c (do_ntfs_3g_probe): Likewise. * daemon/scrub.c (do_scrub_device): Likewise. * daemon/sfdisk.c (sfdisk, sfdisk_flag): Likewise. * daemon/swap.c (do_mkswap, do_mkswap_L, do_mkswap_U): Likewise. (do_swapoff_device, do_swapon_device): Likewise. * daemon/zero.c (do_zero): Likewise. * daemon/zerofree.c (do_zerofree): Likewise.
* change almost all uses: s/IS_DEVICE/RESOLVE_DEVICE/Jim Meyering2009-08-131-7/+7
| | | | | | Use this command: git grep -l -w IS_DEVICE|xargs perl -pi -e \ 's/\b(?:IS_DEVICE)\b( \(.*?,) (.*?)\)/RESOLVE_DEVICE$1 return $2)/'
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-16/+16
| | | | | | | | | | | 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 : $_'
* remove trailing blanksJim Meyering2009-07-031-1/+1
|
* In the daemon, change all const char * parameters to char *.Richard Jones2009-06-101-7/+7
|
* Add IS_DEVICE checks for all calls which take a device parameter.Richard Jones2009-06-101-0/+8
|
* Add e2fsck_f command, and modify lvresize test to use it (RHBZ 502018).Richard Jones2009-05-211-0/+19
|
* Add: lvresize, resize2fs commands.Richard Jones2009-05-181-0/+19
|
* Rename tune2fs.c -> ext2.cRichard Jones2009-04-301-0/+236