Karel Zak [Wed, 19 Nov 2008 10:07:58 +0000 (11:07 +0100)]
build-sys: move pivot_root(8) to sys-utils
This patch moves pivot_root.{8,c) from mount/ to sys-utils/ directory.
There is not ant relation between pivot_root source code and the rest of
code in the mount.
Matthias Koenig [Thu, 6 Nov 2008 13:45:38 +0000 (14:45 +0100)]
losetup: try to set up loop readonly if EACCES
Currently mounting/losetup an image fails if it is accessable readonly.
There are no problems if it is a file on a local filesystem.
It seems only to happen if it is a NFS mounted image, which is
read-write in permission but with root_squash option.
set_loop checks only for EROFS to retry open with readonly mode,
but in this case we get EACCES.
Karel Zak [Thu, 30 Oct 2008 12:42:50 +0000 (13:42 +0100)]
namei: add --owners and --long options
Added file owner and group name printing support. The groupnames and
usernames are cached to avoid an extra overhead. This implementation
does not use fixed width of user/group name columns.
Karel Zak [Thu, 30 Oct 2008 09:19:39 +0000 (10:19 +0100)]
namei: new re-written version
This new version:
* not based on chdir()
* implemented without recursion (does not depend on stack size)
* list of directories is stored in allocated memory (the code is
extendable with new functionality (e.g. show usernames, groupnames,
selunux contexts, ...).
* supports long command line options
* adds a new command line option:
-n, --nosymlinks don't follow symlinks
Karel Zak [Fri, 3 Oct 2008 07:34:25 +0000 (09:34 +0200)]
mount: remove link to namesys.com
Ricardo Catalinas Jiménez wrote:
In the man page mount(8) there is the url
"http://www.namesys.com/mount-options.html". The web site has been
down for a long time and the Namesys company is trying to be sold.
Reported-By: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 30 Sep 2008 22:27:37 +0000 (00:27 +0200)]
mount: mtab created multiple times with -a option
When /etc/mtab does not exist and mount is called with -a, for every
mount point that is mounted a root-fs record is added to mtab. This is
because get_mtab_info() sets the flag mtab_does_not_exist to 1 when it
doesn't find /etc/mtab. However, if it actually finds /etc/mtab, the
variable is not reset to 0. So on every subsequent call to
get_mtab_info() (as it is the case when mounting several mount points
with the -a option), mount will think that /etc/mtab does not exist,
even if it was created in the meantime by mount itself.
Reported-By: Jonas Kramer <jkramer@nex.scrapping.cc> Signed-off-by: Karel Zak <kzak@redhat.com>
Linux cannot umount a device whose mount point is hidden by subsequent
mount(s). i.e. We must umount the devices associated to a mount point
in the reverse order of when they were mounted. If umount was called
violating this rule, report error and exit.
Signed-off-by: Guan Xin <guanx.bac@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 17 Sep 2008 11:49:45 +0000 (13:49 +0200)]
build-sys: add -luuid to BLKID_LIBS
The libblkid is always linked with libuuild, so this indirect
dependence in BLKID_LIBS is not a problem. This change helps to people
who compile util-linux-ng with non-standard prefix, ..etc.
klibc porting fix, use proper include, nuke redefinition.
solaris.c:8: error: redefinition of typedef ‘daddr_t’
/usr/lib/klibc/include/sys/types.h:29: error: previous declaration of ‘daddr_t’ was here
Karel Zak [Thu, 21 Aug 2008 10:06:25 +0000 (12:06 +0200)]
losetup: remove dependence on minor numbers
The latest kernel supports partitioned loop devices (kernel commit 476a4813cfddf7cf159956cc0e2d3c830c1507e3). Unfortunately, this change
makes minor numbers useless, because mirror number does not match with
loop device name (loop<N>).
ipcs: adjust some field positions and widths for correct alignment
[kzak@redhat.com:
- note that "ipcs -m -t" did not work correctly on
terminal with 80 columns
- the change of output alignment should be mentioned
in the Release Notes]
ipcs: ungettextize the spacing of the table headers
It makes no sense to allow translators to adjust the spacing when
they cannot adjust the spacing of the actual data too. Adjusting
such spacing is not really a translator's task.
Cai Qian [Sun, 10 Aug 2008 07:33:51 +0000 (15:33 +0800)]
lscpu: --sysroot option and stable cache output
This patch added a --sysroot command-line option for testing purpose. It
also sorted cache names, and displayed cache information in a sorted
manner instead of randomly before. In addition, it had some other minor
fixes.
Karel Zak [Wed, 30 Jul 2008 10:39:04 +0000 (12:39 +0200)]
scriptreplay: new implementation is out-of-sync
Reproduction steps:
1. Run "script -t 2>timing".
2. When the prompt comes up, hit return.
3. New prompt. Wait several seconds, then type "true" and hit return.
4. Repeat (3) as desired, then exit scripted shell.
5. Run "scriptreplay timing".
You'll find on the replay that, rather than waiting several seconds
between the prompt and true, the wait will actually occur after the
first "t" of true.
Reported-by: Micah Cowan <micah@cowan.name> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 8 Aug 2008 23:22:08 +0000 (01:22 +0200)]
hwclock: use carefully synchronize_to_clock_tick() return codes
* It seems that
rtc-isl1208 0-006f: chip found, driver version 0.3
rtc-isl1208 0-006f: rtc core: registered rtc-isl1208 as rtc0
rtc-isl1208 0-006f: rtc power failure detected, please set clock.
causes that hardware clock returns persistent time and synchronization
is impossible. The hwclock(8) has to ignore this problem and allows to
set clock anyway.
* synchronize_to_clock_tick() shouldn't to print the "...got clock tick"
debug message in case of failure.
David Brownell [Tue, 12 Aug 2008 10:13:52 +0000 (03:13 -0700)]
hwclock: remove x86_64-specific bogon
I was puzzled why "hwclock" wrongly reported my x86_64 sytem didn't
support RTC update interrupts. Bogus #ifdef, that's why ... added
by the 2.11y patch (from 2.11t). Probably this whole #ifdef should
just vanish ... if the kernel rejects UIE_ON, the program ought to
just cope with it.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
ncurses library can be build with terminal related functions
landing in separate libtinfo library. Check for ncurses function
when testing ncurses library existence.
Andrew McGill [Tue, 29 Jul 2008 21:56:05 +0000 (23:56 +0200)]
script: don't flush input when starting script
script currently flushed the input buffer when starting up. This undocumented
behaviour prevents typeahead when starting up (e.g. as part of .profile).
Rather retain queued input. Don't discard queued output either.
Signed-off-by: Andrew McGill <andrew@lunch.za.net>
Karel Zak [Fri, 1 Aug 2008 10:18:03 +0000 (12:18 +0200)]
losetup: looplist_* refactoring, remove scandir()
This patch replaces scandir-based implementation with readdir(). The
readdir(3) is less expensive and more portable (to non-glibc environment).
The patch also replaces sysfs-based solution with simpler /proc/partitions
parsing. The /proc/partitions includes all used loop devices on all systems
(include 2.4). This solution seems faster than scandir(/sys/block/) too.
Summary, the losetup (with this patch) uses three methods to found a
loop device:
a) parse /proc/partitions to found already used loop devices (for
loserup -a)
b) stat(2) for all loop[0-7] devices (default number of loop devices).
This is classic method from util-linux <= 2.13. This method is good
enough for standard Linux machines with default number of loop
devices.
c) scan all /dev or /dev/loop/ for loop devices. This is useful for
crazy people who need more than 8 loop devices.
Matthias Koenig [Mon, 9 Jun 2008 14:38:25 +0000 (16:38 +0200)]
mount: retry on ENOMEDIUM
Due to a change in kernel behaviour when opening CDROM devices,
we need to retry the open/mount call when ENOMEDIUM is returned.
Explanation from Tejun Heo:
Okay, the difference is from the addition of cdrom_get_media_event()
call to both sr_drive_status() and ide_cdrom_drive_status().
Previously, the cdrom driver can't differentiate between tray closed
w/ no media and tray open and always returned tray open, which
triggers close and retry in the open logic which probably have delayed
things enough to get the media recognized.
Now the cdrom driver can discern between tray closed w/o media and
device not ready for other reasons and returns -ENOMEDIUM on the
former. This is all good and dandy but the problem seems that some
drives report no media right after the tray is closed but it hasn't
properly detected the media yet.
It seems the only way to work around the problem is via sensible
retries (e.g. try three times 5 secs apart) and I don't think we can
add that type of retry logic into cdrom open path. Please note that
the previous logic wasn't water proof. Some drives can take longer to
recognize the media is there and could have failed the in-kernel retry
too. Also, reading the media can take quite some time and during that
period the drive reports media present but device not ready. The
driver will retry the command (e.g. READ TOC for open) five times but
all of them can fail w/ EMEDIUMTYPE.
[kzak@redhat.com: - add CRDOM_NOMEDIUM_RETRIES to blkdev.h
- add verbose message to mount.c]
Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘klogctl’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘type’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘b’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘len’
without belows compat section dmesg just compiles fine against klibc.
as bonus reorder the includes.
Samuel Thibault [Thu, 24 Jul 2008 00:27:14 +0000 (01:27 +0100)]
ldattach: don't compile for non-linux systems
There is just ldattach which doesn't compile because line disciplines are not
implemented that way on the Hurd. Is TIOCSETD any kind of standard? Else I
guess the patch below would be fine.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>