Changeset 902 in MondoRescue for branches/stable/mindi-busybox/util-linux
- Timestamp:
- Oct 25, 2006, 12:41:23 AM (19 years ago)
- Location:
- branches/stable/mindi-busybox/util-linux
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/util-linux/mdev.c
r821 r902 41 41 * also depend on path having writeable space after it. */ 42 42 43 strcat(path, "/dev"); 44 fd = open(path, O_RDONLY); 45 len = read(fd, temp + 1, 64); 46 *temp++ = 0; 47 close(fd); 48 if (len < 1) return; 43 if (!delete) { 44 strcat(path, "/dev"); 45 fd = open(path, O_RDONLY); 46 len = read(fd, temp + 1, 64); 47 *temp++ = 0; 48 close(fd); 49 if (len < 1) return; 50 } 49 51 50 52 /* Determine device name, type, major and minor */ … … 52 54 device_name = strrchr(path, '/') + 1; 53 55 type = path[5]=='c' ? S_IFCHR : S_IFBLK; 54 if (sscanf(temp, "%d:%d", &major, &minor) != 2) return;55 56 56 57 /* If we have a config file, look up permissions for this device */ … … 168 169 umask(0); 169 170 if (!delete) { 171 if (sscanf(temp, "%d:%d", &major, &minor) != 2) return; 170 172 if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST) 171 173 bb_perror_msg_and_die("mknod %s failed", device_name); -
branches/stable/mindi-busybox/util-linux/mount.c
r821 r902 292 292 // a synthetic filesystem like proc or sysfs.) 293 293 294 if ( lstat(mp->mnt_fsname, &st));294 if (stat(mp->mnt_fsname, &st)); 295 295 else if (!(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) { 296 296 // Do we need to allocate a loopback device for it? -
branches/stable/mindi-busybox/util-linux/readprofile.c
r821 r902 68 68 const char *mapFile, *proFile, *mult=0; 69 69 unsigned long len=0, indx=1; 70 u nsigned long longadd0=0;70 uint64_t add0=0; 71 71 unsigned int step; 72 72 unsigned int *buf, total, fn_len; … … 244 244 header_printed = 1; 245 245 } 246 printf ("\t% llx\t%u\n", (indx - 1)*step + add0, buf[indx]);246 printf ("\t%"PRIx64"\t%u\n", (indx - 1)*step + add0, buf[indx]); 247 247 } 248 248 this += buf[indx++]; -
branches/stable/mindi-busybox/util-linux/umount.c
r821 r902 15 15 #include <mntent.h> 16 16 #include <errno.h> 17 #include <string.h>18 17 #include <getopt.h> 19 18 20 #define OPTION_STRING "flDnr vad"19 #define OPTION_STRING "flDnravd" 21 20 #define OPT_FORCE 1 22 21 #define OPT_LAZY 2 … … 24 23 #define OPT_NO_MTAB 8 25 24 #define OPT_REMOUNT 16 26 #define OPT_IGNORED 32 // -v is ignored 27 #define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? 64 : 0) 25 #define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? 32 : 0) 28 26 29 27 int umount_main(int argc, char **argv) … … 78 76 if (!argc) bb_show_usage(); 79 77 } 80 81 82 78 83 79 // Loop through everything we're supposed to umount, and do so. 84 80 for (;;) { 85 81 int curstat; 82 char *zapit = *argv; 86 83 87 84 // Do we already know what to umount this time through the loop? … … 92 89 else if (!argc--) break; 93 90 else { 94 realpath(*argv++, path); 91 argv++; 92 realpath(zapit, path); 95 93 for (m = mtl; m; m = m->next) 96 94 if (!strcmp(path, m->dir) || !strcmp(path, m->device)) 97 95 break; 98 96 } 97 // If we couldn't find this sucker in /etc/mtab, punt by passing our 98 // command line argument straight to the umount syscall. Otherwise, 99 // umount the directory even if we were given the block device. 100 if (m) zapit = m->dir; 99 101 100 102 // Let's ask the thing nicely to unmount. 101 curstat = umount( path);103 curstat = umount(zapit); 102 104 103 105 // Force the unmount, if necessary. 104 106 if (curstat && doForce) { 105 curstat = umount2( path, doForce);107 curstat = umount2(zapit, doForce); 106 108 if (curstat) 107 bb_error_msg_and_die("forced umount of %s failed!", path);109 bb_error_msg_and_die("forced umount of %s failed!", zapit); 108 110 } 109 111 110 112 // If still can't umount, maybe remount read-only? 111 113 if (curstat && (opt & OPT_REMOUNT) && errno == EBUSY && m) { 112 curstat = mount(m->device, path, NULL, MS_REMOUNT|MS_RDONLY, NULL);114 curstat = mount(m->device, zapit, NULL, MS_REMOUNT|MS_RDONLY, NULL); 113 115 bb_error_msg(curstat ? "Cannot remount %s read-only" : 114 116 "%s busy - remounted read-only", m->device); 115 117 } 116 118 117 /* De-allocate the loop device. This ioctl should be ignored on any 118 * non-loop block devices. */ 119 if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONTFREELOOP) && m) 120 del_loop(m->device); 119 if (curstat) { 120 status = EXIT_FAILURE; 121 bb_perror_msg("Couldn't umount %s", zapit); 122 } else { 123 /* De-allocate the loop device. This ioctl should be ignored on 124 * any non-loop block devices. */ 125 if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONTFREELOOP) && m) 126 del_loop(m->device); 127 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m) 128 erase_mtab(m->dir); 129 } 121 130 122 if (curstat) {123 /* Yes, the ENABLE is redundant here, but the optimizer for ARM124 * can't do simple constant propagation in local variables... */125 if(ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)126 erase_mtab(m->dir);127 status = EXIT_FAILURE;128 bb_perror_msg("Couldn't umount %s", path);129 }130 131 // Find next matching mtab entry for -a or umount /dev 132 // Note this means that "umount /dev/blah" will unmount all instances 133 // of /dev/blah, not just the most recent. 131 134 while (m && (m = m->next)) 132 135 if ((opt & OPT_ALL) || !strcmp(path,m->device))
Note:
See TracChangeset
for help on using the changeset viewer.