]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: (old) remove mtab lock test
authorKarel Zak <kzak@redhat.com>
Wed, 30 May 2012 15:17:49 +0000 (17:17 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 26 Jun 2012 18:48:22 +0000 (20:48 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
mount-deprecated/fstab.c

index 90c8032fb96a284df762b7d5e95486d3c01835b7..54b6ed132f3075149a52e03d7bad4e3f96f5b956 100644 (file)
@@ -1033,138 +1033,3 @@ update_mtab (const char *dir, struct my_mntent *instead) {
        unlock_mtab();
 }
 
-
-#ifdef MAIN_TEST_MTABLOCK
-
-/*
- * This is mtab locking code test for:
- *
- *     - performance (how many concurrent processes)
- *
- *     - lock reliability (is possible to see corrupted data  if more
- *                         concurrent processes modify a same file)
- *
- *  The test is very simple -- it reads a number from locked file, increments the
- *  number and writes the number back to the file.
- */
-/* dummy */
-char *fsprobe_get_label_by_devname(const char *spec __attribute__((__unused__)))
-{
-       return NULL;
-}
-char *fsprobe_get_uuid_by_devname(const char *spec __attribute__((__unused__)))
-{
-       return NULL;
-}
-int fsprobe_parse_spec(const char *spec __attribute__((__unused__)),
-                      char **name __attribute__((__unused__)),
-                      char **value __attribute__((__unused__)))
-{
-       return 0;
-}
-struct my_mntent *my_getmntent (mntFILE *mfp __attribute__((__unused__)))
-{
-       return NULL;
-}
-mntFILE *my_setmntent (const char *file __attribute__((__unused__)),
-                      char *mode __attribute__((__unused__)))
-{
-       return NULL;
-}
-void my_endmntent (mntFILE *mfp __attribute__((__unused__)))
-{
-       /* nothing */
-}
-int my_addmntent (mntFILE *mfp __attribute__((__unused__)),
-                 struct my_mntent *mnt __attribute__((__unused__)))
-{
-       return 0;
-}
-
-int
-main(int argc, char **argv)
-{
-       time_t synctime;
-       char *filename;
-       int nloops, id, i;
-       pid_t pid = getpid();
-       unsigned int usecs;
-       struct timeval tv;
-       struct stat st;
-       long last = 0;
-
-       progname = argv[0];
-
-       if (argc < 3)
-               die(EXIT_FAILURE,
-                       "usage: %s <id> <synctime> <file> <nloops>\n",
-                       progname);
-
-       id = atoi(argv[1]);
-       synctime = (time_t) atol(argv[2]);
-       filename = argv[3];
-       nloops = atoi(argv[4]);
-
-       if (stat(filename, &st) < -1)
-               die(EXIT_FAILURE, "%s: %m\n", filename);
-
-       fprintf(stderr, "%05d (pid=%05d): START\n", id, pid);
-
-       gettimeofday(&tv, NULL);
-       if (synctime && synctime - tv.tv_sec > 1) {
-               usecs = ((synctime - tv.tv_sec) * 1000000UL) -
-                                       (1000000UL - tv.tv_usec);
-               usleep(usecs);
-       }
-
-       for (i = 0; i < nloops; i++) {
-               FILE *f;
-               long num;
-               char buf[256];
-
-               lock_mtab();
-
-               if (!(f = fopen(filename, "r"))) {
-                       unlock_mtab();
-                       die(EXIT_FAILURE, "ERROR: %d (pid=%d, loop=%d): "
-                                       "open for read failed\n", id, pid, i);
-               }
-               if (!fgets(buf, sizeof(buf), f)) {
-                       unlock_mtab();
-                       die(EXIT_FAILURE, "ERROR: %d (pid=%d, loop=%d): "
-                                       "read failed\n", id, pid, i);
-               }
-               fclose(f);
-
-               num = atol(buf) + 1;
-
-               if (!(f = fopen(filename, "w"))) {
-                       unlock_mtab();
-                       die(EXIT_FAILURE, "ERROR: %d (pid=%d, loop=%d): "
-                                       "open for write failed\n", id, pid, i);
-               }
-               fprintf(f, "%ld", num);
-               fclose(f);
-
-               unlock_mtab();
-
-               gettimeofday(&tv, NULL);
-
-               fprintf(stderr, "%010ld.%06ld %04d (pid=%05d, loop=%05d): "
-                               "num=%09ld last=%09ld\n",
-                               tv.tv_sec, tv.tv_usec, id,
-                               pid, i, num, last);
-               last = num;
-
-               /* The mount command usually finish after mtab update. We
-                * simulate this via short sleep -- it's also enough to make
-                * concurrent processes happy.
-                */
-               usleep(50000);
-       }
-
-       fprintf(stderr, "%05d (pid=%05d): DONE\n", id, pid);
-
-       exit(EXIT_SUCCESS);
-}
-#endif