~adam-stokes/ubuntu/quantal/nfs-utils/hang-on-kernel-expire-794112

« back to all changes in this revision

Viewing changes to .pc/03-handle-mtab-symlink.patch/utils/mount/fstab.c

  • Committer: Steve Langasek
  • Date: 2011-10-29 21:56:45 UTC
  • mfrom: (14.1.15 sid)
  • Revision ID: steve.langasek@canonical.com-20111029215645-ohwji14mw3tamz84
Merge Debian version 1:1.2.5-2

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 
87
87
struct mntentchn mounttable;
88
88
static int got_mtab = 0;
 
89
struct mntentchn procmounts;
 
90
static int got_procmounts = 0;
89
91
struct mntentchn fstab;
90
92
static int got_fstab = 0;
91
93
 
92
94
static void read_mounttable(void);
 
95
static void read_procmounts(void);
93
96
static void read_fstab(void);
94
97
 
95
98
static struct mntentchn *
101
104
}
102
105
 
103
106
static struct mntentchn *
 
107
procmounts_head(void)
 
108
{
 
109
        if (!got_procmounts)
 
110
                read_procmounts();
 
111
        return &procmounts;
 
112
}
 
113
 
 
114
static struct mntentchn *
104
115
fstab_head(void)
105
116
{
106
117
        if (!got_fstab)
186
197
        read_mntentchn(mfp, fnam, mc);
187
198
}
188
199
 
 
200
/*
 
201
 * Read /proc/mounts.
 
202
 * This produces a linked list. The list head procmounts is a dummy.
 
203
 * Return 0 on success.
 
204
 */
 
205
static void
 
206
read_procmounts() {
 
207
        mntFILE *mfp;
 
208
        const char *fnam;
 
209
        struct mntentchn *mc = &procmounts;
 
210
 
 
211
        got_procmounts = 1;
 
212
        mc->nxt = mc->prev = NULL;
 
213
 
 
214
        fnam = PROC_MOUNTS;
 
215
        mfp = nfs_setmntent(fnam, "r");
 
216
        if (mfp == NULL || mfp->mntent_fp == NULL) {
 
217
                nfs_error(_("warning: can't open %s: %s"),
 
218
                          PROC_MOUNTS, strerror (errno));
 
219
                return;
 
220
        }
 
221
        read_mntentchn(mfp, fnam, mc);
 
222
}
 
223
 
189
224
static void
190
225
read_fstab()
191
226
{
225
260
}
226
261
 
227
262
/*
 
263
 * Given the directory name NAME, and the place MCPREV we found it last time,
 
264
 * try to find more occurrences.
 
265
 */
 
266
struct mntentchn *
 
267
getprocmntdirbackward (const char *name, struct mntentchn *mcprev) {
 
268
        struct mntentchn *mc, *mc0;
 
269
 
 
270
        mc0 = procmounts_head();
 
271
        if (!mcprev)
 
272
                mcprev = mc0;
 
273
        for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
 
274
                if (streq(mc->m.mnt_dir, name))
 
275
                        return mc;
 
276
        return NULL;
 
277
}
 
278
 
 
279
/*
228
280
 * Given the device name NAME, and the place MCPREV we found it last time,
229
281
 * try to find more occurrences.
230
282
 */