fstab-generator.c revision 093c2cfe3b1ae6081f12927ae7906d90d6623534
6391N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
6391N/A#include "unit-name.h"
6391N/A#include "path-util.h"
6391N/A#include "fstab-util.h"
6391N/A#include "mount-setup.h"
6391N/A#include "generator.h"
6391N/Astatic bool arg_fstab_enabled = true;
if (!name)
return log_oom();
if (!unit)
return log_oom();
log_error("Failed to create swap unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit);
return -errno;
fprintf(f,
what);
if (pri >= 0)
r = fflush_and_check(f);
if (!noauto) {
if (!lnk)
return log_oom();
static int add_mount(
const char *what,
const char *where,
const char *fstype,
const char *opts,
int passno,
bool noauto,
bool nofail,
bool automount,
const char *post,
const char *source) {
_cleanup_free_ char
automount = false;
noauto = false;
nofail = false;
if (!name)
return log_oom();
if (!unit)
return log_oom();
log_error("Failed to create mount unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit);
return -errno;
fprintf(f,
source);
if (passno != 0) {
fprintf(f,
what,
where);
fflush(f);
if (ferror(f))
if (!lnk)
return log_oom();
if (automount) {
if (!automount_name)
return log_oom();
if (!automount_unit)
return log_oom();
fclose(f);
fprintf(f,
source);
if (post)
fprintf(f,
post);
fprintf(f,
where);
fflush(f);
if (ferror(f))
if (!lnk)
return log_oom();
const char *fstab_path;
return -errno;
if (!what)
return log_oom();
if (!where)
return log_oom();
bool automount;
const char *post;
if (initrd)
post,
static int add_root_mount(void) {
const char *opts;
if (!what)
log_oom();
if (!arg_root_options)
else if (arg_root_rw >= 0 ||
opts,
static int add_usr_mount(void) {
const char *opts;
if (!arg_usr_what)
return log_oom();
if (!arg_usr_fstype)
return log_oom();
if (!arg_usr_options)
return log_oom();
if (!arg_usr_what)
if (!arg_usr_options)
opts,
arg_fstab_enabled = r;
return log_oom();
return log_oom();
o = arg_root_options ?
return log_oom();
arg_root_options = o;
return log_oom();
return log_oom();
o = arg_usr_options ?
return log_oom();
arg_usr_options = o;
arg_root_rw = true;
arg_root_rw = false;
return EXIT_FAILURE;
log_open();
if (in_initrd()) {
r = add_root_mount();
r = add_usr_mount();
if (arg_fstab_enabled) {
k = parse_fstab(false);
if (in_initrd()) {
k = parse_fstab(true);