From owner-freebsd-current@FreeBSD.ORG Wed Jun 30 14:18:26 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E81116A4CE for ; Wed, 30 Jun 2004 14:18:26 +0000 (GMT) Received: from abel.math.ntnu.no (abel.math.ntnu.no [129.241.15.50]) by mx1.FreeBSD.org (Postfix) with SMTP id F201343D2F for ; Wed, 30 Jun 2004 14:18:22 +0000 (GMT) (envelope-from perhov@math.ntnu.no) Received: (qmail 3480 invoked by uid 29119); 30 Jun 2004 14:17:33 -0000 Date: Wed, 30 Jun 2004 16:17:31 +0200 (MEST) From: Per Kristian Hove To: Daniel O'Connor In-Reply-To: <200406301211.21397.doconnor@gsoft.com.au> Message-ID: References: <20040629075337.81BEF16A4CF@hub.freebsd.org> <200406301211.21397.doconnor@gsoft.com.au> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-33463914-1088605051=:25890" X-Mailman-Approved-At: Thu, 01 Jul 2004 12:04:02 +0000 cc: Carl Makin cc: Paul Mather cc: freebsd-current@freebsd.org cc: Paul Seniura Subject: Re: Q's about IBM TSM (was Re: HEADSUP: ibcs2 and svr4 compatheaded for history) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2004 14:18:26 -0000 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 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: 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--