summaryrefslogtreecommitdiff
path: root/props.c
Commit message (Collapse)AuthorAge
* btrfs-progs: prop: convert error messages to use error()Satoru Takeuchi2016-05-11
| | | | | | | | props.c uses 'fprintf(stderr, "ERROR: ...")' as its error messages, however we have generic error() function. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use NULL instead of 0Byongho Lee2016-01-12
| | | | | | | Fix the code assigning 0 to pointer instead of NULL. Signed-off-by: Byongho Lee <bhlee.kernel@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Introduce change_header_uuid functionQu Wenruo2015-05-14
| | | | | | | | | | This function is used to change fsid and chunk_tree_uuid of a node/leaf. The function does it without transaction protection. This is the basis of offline uuid change. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use system attr instead of attr libraryDavid Sterba2014-11-19
| | | | | | | We use the attr version provided by system in other places already, now we can remove dependency on the separate attr library. Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: set string end sing '\0' for propertyLiu Bo2014-05-02
| | | | | | | | | | | Set string "xattr_name" 's end with '\0' so that it won't be violated in memory. With this fix, xfstest/btrfs/048 can pass on my box. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Filipe Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: allow compression property gets for read-only subvolumesFilipe David Borba Manana2014-05-02
| | | | | | | | | | | | Because the function open_file_or_dir() always opened the input file in read/write mode (O_RDWR), we were not able to due a compression property get against a file living in a read-only subvolume/snapshot. Fix this by opening the file with O_RDONLY mode if we're doing a property get. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Fix the return value when executing 'btrfs prop get' on an ↵Qu Wenruo2014-04-22
| | | | | | | | | | | | | | uncompressed file When executing 'btrfs prop get' on a file which is not compressed, return value will always be 50 since prop_compress() return -ENOATTR. But the codes have already check the errno to avoid unnecessary error message, so the return value should also set to 0. Signed-off-by: Qu Wenruo <quwenro@cn.fujitsu.com> Reviewed-by: Filipe Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add support for the compression propertyFilipe David Borba Manana2014-01-31
| | | | | | | | | | | | | | | | | With this property, one can enable compression for individual files without the need to mount the filesystem with the compress or compress-force options, and specify the compression algorithm. When applied against a directory, files created under that directory will inherit the compression property. This requires the corresponding kernel patch, which adds the support for setting and getting properties and implements the compression property. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: add type root to label propertyFilipe David Borba Manana2014-01-31
| | | | | | | | | | | | | | | | | | | | | | So that we can get the label of a mounted filesystem. Before this change: $ btrfs prop get /mnt/btrfs label ERROR: object is not compatible with property $ btrfs prop get /dev/sdb3 label ERROR: dev /dev/sdb3 is mounted, use mount point ERROR: failed to set/get property for object. After this change: $ btrfs prop get /mnt/btrfs label label=foobar Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: introduce btrfs property subgroupAlexander Block2014-01-31
"btrfs filesystem property" is a generic interface to set/get properties on filesystem objects (inodes/subvolumes/filesystems /devs). This patch adds the generic framework for properties and also implements two properties. The first is the read-only property for subvolumes and the second is the label property for devices. Signed-off-by: Alexander Block <ablock84@googlemail.com> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>