1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00

mount-util: move fstype_is_network() and name_to_handle_at() definitions over

This commit is contained in:
Lennart Poettering 2015-10-27 13:45:00 +01:00
parent 5e524b404b
commit 4e036b7a96
8 changed files with 42 additions and 32 deletions

View File

@ -483,3 +483,26 @@ int mount_move_root(const char *path) {
return 0; return 0;
} }
bool fstype_is_network(const char *fstype) {
static const char table[] =
"afs\0"
"cifs\0"
"smbfs\0"
"sshfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"
"nfs4\0"
"gfs\0"
"gfs2\0"
"glusterfs\0";
const char *x;
x = startswith(fstype, "fuse.");
if (x)
fstype = x;
return nulstr_contains(table, fstype);
}

View File

@ -21,8 +21,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>. along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/ ***/
#include <stdbool.h> #include <fcntl.h>
#include <mntent.h> #include <mntent.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "missing.h"
int fd_is_mount_point(int fd, const char *filename, int flags); int fd_is_mount_point(int fd, const char *filename, int flags);
int path_is_mount_point(const char *path, int flags); int path_is_mount_point(const char *path, int flags);
@ -34,3 +39,12 @@ int mount_move_root(const char *path);
DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent); DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
#define _cleanup_endmntent_ _cleanup_(endmntentp) #define _cleanup_endmntent_ _cleanup_(endmntentp)
bool fstype_is_network(const char *fstype);
union file_handle_union {
struct file_handle handle;
char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
};
#define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ }

View File

@ -23,6 +23,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h>
#include <sys/vfs.h> #include <sys/vfs.h>
#include "macro.h" #include "macro.h"

View File

@ -125,29 +125,6 @@ size_t page_size(void) {
return pgsz; return pgsz;
} }
bool fstype_is_network(const char *fstype) {
static const char table[] =
"afs\0"
"cifs\0"
"smbfs\0"
"sshfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"
"nfs4\0"
"gfs\0"
"gfs2\0"
"glusterfs\0";
const char *x;
x = startswith(fstype, "fuse.");
if (x)
fstype = x;
return nulstr_contains(table, fstype);
}
void rename_process(const char name[8]) { void rename_process(const char name[8]) {
assert(name); assert(name);

View File

@ -66,8 +66,6 @@ static inline const char* one_zero(bool b) {
return b ? "1" : "0"; return b ? "1" : "0";
} }
bool fstype_is_network(const char *fstype);
noreturn void freeze(void); noreturn void freeze(void);
void execute_directories(const char* const* directories, usec_t timeout, char *argv[]); void execute_directories(const char* const* directories, usec_t timeout, char *argv[]);
@ -202,12 +200,6 @@ const char *personality_to_string(unsigned long);
uint64_t physical_memory(void); uint64_t physical_memory(void);
union file_handle_union {
struct file_handle handle;
char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
};
#define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ }
int update_reboot_param_file(const char *param); int update_reboot_param_file(const char *param);
#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)

View File

@ -36,6 +36,7 @@
#include "manager.h" #include "manager.h"
#include "mkdir.h" #include "mkdir.h"
#include "mount-setup.h" #include "mount-setup.h"
#include "mount-util.h"
#include "mount.h" #include "mount.h"
#include "parse-util.h" #include "parse-util.h"
#include "path-util.h" #include "path-util.h"

View File

@ -36,6 +36,7 @@
#include "formats-util.h" #include "formats-util.h"
#include "libudev-private.h" #include "libudev-private.h"
#include "missing.h" #include "missing.h"
#include "mount-util.h"
#include "socket-util.h" #include "socket-util.h"
#include "string-util.h" #include "string-util.h"

View File

@ -57,6 +57,7 @@
#include "macro.h" #include "macro.h"
#include "missing.h" #include "missing.h"
#include "mkdir.h" #include "mkdir.h"
#include "mount-util.h"
#include "parse-util.h" #include "parse-util.h"
#include "path-util.h" #include "path-util.h"
#include "rm-rf.h" #include "rm-rf.h"