Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2004 16:17:31 +0200 (MEST)
From:      Per Kristian Hove <Per.Hove@math.ntnu.no>
To:        Daniel O'Connor <doconnor@gsoft.com.au>
Cc:        Paul Seniura <pdseniura@techie.com>
Subject:   Re: Q's about IBM TSM (was Re: HEADSUP:  ibcs2 and svr4 compatheaded for history)
Message-ID:  <Pine.GSO.4.58.0406301558540.25890@abel.math.ntnu.no>
In-Reply-To: <200406301211.21397.doconnor@gsoft.com.au>
References:  <20040629075337.81BEF16A4CF@hub.freebsd.org> <200406301211.21397.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-33463914-1088605051=:25890
Content-Type: TEXT/PLAIN; charset=US-ASCII

[Daniel O'Connor, 2004-06-30]

|  On Wed, 30 Jun 2004 01:11, Paul Mather wrote:
|  > having an empty or missing /compat/linux/etc/mtab file.  Creating a
|  > proper mtab file solves these problems.  One way to do this is via
|  > something like the following:
|  >
|  > 	sed 's/ufs/ext2/' < /etc/fstab > /compat/linux/etc/mtab
|  >
|  > That way, the Linux TSM "sees" your UFS partitions and will
|  > backup/restore to them.
|
|  I wonder if it could work with an LD_PRELOAD or some other linker trickery..

LD_PRELOADing ought to work. The attached file is an example library.
Compile with "gcc -o libmtab.so -shared -fpic libmtab.c" to test
(you'll probably have to add "-ldl" to compile it on Linux, if you
want to test TSM).

This is just a proof-of-concept; you'd probably want to substitue the
system() call with something sane, make sure you only s/ufs/ext2/ in
the third column, etc. Example:

   # cat /etc/mtab
   cat: /etc/mtab: No such file or directory
   # export LD_PRELOAD=$PWD/libmtab.so
   # cat /etc/mtab
   /dev/ad0s1a         /      ext2       rw                1    1
   /dev/ad0s1b         none   swap       sw                0    0
   /dev/ad0s1b         /tmp   mfs        rw,-s=1046528     0    0
   /dev/ad0s1e         /var   ext2       rw                1    2
   /dev/ad0s1f         /usr   ext2       rw                1    2
   /dev/acd0c          /cdrom cd9660     ro,nosuid,nodev,noauto 0    0
   /dev/ad0s2a         /work  ext2       rw                1    1

To be complete, the library should also work with relative pathnames.
Implementing that is left as an exercise for the reader. The example
library doesn't do that:

   # cd /etc; cat mtab
   cat: mtab: No such file or directory


-- 
Per Kristian Hove <Per.Hove@math.ntnu.no>
Chief engineer
Dept. of Mathematical Sciences
Norwegian University of Science and Technology
---559023410-33463914-1088605051=:25890
Content-Type: TEXT/plain; charset=US-ASCII; name="libmtab.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.4.58.0406301617310.25890@abel.math.ntnu.no>
Content-Description: 
Content-Disposition: attachment; filename="libmtab.c"

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8ZGxmY24uaD4NCiNpbmNs
dWRlIDxzdHJpbmcuaD4NCiNpbmNsdWRlIDxsaW1pdHMuaD4NCiNpbmNsdWRl
IDxmY250bC5oPg0KDQojaWZuZGVmIFJUTERfTkVYVA0KI2RlZmluZSBSVExE
X05FWFQJICAoKHZvaWQgKikgLTFsKQ0KI2VuZGlmDQoNCiNkZWZpbmUgUEFU
SF9NVEFCICIvZXRjL210YWIiDQoNCmludCBvcGVuKGNvbnN0IGNoYXIgKnBh
dGgsIGludCBvZmxhZywgLi4uKSB7DQogICAgc3RhdGljIGludCAgICAgICAg
ICAgICAoKmZ1bmMpIChjb25zdCBjaGFyICosIGludCwgLi4uKTsNCiAgICBp
bnQgICAgICAgICAgICAgICAgICAgIGZkLCBmZGZzdGFiOw0KICAgIGNoYXIg
dG1wZmlsZVtdID0gIi90bXAvbXRhYi5YWFhYWFgiOw0KICAgIGNoYXIgY21k
WzgwXTsNCg0KICAgIGlmICghZnVuYykNCglmdW5jID0gKGludCAoKikgKGNv
bnN0IGNoYXIgKiwgaW50LCAuLi4pKSBkbHN5bSAoUlRMRF9ORVhULCAib3Bl
biIpOw0KDQogICAgaWYgKHN0cmNtcChwYXRoLCBQQVRIX01UQUIpKQ0KCXJl
dHVybiBmdW5jKHBhdGgsIG9mbGFnLCAwNjAwKTsNCg0KICAgIGlmICgoZmQg
PSBta3N0ZW1wKHRtcGZpbGUpKSA8IDApIHsNCglwZXJyb3IoImxpYm10YWIu
c286IG1rc3RlbXA6Iik7DQogICAgfQ0KICAgIHNwcmludGYoY21kLCAic2Vk
ICdzL3Vmcy9leHQyLycgPCAvZXRjL2ZzdGFiID4gJXMiLCB0bXBmaWxlKTsN
CiAgICBzeXN0ZW0oY21kKTsNCiAgICB1bmxpbmsodG1wZmlsZSk7DQogICAg
cmV0dXJuIChmZCk7DQp9DQo=

---559023410-33463914-1088605051=:25890--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.58.0406301558540.25890>