summaryrefslogtreecommitdiff
path: root/ioctl.h
Commit message (Collapse)AuthorAge
* btrfs-progs: ioctl: add 64bit compat for SENDDavid Sterba2016-10-24
| | | | | | | | | | | | | | | | The ioctl value of SEND will be different on 32bit userspace and 64bit kernel due to different pointer type width, that unfortunatelly made it into the structure definition. To maintain backward compatibility, we must do it in the 64bit->32bit way, because we don't have the kernel side workardound like SET_RECEIVED_SUBVOL has. Changing value of SEND would then break existing users of the raw ioctl. The compatibility structure and ioctl should not be used, exists for documentation, and testing. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: ioctl: add 32bit compat for SET_RECEIVED_SUBVOLDavid Sterba2016-10-24
| | | | | | | | | | | | The ioctl value of SET_RECEIVED_SUBVOL will be different on 32bit userspace and 64bit kernel. This is transparently handled on the kernel side. We now define the same structure so we can verify the ioctl value. The defined structure and ioctl should not be used. It is exists only for testing purposes, documenting the mess and as a warning for the future. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add build-time checks for size of ioctl structuresDavid Sterba2016-10-05
| | | | | | | All structures that become part of ioctl definition must never change size. Add the build time checks for that. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use the correct struct for BTRFS_IOC_LOGICAL_INOHans van Kranenburg2016-07-04
| | | | | | | | | | | | | | BTRFS_IOC_LOGICAL_INO takes a btrfs_ioctl_logical_ino_args as argument, not a btrfs_ioctl_ino_path_args. The lines were probably copy/pasted when the code was written. Since btrfs_ioctl_logical_ino_args and btrfs_ioctl_ino_path_args have the same size, the actual IOCTL definition here does not change. But, it makes the code less confusing for the reader. Signed-off-by: Hans van Kranenburg <hans.van.kranenburg@mendix.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix unknown type name 'u64' in gccgoJulio Montes2016-03-31
| | | | | Signed-off-by: Julio Montes <imc.coder@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce device delete by devidAnand Jain2016-03-14
| | | | | | | | | | | | | | | | | | | | | | | | This patch introduces new option <devid> for the command btrfs device delete <device_path|devid>[..] <mnt> In a user reported issue on a 3-disk-RAID1, one disk failed with its SB unreadable. Now with this patch user will have a choice to delete the device using devid. The other method we could do, is to match the input device_path to the available device_paths with in the kernel. But that won't work in all the cases, like what if user provided mapper path when the path within the kernel is a non-mapper path. This patch depends on the below kernel patch for the new feature to work, however it will fail-back to the old interface for the kernel without the patch Btrfs: Introduce device delete by devid Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extend balance args to take min/max usage filterDavid Sterba2016-01-12
| | | | | | | | | | | Add the overlapping usage and [usage_min, usage_max] members to the balance args. The min/max values are interpreted iff the corresponding flag BTRFS_BALANCE_ARGS_USAGE_RANGE is set. The minimum boundary is inclusive, maximum is exclusive: * usage_min <= chunk_usage < usage_max Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: balance: add stripes filterGabríel Arthúr Pétursson2016-01-12
| | | | | | | | | | | | Add new balance filter 'stripes=<range>' to process only chunks that are spread accross given number of chunks. The range minimum and maximum are inclusive. Signed-off-by: Gabríel Arthúr Pétursson <gabriel@system.is> [ reworked a bit to use the range helpers, dropped the single value for stripes ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: extend balance args to take min/max limit filterDavid Sterba2016-01-12
| | | | | | | | | | | | | Add the overlapping limit and [limit_min, limit_max] members to the balance args. The min/max values are interpreted iff the corresponding flag BTRFS_BALANCE_ARGS_LIMIT_RANGE is set. The minimum and maximum are inclusive. Note that the values are only 32bit, but this should be enough for the foreseeable future. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add missing includes to header filesDavid Sterba2015-06-10
| | | | | | | Add includes that let the header files compile or add explicit include of kerncompat if the uXX types are used. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add btrfs_ioctl_feature_flags structDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: update btrfs_ioctl_fs_info_argsDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: update type annotationsDavid Sterba2015-06-03
| | | | | | Add the __user annotations to pointers in structures. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add send flag maskDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: add EXTENT_SAME ioctl and structuresDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: copy commented version of balance structuresDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h, no-op change. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: copy commented version of scrub_progress structureDavid Sterba2015-06-03
| | | | | | Copied from uapi/linux/btrfs.h, no-op change. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: ioctl.h: reorder to match kernel uapi headerDavid Sterba2015-06-03
| | | | | | | This is a no-op change, move the code that also exists in the uapi/linux/btrfs.h header. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: unify header file inclusion protectionsDavid Sterba2015-01-21
| | | | | | There are missing ifdefs or defines with very generic names. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: basic support for TREE_SEARCH_V2 ioctlDavid Sterba2014-12-10
| | | | | | Add the interface and helper that checks if the v2 ioctl is supported. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add new dev replace resultEryu Guan2014-11-25
| | | | | | | | | | | A new dev replace result was introduced by kernel commit Btrfs: return failure if btrfs_dev_replace_finishing() failed Make the userspace know about the new result too. Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: only report internal dev replace result if there's a resultEryu Guan2014-11-03
| | | | | | | | | | | | | | | | | | If BTRFS_IOC_DEV_REPLACE ioctl failed, args.result usually won't be updated by the ioctl. And the arg has been initialized with 0, the result is always 0, which is BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR, and the resulting error message looks confusing: ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": No such file or directory, no error But in case there's an internal result returned in future, don't drop the result completely, instead print dev replace result message only if the result is updated by a failed ioctl call. Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: balance filter: add limit of processed chunksDavid Sterba2014-08-22
| | | | | | | | | | | | | | | Add more control to the balance behaviour. Usage filter may not be finegrained enough and can lead to moving too many chunks at once. Another example use is in connection with drange+devid or vrange filters that allow to work with a specific chunk or even with a chunk on a given device. The limit filter applies last, the value of 0 means no limiting. CC: Ilya Dryomov <idryomov@gmail.com> CC: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: correct prompt of minimal num of devs for raid56Gui Hecheng2014-04-11
| | | | | | | | | For btrfs, Raid5 can't go below 2 devs, not 3; Raid6 can't go below 3 devs, not 4. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: use the correct integer type for ioctlArvin Schnell2014-03-21
| | | | | | Signed-off-by: Arvin Schnell <aschnell@suse.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* ioctl: add note regarding CLONE_RANGE(len=0) behaviourDavid Disseldorp2014-03-21
| | | | | | | | | | | | A BTRFS_IOC_CLONE_RANGE request with a src_length value of zero has the effect of cloning all data from src_offset through to end-of-file. Document this behaviour in the header file for those who (like me) incorrectly assume that no data is cloned in such a case. Signed-off-by: David Disseldorp <ddiss@suse.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: sync-up with newly introduced ioctl numberAnand Jain2014-01-31
| | | | | | | | | | for now the manual sync up of new ioctls introduced in the btrfs kernel. For which there wasn't any btrfs-progs patch. however we might have better idea for the long run. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: add options to set commit mode after subvol deleteDavid Sterba2014-01-31
| | | | | | | | | | | | | | | | | | Subvolume deletion does not do a full transaction commit. This can lead to an unexpected result when the system crashes between deletion and commit, the subvolume directory will appear again. Add options to request filesystem sync after each deleted subvolume or after the last one. If the command with --commit option finishes succesfully, the subvolume(s) deletion status is safely stored on the media. Userspace approach is more flexible than in-kernel. Related discussions: http://www.spinics.net/lists/linux-btrfs/msg22088.html http://www.spinics.net/lists/linux-btrfs/msg27240.html CC: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fix typo in btrfs_err_str()Wang Shilong2013-10-16
| | | | | | | | | Raid5 and raid6 at least need three and foure devices respectively, fix it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: added "btrfs quota rescan" -w switch (wait)Jan Schmidt2013-09-03
| | | | | | | | | | With -w one can wait for a rescan operation to finish. It can be used when starting a rescan operation or later to wait for the currently running rescan operation to finish. Waiting is interruptible. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: device delete to get errors from the kernelAnand Jain2013-08-09
| | | | | | | | | | | | | | | | | | when user runs command btrfs dev del the raid requisite error if any goes to the /var/log/messages, its not good idea to clutter messages with these user (knowledge) errors, further user don't have to review the system messages to know problem with the cli it should be dropped to the user as part of the cli return. to bring this feature created a set of the ERROR defined BTRFS_ERROR_DEV* error codes and created their error string. I expect this enum to be added with other error which we might want to communicate to the user land Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add send option for using new end-cmd semanticStefan Behrens2013-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a command line option to enable sending streams which make use of the new end-cmd semantic if multiple snapshots are sent back-to-back. The goal is to use the <end cmd> as an indication to stop reading the input stream. So far, the receiver could only use EOF to recognize the end. If the new command line option '-e' is set, this commit requires a kernel which is able to support the new flags in the send ioctl. New bits in the flags of the send ioctl will be set which cause EINVAL on old kernels. However, if the option '-e' is not set, it works with old and new kernels without any errors or any changed behavior. This used to be the encoding (with 2 snapshots in this example): <stream header> + <sequence of commands> + <end cmd> + <stream header> + <sequence of commands> + <end cmd> + EOF The new format (if the two new flags are used) is this one: <stream header> + <sequence of commands> + <sequence of commands> + <end cmd> Note that the currently existing receivers treat <end cmd> only as an indication that a new <stream header> is following. This means, you can just skip the sequence <end cmd> <stream header> without loosing compatibility. As long as an EOF is following, the currently existing receivers handle the new format (if the two new flags are used) exactly as the old one. Also note that the kernel interface was changed in a way that is backward compatible to old btrfs-progs tools. You set one or two bits in the flags field of the ioctl to enable the new behavior. Old tools set these flags to zero, thus getting exactly the same as they got with older kernels. And this is exactly what happens if the new '-e' option is not set, the new bits in the flags are not set and thus old kernels and new kernels are both supported. So what is the benefit of this change? The goal is to be able to use a single stream (one TCP connection) to multiplex a request/response handshake plus Btrfs send streams, all in the same stream. In this case you cannot evaluate an EOF condition as an end of the Btrfs send stream. You need something else, and the <end cmd> is just perfect for this purpose. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: fixup: add flags to struct btrfs_ioctl_quota_rescan_argsJan Schmidt2013-05-10
| | | | | | | | | The patch set previously sent was sent together with the kernel part, but was not updated as I added some reserved bytes to the ioctl struct for future compatibility. This fixes struct btrfs_ioctl_quota_rescan_args. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: quota rescanJan Schmidt2013-04-23
| | | | | | | | This adds the quota rescan command to be used if qgroup tracking should get out of sync. Can also be used to query the status of a running rescan operation. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
* Btrfs-progs: Change the label of a mounted file systemJeff Liu2013-02-26
| | | | | | | | With this new ioctl(2), we can set/change the label for a mounted file system. It still does normal process for an umounted file system. Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Anand Jain <anand.jain@oracle.com>
* btrfs-progs: make libbtrfs usable from C++Arvin Schnell2013-02-19
| | | | | | | | Please find attached a patch to make the new libbtrfs usable from C++ (at least for the parts snapper will likely need). Signed-off-by: Arvin Schnell <aschnell@suse.de> Signed-off-by: Mark Fasheh <mfasheh@suse.de>
* btrfs-progs: Add support for BTRFS_SEND_FLAG_NO_FILE_DATAMark Fasheh2013-02-12
| | | | | | | | | | | The flag and command are synced from kernel to user. Also, this patch adds a callback for the BTRFS_SEND_C_UPDATE_EXTENT in struct btrfs_send_ops. read_and_process_cmd() is updated to decode BTRFS_SEND_C_UPDATE_EXTENT and send the values through the right callback. I did not add a callback definition to cmds-receive.c as that code never uses BTRFS_SEND_FLAG_NO_FILE_DATA. Signed-off-by: Mark Fasheh <mfasheh@suse.de>
* Btrfs-progs: add support for device replace procedureStefan Behrens2013-01-31
| | | | | | | | | | | This is the user mode part of the device replace patch series. The command group "btrfs replace" is added with three commands: - btrfs replace start srcdev|srcdevid targetdev [-Bfr] mount_point - btrfs replace status mount_point [-1] - btrfs replace cancel mount_point Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* 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: quota groups supportArne Jansen2012-09-04
| | | | | Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Arne Jansen <sensille@gmx.net>
* Btrfs-progs: update ioctl.h to support btrfs send ioctlAlexander Block2012-07-26
| | | | | | Add btrfs_ioctl_send_args and BTRFS_IOC_SEND to ioctl.h Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: update btrfs-progs for subvol uuid+times supportAlexander Block2012-07-26
| | | | | | Update ctree.h and ioctl.h for the new uuid+times for subvolumes. Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: update ioctl.h to support clone range ioctlAlexander Block2012-07-26
| | | | | | | Added missing btrfs_ioctl_clone_range_args and BTRFS_IOC_CLONE_RANGE to ioctl.h Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: add BTRFS_IOC_SUBVOL_GET/SETFLAGS to ioctl.hAlexander Block2012-07-26
| | | | | | | | Btrfs send/receive and btrfs props needs this ioctl. This patch requires a recent kernel with the "Btrfs: use _IOR for BTRFS_IOC_SUBVOL_GETFLAGS" patch applied. Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: add restriper headersIlya Dryomov2012-02-03
| | | | | | Add restriper headers and update print-tree.c Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: added ioctls and commands to resolve inodes and logical addrsJan Schmidt2011-11-02
| | | | | | | | | two new commands that make use of the new path resolving functions implemented for scrub, doing the resolving in-kernel. the result for both commands is a list of files belonging to that inode / logical address. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-progs: scrub ioctlsJan Schmidt2011-10-25
| | | | | | | | | - scrub structs added - ioctls for scrub - BTRFS_FSID_SIZE moved Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
* Added support for an additional ioctl.Andreas Philipp2011-10-25
| | | | | | | | Added BTRFS_IOC_SNAP_CREATE_V2 and struct btrfs_ioctl_vol_args_v2 as defined in fs/btrfs/ioctl.h in the kernel sources. Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>