projects
/
project
/
fstools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libfstools: support file paths longer than 255 chars
[project/fstools.git]
/
block.c
diff --git
a/block.c
b/block.c
index
d5c3937
..
ab130b9
100644
(file)
--- a/
block.c
+++ b/
block.c
@@
-530,6
+530,7
@@
static void cache_load(int mtd)
_cache_load("/dev/hd*");
_cache_load("/dev/md*");
_cache_load("/dev/vd*");
_cache_load("/dev/hd*");
_cache_load("/dev/md*");
_cache_load("/dev/vd*");
+ _cache_load("/dev/xvd*");
_cache_load("/dev/mapper/*");
}
_cache_load("/dev/mapper/*");
}
@@
-708,6
+709,7
@@
static void check_filesystem(struct probe_info *pr)
const char *e2fsck = "/usr/sbin/e2fsck";
const char *f2fsck = "/usr/sbin/fsck.f2fs";
const char *dosfsck = "/usr/sbin/dosfsck";
const char *e2fsck = "/usr/sbin/e2fsck";
const char *f2fsck = "/usr/sbin/fsck.f2fs";
const char *dosfsck = "/usr/sbin/dosfsck";
+ const char *btrfsck = "/usr/bin/btrfsck";
const char *ckfs;
/* UBIFS does not need stuff like fsck */
const char *ckfs;
/* UBIFS does not need stuff like fsck */
@@
-720,6
+722,8
@@
static void check_filesystem(struct probe_info *pr)
ckfs = f2fsck;
} else if (!strncmp(pr->type, "ext", 3)) {
ckfs = e2fsck;
ckfs = f2fsck;
} else if (!strncmp(pr->type, "ext", 3)) {
ckfs = e2fsck;
+ } else if (!strncmp(pr->type, "btrfs", 5)) {
+ ckfs = btrfsck;
} else {
ULOG_ERR("check_filesystem: %s is not supported\n", pr->type);
return;
} else {
ULOG_ERR("check_filesystem: %s is not supported\n", pr->type);
return;
@@
-735,6
+739,9
@@
static void check_filesystem(struct probe_info *pr)
if(!strncmp(pr->type, "f2fs", 4)) {
execl(ckfs, ckfs, "-f", pr->dev, NULL);
exit(-1);
if(!strncmp(pr->type, "f2fs", 4)) {
execl(ckfs, ckfs, "-f", pr->dev, NULL);
exit(-1);
+ } else if(!strncmp(pr->type, "btrfs", 5)) {
+ execl(ckfs, ckfs, "--repair", pr->dev, NULL);
+ exit(-1);
} else {
execl(ckfs, ckfs, "-p", pr->dev, NULL);
exit(-1);
} else {
execl(ckfs, ckfs, "-p", pr->dev, NULL);
exit(-1);
@@
-1045,8
+1052,8
@@
static int mount_device(struct probe_info *pr, int type)
err = handle_mount(pr->dev, target, pr->type, m);
if (err)
err = handle_mount(pr->dev, target, pr->type, m);
if (err)
- ULOG_ERR("mounting %s (%s) as %s failed (%d) - %
s
\n",
- pr->dev, pr->type, target, errno
, strerror(errno)
);
+ ULOG_ERR("mounting %s (%s) as %s failed (%d) - %
m
\n",
+ pr->dev, pr->type, target, errno);
else
handle_swapfiles(true);
return err;
else
handle_swapfiles(true);
return err;
@@
-1064,8
+1071,8
@@
static int mount_device(struct probe_info *pr, int type)
err = handle_mount(pr->dev, target, pr->type, NULL);
if (err)
err = handle_mount(pr->dev, target, pr->type, NULL);
if (err)
- ULOG_ERR("mounting %s (%s) as %s failed (%d) - %
s
\n",
- pr->dev, pr->type, target, errno
, strerror(errno)
);
+ ULOG_ERR("mounting %s (%s) as %s failed (%d) - %
m
\n",
+ pr->dev, pr->type, target, errno);
else
handle_swapfiles(true);
return err;
else
handle_swapfiles(true);
return err;
@@
-1097,8
+1104,8
@@
static int umount_device(struct probe_info *pr)
err = umount2(mp, MNT_DETACH);
if (err)
err = umount2(mp, MNT_DETACH);
if (err)
- ULOG_ERR("unmounting %s (%s) failed (%d) - %
s
\n",
- pr->dev, mp, errno
, strerror(errno)
);
+ ULOG_ERR("unmounting %s (%s) failed (%d) - %
m
\n",
+ pr->dev, mp, errno);
else
ULOG_INFO("unmounted %s (%s)\n",
pr->dev, mp);
else
ULOG_INFO("unmounted %s (%s)\n",
pr->dev, mp);
@@
-1127,8
+1134,8
@@
static int mount_action(char *action, char *device, int type)
err = umount2(mount_point, MNT_DETACH);
if (err)
err = umount2(mount_point, MNT_DETACH);
if (err)
- ULOG_ERR("umount of %s failed (%d) - %
s
\n",
- mount_point, errno
, strerror(errno)
);
+ ULOG_ERR("umount of %s failed (%d) - %
m
\n",
+ mount_point, errno);
free(mount_point);
return 0;
free(mount_point);
return 0;
@@
-1353,8
+1360,8
@@
static int check_extroot(char *path)
if (stat(tag, &s)) {
fp = fopen(tag, "w+");
if (!fp) {
if (stat(tag, &s)) {
fp = fopen(tag, "w+");
if (!fp) {
- ULOG_ERR("extroot: failed to write UUID to %s: %d (%
s
)\n",
- tag, errno
, strerror(errno)
);
+ ULOG_ERR("extroot: failed to write UUID to %s: %d (%
m
)\n",
+ tag, errno);
/* return 0 to continue boot regardless of error */
return 0;
}
/* return 0 to continue boot regardless of error */
return 0;
}
@@
-1365,14
+1372,14
@@
static int check_extroot(char *path)
fp = fopen(tag, "r");
if (!fp) {
fp = fopen(tag, "r");
if (!fp) {
- ULOG_ERR("extroot: failed to read UUID from %s: %d (%
s
)\n",
- tag, errno
, strerror(errno)
);
+ ULOG_ERR("extroot: failed to read UUID from %s: %d (%
m
)\n",
+ tag, errno);
return -1;
}
if (!fgets(uuid, sizeof(uuid), fp))
return -1;
}
if (!fgets(uuid, sizeof(uuid), fp))
- ULOG_ERR("extroot: failed to read UUID from %s: %d (%
s
)\n",
- tag, errno
, strerror(errno)
);
+ ULOG_ERR("extroot: failed to read UUID from %s: %d (%
m
)\n",
+ tag, errno);
fclose(fp);
if (*uuid && !strcasecmp(uuid, pr->uuid))
fclose(fp);
if (*uuid && !strcasecmp(uuid, pr->uuid))
@@
-1428,8
+1435,9
@@
static int mount_extroot(char *cfg)
if (pr) {
if (strncmp(pr->type, "ext", 3) &&
strncmp(pr->type, "f2fs", 4) &&
if (pr) {
if (strncmp(pr->type, "ext", 3) &&
strncmp(pr->type, "f2fs", 4) &&
+ strncmp(pr->type, "btrfs", 5) &&
strncmp(pr->type, "ubifs", 5)) {
strncmp(pr->type, "ubifs", 5)) {
- ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs or ubifs\n", pr->type);
+ ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs
, btrfs
or ubifs\n", pr->type);
return -1;
}
return -1;
}
@@
-1449,8
+1457,8
@@
static int mount_extroot(char *cfg)
(m->options) ? (m->options) : (""));
if (err) {
(m->options) ? (m->options) : (""));
if (err) {
- ULOG_ERR("extroot: mounting %s (%s) on %s failed: %d (%
s
)\n",
- pr->dev, pr->type, path, errno
, strerror(errno)
);
+ ULOG_ERR("extroot: mounting %s (%s) on %s failed: %d (%
m
)\n",
+ pr->dev, pr->type, path, errno);
} else if (m->overlay) {
err = check_extroot(path);
if (err)
} else if (m->overlay) {
err = check_extroot(path);
if (err)