File: mount.c

package info (click to toggle)
systemtap 4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,000 kB
  • sloc: cpp: 78,785; ansic: 62,419; xml: 49,443; exp: 42,735; sh: 11,254; python: 3,062; perl: 2,252; tcl: 1,305; makefile: 1,072; lisp: 105; awk: 101; asm: 91; java: 56; sed: 16
file content (83 lines) | stat: -rw-r--r-- 3,478 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* COVERAGE: mount oldumount umount */
#include <sys/types.h>
#include <sys/mount.h>

#ifndef MNT_FORCE
#define MNT_FORCE    0x00000001      /* Attempt to forcibily umount */
#endif

#ifndef MNT_DETACH
#define MNT_DETACH   0x00000002      /* Just detach from the tree */
#endif

#ifndef MNT_EXPIRE
#define MNT_EXPIRE   0x00000004      /* Mark for expiry */
#endif

int main()
{
  mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments");
  //staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = -NNNN (ENOENT)

  umount("umount_target");
  //staptest// umount ("umount_target", 0x0) = -NNNN (ENOENT!!!!EPERM)

  umount2("umount2_target", MNT_FORCE);
  //staptest// umount ("umount2_target", MNT_FORCE) = -NNNN (ENOENT!!!!EPERM)

  umount2("umount2_target", MNT_DETACH);
  //staptest// umount ("umount2_target", MNT_DETACH) = -NNNN (ENOENT!!!!EPERM)

  umount2("umount2_target", MNT_EXPIRE);
  //staptest// umount ("umount2_target", MNT_EXPIRE) = -NNNN (ENOENT!!!!EPERM)

  // Limits testing.
  mount ((char *)-1, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments");
#ifdef __s390__
  //staptest// mount (0x[7]?[f]+, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#else
  //staptest// mount (0x[f]+, "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#endif

  mount ("mount_source", (char *)-1, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments");
#ifdef __s390__
  //staptest// mount ("mount_source", 0x[7]?[f]+, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#else
  //staptest// mount ("mount_source", 0x[f]+, "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#endif
  
  mount ("mount_source", "mount_target", (char *)-1, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments");
#ifdef __s390__
  //staptest// mount ("mount_source", "mount_target", 0x[7]?[f]+, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#else
  //staptest// mount ("mount_source", "mount_target", 0x[f]+, MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, "some arguments") = NNNN
#endif

  mount ("mount_source", "mount_target", "ext2", (unsigned long)-1, "some arguments");
  // We've got a problem here. On a 32-bit kernel (i686 for instance),
  // MAXSTRINGLEN is only 256. Passing a -1 as the mount flags value
  // produces a string of around 225 characters on newer kernels. So,
  // the full argument output gets truncated. So, we'll make the end
  // of the arguments optional.
  //
  //staptest// mount ("mount_source", "mount_target", "ext2", MS_[^ ]+[[[[|XXXX, "some arguments"]]]]?) = NNNN

  mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, (void *)-1);
#ifdef __s390__
  //staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, 0x[7]?[f]+) = NNNN
#else
  //staptest// mount ("mount_source", "mount_target", "ext2", MS_NOSUID|MS_NOATIME|MS_NODIRATIME|MS_BIND, 0x[f]+) = NNNN
#endif

  umount2((char *)-1, MNT_FORCE);
#ifdef __s390__
  //staptest// umount (0x[7]?[f]+, MNT_FORCE) = NNNN
#else
  //staptest// umount (0x[f]+, MNT_FORCE) = NNNN
#endif

  umount2("umount2_target", -1);
  //staptest// umount ("umount2_target", MNT_[^ ]+|XXXX) = NNNN

  return 0;
}