~ubuntu-branches/ubuntu/trusty/nilfs-tools/trusty

« back to all changes in this revision

Viewing changes to sbin/mount/mount.nilfs2.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2011-07-10 17:10:21 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110710171021-xkbtr81jprb97iec
Tags: upstream-2.1.0~rc1
ImportĀ upstreamĀ versionĀ 2.1.0~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
#include <strings.h>
54
54
#endif  /* HAVE_STRINGS_H */
55
55
 
56
 
#include <stdarg.h>
57
 
 
58
56
#if HAVE_STRING_H
59
57
#include <string.h>
60
58
#endif  /* HAVE_STRING_H */
67
65
#include <sys/stat.h>
68
66
#endif  /* HAVE_SYS_STAT_H */
69
67
 
70
 
#include <signal.h>
71
 
#include <errno.h>
72
 
 
73
68
#if HAVE_SYSLOG_H
74
69
#include <syslog.h>
75
70
#endif  /* HAVE_SYSLOG_H */
76
71
 
 
72
#include <signal.h>
 
73
#include <stdarg.h>
 
74
#include <errno.h>
 
75
 
77
76
#include "fstab.h"
78
77
#include "paths.h"
79
78
#include "sundries.h"
82
81
#include "mount_constants.h"
83
82
#include "mount_opts.h"
84
83
#include "mount.nilfs2.h"
 
84
#include "cleaner_exec.h"
85
85
#include "nls.h"
86
86
 
 
87
/* mount options */
87
88
int verbose = 0;
88
89
int mount_quiet = 0;
89
90
int readonly = 0;
92
93
static int devro = 0;
93
94
static int fake = 0;
94
95
 
 
96
/* global variables */
95
97
extern char *optarg;
96
98
extern int optind;
97
99
 
116
118
struct mount_options options;
117
119
 
118
120
 
 
121
static void nilfs_mount_logger(int priority, const char *fmt, ...)
 
122
{
 
123
        va_list args;
 
124
 
 
125
        if ((verbose && priority > LOG_INFO) || priority >= LOG_INFO)
 
126
                return;
 
127
        va_start(args, fmt);
 
128
        fprintf(stderr, "%s: ", progname);
 
129
        vfprintf(stderr, fmt, args);
 
130
        fputs(_("\n"), stderr);
 
131
        va_end(args);
 
132
}
 
133
 
119
134
/* Report on a single mount.  */
120
135
static void print_one (const struct my_mntent *me)
121
136
{
444
459
                        goto failed;
445
460
                pid = 0;
446
461
                if (find_opt(mc->m.mnt_opts, gcpid_opt_fmt, &pid) >= 0 &&
447
 
                    stop_cleanerd(mi->device, (pid_t)pid) < 0) {
 
462
                    nilfs_shutdown_cleanerd(mi->device, (pid_t)pid) < 0) {
448
463
                        error(_("%s: remount failed due to %s shutdown "
449
 
                                "failure"), progname, CLEANERD_NAME);
 
464
                                "failure"), progname, NILFS_CLEANERD_NAME);
450
465
                        goto failed;
451
466
                }
452
467
                mi->gcpid = pid;
495
510
        /* because filesystem is still mounted */
496
511
        if (!mi->nogc && mtab_ok) {
497
512
                /* Restarting cleaner daemon */
498
 
                if (start_cleanerd(mi->device, mi->mntdir, mi->protperiod,
499
 
                                   &mi->gcpid) == 0) {
 
513
                if (nilfs_launch_cleanerd(mi->device, mi->mntdir,
 
514
                                          mi->protperiod, &mi->gcpid)) {
500
515
                        if (verbose)
501
516
                                printf(_("%s: restarted %s\n"),
502
 
                                       progname, CLEANERD_NAME);
 
517
                                       progname, NILFS_CLEANERD_NAME);
503
518
                        update_gcpid_opt(&mi->optstr, mi->gcpid);
504
519
                        update_mtab_entry(mi->device, mi->mntdir, fstype,
505
520
                                          mi->optstr, 0, 0, !mi->mounted);
506
521
                } else {
507
522
                        error(_("%s: failed to restart %s"),
508
 
                              progname, CLEANERD_NAME);
 
523
                              progname, NILFS_CLEANERD_NAME);
509
524
                }
510
525
        } else
511
 
                printf(_("%s not restarted\n"), CLEANERD_NAME);
 
526
                printf(_("%s not restarted\n"), NILFS_CLEANERD_NAME);
512
527
 out:
513
528
        my_free(exopts);
514
529
        return res;
526
541
 
527
542
        if (!check_mtab()) {
528
543
                if (rungc)
529
 
                        printf(_("%s not started\n"), CLEANERD_NAME);
 
544
                        printf(_("%s not started\n"), NILFS_CLEANERD_NAME);
530
545
                return;
531
546
        }
532
547
 
533
548
        if (rungc) {
534
549
                if (find_opt(mo->extra_opts, pp_opt_fmt, &pp) < 0)
535
550
                        pp = mi->protperiod;
536
 
 
537
 
                if (start_cleanerd(mi->device, mi->mntdir, pp, &pid) < 0)
538
 
                        error(_("%s aborted"), CLEANERD_NAME);
 
551
                if (nilfs_launch_cleanerd(mi->device, mi->mntdir, pp,
 
552
                                          &pid) < 0)
 
553
                        error(_("%s aborted"), NILFS_CLEANERD_NAME);
539
554
                else if (verbose)
540
 
                        printf(_("%s: started %s\n"), progname, CLEANERD_NAME);
 
555
                        printf(_("%s: started %s\n"), progname,
 
556
                               NILFS_CLEANERD_NAME);
541
557
        }
542
558
 
543
559
        my_free(mi->optstr);
584
600
                progname = (cp ? cp + 1 : argv[0]);
585
601
        }
586
602
 
 
603
        nilfs_cleaner_logger = nilfs_mount_logger;
 
604
 
587
605
        parse_options(argc, argv, opts);
588
606
 
589
607
        umask(022);