summaryrefslogtreecommitdiff
path: root/cmds-device.c
Commit message (Collapse)AuthorAge
* btrfs-progs: Remove write-only var fdres in cmd_dev_stats()Eric Sandeen2013-02-27
| | | | | | | fdres is initialized to -1, then later tested, but never set. Just remove it. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: simplify ioctl name copy and null terminationEric Sandeen2013-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | In the places where we copy a string into the name member of btrfs_ioctl_vol_args or btrfs_ioctl_vol_args_v2, we use strncopy (to not overflow the name array) and then set the last position to the null character. Howver, in both cases the arrays are defined with: char name[MAX+1]; hence the last array position is name[MAX]. In most cases, we now insert the null at name[MAX-1] which deprives us of one useful character. Even the above isn't consistent through the code, so make some helper code to make it simple, i.e. strncpy_null(dest, src) which automatically does the right thing based on the size of dest. Thanks to Zach Brown for the macro suggestion. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: check for open failure, don't closeZach Brown2013-02-05
| | | | | | | Check for failure by testing for a negative file descriptor, not a descriptor of 0. And if it failed we have nothing to close(). Signed-off-by: Zach Brown <zab@redhat.com>
* Btrfs-progs: add command to get/reset device stats via ioctlStefan Behrens2013-01-31
| | | | | | | | "btrfs device stats" is used to retrieve and print the device stats. "btrfs device stats -z" is used to atomically retrieve, reset and print the stats. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs-progs: add btrfs device ready commandJosef Bacik2013-01-23
| | | | | | | | | | | This command will be used by things like dracut that wish to know very simply if all of the devices have been added to the kernel cache yet for the device to be fully mounted. This keeps initrd's from constantly having to try to mount the file system until it succeeds every time a device is added to the system. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Gene Czarcinski <gene@czarc.net>
* Btrfs-progs: only enforce a maximum size if we specify oneJosef Bacik2012-10-02
| | | | | | | | | | | | | | My patch 04609add88ef8428d725de6ef60f46a3ff0dbc8e introduced a regression where if you mkfs'ed a group of disks with different sizes it limited the disks to the size of the first one that is specified. This was not the intent of my patch, I only want it to limit the size based on the -b option, so I've reworked the code to pass in a max block count and that fixes the issue. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
* avoid several strncpy-induced buffer overrunsJim Meyering2012-06-05
| | | | | | | | | | | | | | * restore.c (main): Ensure strncpy-copied dir_name is NUL-terminated. * btrfsctl.c (main): Likewise, for a command-line argument. * utils.c (multiple functions): Likewise. * btrfs-list.c (add_root): Likewise. * btrfslabel.c (change_label_unmounted): Likewise. * cmds-device.c (cmd_add_dev, cmd_rm_dev, cmd_scan_dev): Likewise. * cmds-filesystem.c (cmd_resize): Likewise. * cmds-subvolume.c (cmd_subvol_create, cmd_subvol_delete, cmd_snapshot): Likewise. Reviewed-by: Josef Bacik <josef@redhat.com>
* Btrfs-progs: allow multi-line command group synopsisIlya Dryomov2012-02-08
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: switch all existing commands to a new parserIlya Dryomov2012-02-03
| | | | | | | The new infrastructure offloads checking number of arguments passed to a command to individual command handlers. Fix them up accordingly. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: rearrange files in the repoIlya Dryomov2012-02-03
Separate every command group into its own file (cmds_<group>.c) and rearrange includes. Remove btrfs_cmds.c. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>