2019-07-01 18:54:39 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License v2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 021110-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BTRFS_PATH_UTILS_H__
|
|
|
|
#define __BTRFS_PATH_UTILS_H__
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2021-04-29 17:17:35 +00:00
|
|
|
#include <linux/limits.h>
|
2019-07-01 18:54:39 +00:00
|
|
|
|
2021-01-21 15:25:51 +00:00
|
|
|
char *path_canonicalize_dm_name(const char *ptname);
|
|
|
|
char *path_canonicalize(const char *path);
|
2019-07-01 18:54:39 +00:00
|
|
|
|
|
|
|
int arg_copy_path(char *dest, const char *src, int destlen);
|
2020-11-04 22:26:43 +00:00
|
|
|
int path_cat_out(char *out, const char *p1, const char *p2);
|
|
|
|
int path_cat3_out(char *out, const char *p1, const char *p2, const char *p3);
|
2019-07-01 18:54:39 +00:00
|
|
|
|
|
|
|
char *__strncpy_null(char *dest, const char *src, size_t n);
|
|
|
|
/* Helper to always get proper size of the destination string */
|
|
|
|
#define strncpy_null(dest, src) __strncpy_null(dest, src, sizeof(dest))
|
|
|
|
|
2019-07-01 19:29:43 +00:00
|
|
|
int path_is_block_device(const char *file);
|
2023-04-03 17:14:13 +00:00
|
|
|
int path_is_a_mount_point(const char *file);
|
2019-07-01 22:07:11 +00:00
|
|
|
int path_exists(const char *file);
|
2019-07-01 22:03:32 +00:00
|
|
|
int path_is_reg_file(const char *path);
|
2019-07-01 22:10:42 +00:00
|
|
|
int path_is_dir(const char *path);
|
2019-07-01 18:54:39 +00:00
|
|
|
int is_same_loop_file(const char *a, const char *b);
|
2019-07-01 22:09:21 +00:00
|
|
|
int path_is_reg_or_block_device(const char *filename);
|
2020-11-17 00:58:20 +00:00
|
|
|
int path_is_in_dir(const char *parent, const char *path);
|
2019-07-01 18:54:39 +00:00
|
|
|
|
|
|
|
int test_issubvolname(const char *name);
|
|
|
|
|
|
|
|
#endif
|